mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 20:15:39 +02:00
@@ -5,6 +5,13 @@ internal class Globals
|
||||
{
|
||||
public static string strPerunVersion = "DEBUG"; // Helper for pulling version definition
|
||||
public static string[] arrLogHistory = new string[10]; // Log history for GUI
|
||||
public static bool bLogHistoryUpdate = true; // Mark if log control require update
|
||||
public static string strPerunTitleText = "";
|
||||
|
||||
public static bool bStatusIconsForce = true; // Force icons reload
|
||||
public static bool bdcConnection = false; // Historic db connection status
|
||||
public static bool btcpcServer = false; // Historic tcp connection status
|
||||
public static bool bSRSStatus = false; // Historic srs connection status
|
||||
public static bool bLotATCStatus = false; // Historic lotatc connection status
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// This class gathers all helper functions
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
internal class PerunHelper
|
||||
{
|
||||
@@ -12,6 +13,7 @@ internal class PerunHelper
|
||||
}
|
||||
|
||||
arrLogHistory[arrLogHistory.Length - 1] = DateTime.Now.ToString("HH:mm:ss") + " > " + strEntryToAdd; // Add entry at the last position
|
||||
Globals.bLogHistoryUpdate = true;
|
||||
}
|
||||
public static string GetAppVersion(string strBeginning)
|
||||
{
|
||||
@@ -21,6 +23,10 @@ internal class PerunHelper
|
||||
System.Deployment.Application.ApplicationDeployment cd = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
|
||||
Globals.strPerunVersion = cd.CurrentVersion.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Globals.strPerunVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
||||
}
|
||||
return strBeginning+"v" + Globals.strPerunVersion;
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,10 @@
|
||||
this.con_img_srs = new System.Windows.Forms.PictureBox();
|
||||
this.con_img_dcs = new System.Windows.Forms.PictureBox();
|
||||
this.con_img_db = new System.Windows.Forms.PictureBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.con_GroupBox_1.SuspendLayout();
|
||||
this.con_GroupBox_2.SuspendLayout();
|
||||
this.con_GroupBox_3.SuspendLayout();
|
||||
@@ -384,7 +388,7 @@
|
||||
//
|
||||
// con_img_lotATC
|
||||
//
|
||||
this.con_img_lotATC.Location = new System.Drawing.Point(307, 335);
|
||||
this.con_img_lotATC.Location = new System.Drawing.Point(292, 335);
|
||||
this.con_img_lotATC.Name = "con_img_lotATC";
|
||||
this.con_img_lotATC.Size = new System.Drawing.Size(29, 28);
|
||||
this.con_img_lotATC.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
@@ -393,7 +397,7 @@
|
||||
//
|
||||
// con_img_srs
|
||||
//
|
||||
this.con_img_srs.Location = new System.Drawing.Point(272, 335);
|
||||
this.con_img_srs.Location = new System.Drawing.Point(208, 335);
|
||||
this.con_img_srs.Name = "con_img_srs";
|
||||
this.con_img_srs.Size = new System.Drawing.Size(29, 28);
|
||||
this.con_img_srs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
@@ -402,7 +406,7 @@
|
||||
//
|
||||
// con_img_dcs
|
||||
//
|
||||
this.con_img_dcs.Location = new System.Drawing.Point(237, 335);
|
||||
this.con_img_dcs.Location = new System.Drawing.Point(135, 335);
|
||||
this.con_img_dcs.Name = "con_img_dcs";
|
||||
this.con_img_dcs.Size = new System.Drawing.Size(29, 28);
|
||||
this.con_img_dcs.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
@@ -412,18 +416,58 @@
|
||||
// con_img_db
|
||||
//
|
||||
this.con_img_db.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.con_img_db.Location = new System.Drawing.Point(202, 335);
|
||||
this.con_img_db.Location = new System.Drawing.Point(69, 335);
|
||||
this.con_img_db.Name = "con_img_db";
|
||||
this.con_img_db.Size = new System.Drawing.Size(29, 28);
|
||||
this.con_img_db.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.con_img_db.TabIndex = 10;
|
||||
this.con_img_db.TabStop = false;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(15, 335);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(56, 13);
|
||||
this.label9.TabIndex = 1;
|
||||
this.label9.Text = "Database:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(101, 335);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(38, 13);
|
||||
this.label10.TabIndex = 14;
|
||||
this.label10.Text = "Game:";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(170, 335);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(32, 13);
|
||||
this.label11.TabIndex = 15;
|
||||
this.label11.Text = "SRS:";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(243, 335);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(46, 13);
|
||||
this.label12.TabIndex = 16;
|
||||
this.label12.Text = "LotATC:";
|
||||
//
|
||||
// form_Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(349, 604);
|
||||
this.Controls.Add(this.label12);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.con_img_lotATC);
|
||||
this.Controls.Add(this.con_img_srs);
|
||||
this.Controls.Add(this.con_img_dcs);
|
||||
@@ -503,6 +547,10 @@
|
||||
private System.Windows.Forms.PictureBox con_img_dcs;
|
||||
private System.Windows.Forms.PictureBox con_img_srs;
|
||||
private System.Windows.Forms.PictureBox con_img_lotATC;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label label12;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ namespace Perun_v1
|
||||
// Disables controls
|
||||
con_Button_Listen_ON.Enabled = false;
|
||||
con_Button_Listen_OFF.Enabled = true;
|
||||
con_Button_Quit.Enabled = false;
|
||||
con_txt_mysql_database.Enabled = false;
|
||||
con_txt_mysql_username.Enabled = false;
|
||||
con_txt_mysql_password.Enabled = false;
|
||||
@@ -135,6 +136,7 @@ namespace Perun_v1
|
||||
// Enables controls
|
||||
con_Button_Listen_ON.Enabled = true;
|
||||
con_Button_Listen_OFF.Enabled = false;
|
||||
con_Button_Quit.Enabled = true;
|
||||
con_txt_mysql_database.Enabled = true;
|
||||
con_txt_mysql_username.Enabled = true;
|
||||
con_txt_mysql_password.Enabled = true;
|
||||
@@ -164,6 +166,9 @@ namespace Perun_v1
|
||||
// Prepare connection string
|
||||
dcConnection.strMySQLConnectionString = "server=" + con_txt_mysql_server.Text + ";user=" + con_txt_mysql_username.Text + ";database=" + con_txt_mysql_database.Text + ";port=" + con_txt_mysql_port.Text + ";password=" + con_txt_mysql_password.Text;
|
||||
|
||||
// Force icons update
|
||||
Globals.bStatusIconsForce = true;
|
||||
|
||||
// Start timmers
|
||||
tim_200ms.Enabled = true;
|
||||
tim_1000ms.Enabled = true;
|
||||
@@ -199,7 +204,7 @@ namespace Perun_v1
|
||||
|
||||
while (tcpcServer.thrTCPListener.IsAlive)
|
||||
{
|
||||
Thread.Sleep(100); //ms
|
||||
Thread.Sleep(10); //ms
|
||||
}
|
||||
form_Main_EnableControls(); // Enable controls
|
||||
|
||||
@@ -219,7 +224,14 @@ namespace Perun_v1
|
||||
|
||||
// Set title bar
|
||||
this.Text = Globals.strPerunTitleText;
|
||||
}
|
||||
|
||||
// Set helpers for updates
|
||||
Globals.bLogHistoryUpdate = false;
|
||||
Globals.bdcConnection = false;
|
||||
Globals.btcpcServer = false;
|
||||
Globals.bSRSStatus = false;
|
||||
Globals.bLotATCStatus = false;
|
||||
}
|
||||
|
||||
private void con_lab_github_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
@@ -335,13 +347,20 @@ namespace Perun_v1
|
||||
{
|
||||
// Main timer to sync GUI with background tasks and flush buffers
|
||||
// Refresh Log Window
|
||||
con_List_Received.Items.Clear();
|
||||
foreach (string i in Globals.arrLogHistory)
|
||||
if (Globals.bLogHistoryUpdate)
|
||||
{
|
||||
if (i != null)
|
||||
con_List_Received.Items.Clear();
|
||||
foreach (string i in Globals.arrLogHistory)
|
||||
{
|
||||
con_List_Received.Items.Add(i);
|
||||
if (i != null)
|
||||
{
|
||||
con_List_Received.Items.Add(i);
|
||||
}
|
||||
}
|
||||
Globals.bLogHistoryUpdate = false;
|
||||
} else
|
||||
{
|
||||
// Do nothing , control does not require update
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,39 +377,52 @@ namespace Perun_v1
|
||||
}
|
||||
|
||||
// Update status icons at main form
|
||||
if (dcConnection.bStatus)
|
||||
{
|
||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db");
|
||||
} else
|
||||
{
|
||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
if (tcpcServer.bStatus)
|
||||
{
|
||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game");
|
||||
}
|
||||
else
|
||||
{
|
||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
if (bSRSStatus)
|
||||
{
|
||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs");
|
||||
}
|
||||
else
|
||||
{
|
||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
if (bLotATCStatus)
|
||||
{
|
||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc");
|
||||
}
|
||||
else
|
||||
{
|
||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
if ((dcConnection.bStatus != Globals.bdcConnection) || Globals.bStatusIconsForce) {
|
||||
if (dcConnection.bStatus)
|
||||
{
|
||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_db");
|
||||
} else
|
||||
{
|
||||
con_img_db.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
Globals.bdcConnection = dcConnection.bStatus;
|
||||
}
|
||||
|
||||
|
||||
if ((tcpcServer.bStatus != Globals.btcpcServer) || Globals.bStatusIconsForce) {
|
||||
if (tcpcServer.bStatus)
|
||||
{
|
||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_game");
|
||||
}
|
||||
else
|
||||
{
|
||||
con_img_dcs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
Globals.btcpcServer = tcpcServer.bStatus;
|
||||
}
|
||||
if ((bSRSStatus != Globals.bSRSStatus) || Globals.bStatusIconsForce) {
|
||||
if (bSRSStatus)
|
||||
{
|
||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_srs");
|
||||
}
|
||||
else
|
||||
{;
|
||||
con_img_srs.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
Globals.bSRSStatus = bSRSStatus;
|
||||
}
|
||||
if ((bLotATCStatus != Globals.bLotATCStatus) || Globals.bStatusIconsForce)
|
||||
{
|
||||
if (bLotATCStatus)
|
||||
{
|
||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_lotatc");
|
||||
}
|
||||
else
|
||||
{
|
||||
con_img_lotATC.Image = (Image)Properties.Resources.ResourceManager.GetObject("ico_error");
|
||||
}
|
||||
Globals.bLotATCStatus = bLotATCStatus;
|
||||
}
|
||||
Globals.bStatusIconsForce = false;
|
||||
}
|
||||
|
||||
private void tim_10000ms_Tick(object sender, EventArgs e)
|
||||
@@ -495,5 +527,6 @@ namespace Perun_v1
|
||||
}
|
||||
dcConnection.SendToMySql(strLotATCJson);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>Perun.htm</WebPage>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>0.8.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.8.1.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
@@ -49,6 +49,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>SecurityRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
|
||||
// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
|
||||
// przy użyciu symbolu „*”, tak jak pokazano poniżej:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.8.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.8.0.0")]
|
||||
[assembly: AssemblyVersion("0.8.1.0")]
|
||||
[assembly: AssemblyFileVersion("0.8.1.0")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user