mirror of
https://github.com/DaKerboul/perun.git
synced 2026-08-09 17:05:39 +02:00
First working version
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="Perun_v1.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
<section name="Perun.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
@@ -9,6 +10,35 @@
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<Perun_v1.Properties.Settings>
|
||||
<setting name="MYSQL_Server" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="MYSQL_User" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="MYSQL_Password" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="MYSQL_DB" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="OTHER_LOTATC_FILE" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="OTHER_SRS_FILE" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="OTHER_LOTATC_USE" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="OTHER_SRS_USE" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="MYSQL_Port" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</Perun_v1.Properties.Settings>
|
||||
<Perun.Properties.Settings>
|
||||
<setting name="MYSQL_Server" serializeAs="String">
|
||||
<value />
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ProjectGuid>{5A710507-92E9-4664-9B91-918B8B82F107}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Perun_v1</RootNamespace>
|
||||
<AssemblyName>Perun_v1</AssemblyName>
|
||||
<AssemblyName>Perun</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
@@ -23,8 +23,9 @@
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>0.2.1.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
@@ -55,7 +56,8 @@
|
||||
<ManifestCertificateThumbprint>2ACE4C8C2C325A04CA5986B1CD76744B4B03755D</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>Perun_v1_TemporaryKey.pfx</ManifestKeyFile>
|
||||
<ManifestKeyFile>
|
||||
</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
@@ -144,5 +146,8 @@
|
||||
<ItemGroup>
|
||||
<Content Include="perun_logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -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.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
||||
[assembly: AssemblyVersion("0.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.2.0.0")]
|
||||
[assembly: NeutralResourcesLanguage("en")]
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
@@ -60,6 +60,7 @@
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
@@ -68,9 +69,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
@@ -85,9 +87,10 @@
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
@@ -109,9 +112,9 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -118,5 +118,17 @@ namespace Perun_v1.Properties {
|
||||
this["OTHER_SRS_USE"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string MYSQL_Port {
|
||||
get {
|
||||
return ((string)(this["MYSQL_Port"]));
|
||||
}
|
||||
set {
|
||||
this["MYSQL_Port"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Perun.Properties" GeneratedClassName="Settings">
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Perun_v1.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
<Setting Name="MYSQL_Server" Type="System.String" Scope="User">
|
||||
@@ -26,5 +26,8 @@
|
||||
<Setting Name="OTHER_SRS_USE" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="MYSQL_Port" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
54
02_Windows_App/Perun_v1/form_Main.Designer.cs
generated
54
02_Windows_App/Perun_v1/form_Main.Designer.cs
generated
@@ -36,6 +36,8 @@
|
||||
this.con_GroupBox_1 = new System.Windows.Forms.GroupBox();
|
||||
this.tim_1000ms = new System.Windows.Forms.Timer(this.components);
|
||||
this.con_GroupBox_2 = new System.Windows.Forms.GroupBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.con_txt_mysql_port = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.con_txt_mysql_username = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
@@ -83,7 +85,7 @@
|
||||
//
|
||||
// con_Button_Listen_ON
|
||||
//
|
||||
this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 405);
|
||||
this.con_Button_Listen_ON.Location = new System.Drawing.Point(12, 434);
|
||||
this.con_Button_Listen_ON.Name = "con_Button_Listen_ON";
|
||||
this.con_Button_Listen_ON.Size = new System.Drawing.Size(86, 39);
|
||||
this.con_Button_Listen_ON.TabIndex = 2;
|
||||
@@ -94,7 +96,7 @@
|
||||
// con_Button_Listen_OFF
|
||||
//
|
||||
this.con_Button_Listen_OFF.Enabled = false;
|
||||
this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 405);
|
||||
this.con_Button_Listen_OFF.Location = new System.Drawing.Point(104, 434);
|
||||
this.con_Button_Listen_OFF.Name = "con_Button_Listen_OFF";
|
||||
this.con_Button_Listen_OFF.Size = new System.Drawing.Size(86, 39);
|
||||
this.con_Button_Listen_OFF.TabIndex = 3;
|
||||
@@ -105,9 +107,9 @@
|
||||
// con_GroupBox_1
|
||||
//
|
||||
this.con_GroupBox_1.Controls.Add(this.con_List_Received);
|
||||
this.con_GroupBox_1.Location = new System.Drawing.Point(12, 235);
|
||||
this.con_GroupBox_1.Location = new System.Drawing.Point(12, 261);
|
||||
this.con_GroupBox_1.Name = "con_GroupBox_1";
|
||||
this.con_GroupBox_1.Size = new System.Drawing.Size(324, 164);
|
||||
this.con_GroupBox_1.Size = new System.Drawing.Size(324, 167);
|
||||
this.con_GroupBox_1.TabIndex = 4;
|
||||
this.con_GroupBox_1.TabStop = false;
|
||||
this.con_GroupBox_1.Text = "UDP log";
|
||||
@@ -119,6 +121,8 @@
|
||||
//
|
||||
// con_GroupBox_2
|
||||
//
|
||||
this.con_GroupBox_2.Controls.Add(this.label6);
|
||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_port);
|
||||
this.con_GroupBox_2.Controls.Add(this.label4);
|
||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_username);
|
||||
this.con_GroupBox_2.Controls.Add(this.label3);
|
||||
@@ -129,15 +133,31 @@
|
||||
this.con_GroupBox_2.Controls.Add(this.con_txt_mysql_password);
|
||||
this.con_GroupBox_2.Location = new System.Drawing.Point(12, 27);
|
||||
this.con_GroupBox_2.Name = "con_GroupBox_2";
|
||||
this.con_GroupBox_2.Size = new System.Drawing.Size(324, 127);
|
||||
this.con_GroupBox_2.Size = new System.Drawing.Size(324, 154);
|
||||
this.con_GroupBox_2.TabIndex = 5;
|
||||
this.con_GroupBox_2.TabStop = false;
|
||||
this.con_GroupBox_2.Text = "MySQL";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(41, 48);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(59, 13);
|
||||
this.label6.TabIndex = 9;
|
||||
this.label6.Text = "Server port";
|
||||
//
|
||||
// con_txt_mysql_port
|
||||
//
|
||||
this.con_txt_mysql_port.Location = new System.Drawing.Point(106, 45);
|
||||
this.con_txt_mysql_port.Name = "con_txt_mysql_port";
|
||||
this.con_txt_mysql_port.Size = new System.Drawing.Size(207, 20);
|
||||
this.con_txt_mysql_port.TabIndex = 8;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(45, 74);
|
||||
this.label4.Location = new System.Drawing.Point(45, 100);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(55, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
@@ -145,7 +165,7 @@
|
||||
//
|
||||
// con_txt_mysql_username
|
||||
//
|
||||
this.con_txt_mysql_username.Location = new System.Drawing.Point(106, 71);
|
||||
this.con_txt_mysql_username.Location = new System.Drawing.Point(106, 97);
|
||||
this.con_txt_mysql_username.Name = "con_txt_mysql_username";
|
||||
this.con_txt_mysql_username.Size = new System.Drawing.Size(207, 20);
|
||||
this.con_txt_mysql_username.TabIndex = 6;
|
||||
@@ -153,7 +173,7 @@
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(47, 100);
|
||||
this.label3.Location = new System.Drawing.Point(47, 126);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(53, 13);
|
||||
this.label3.TabIndex = 5;
|
||||
@@ -162,7 +182,7 @@
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(47, 48);
|
||||
this.label2.Location = new System.Drawing.Point(47, 74);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
@@ -179,7 +199,7 @@
|
||||
//
|
||||
// con_txt_mysql_database
|
||||
//
|
||||
this.con_txt_mysql_database.Location = new System.Drawing.Point(106, 45);
|
||||
this.con_txt_mysql_database.Location = new System.Drawing.Point(106, 71);
|
||||
this.con_txt_mysql_database.Name = "con_txt_mysql_database";
|
||||
this.con_txt_mysql_database.Size = new System.Drawing.Size(207, 20);
|
||||
this.con_txt_mysql_database.TabIndex = 2;
|
||||
@@ -193,7 +213,7 @@
|
||||
//
|
||||
// con_txt_mysql_password
|
||||
//
|
||||
this.con_txt_mysql_password.Location = new System.Drawing.Point(106, 97);
|
||||
this.con_txt_mysql_password.Location = new System.Drawing.Point(106, 123);
|
||||
this.con_txt_mysql_password.Name = "con_txt_mysql_password";
|
||||
this.con_txt_mysql_password.PasswordChar = '*';
|
||||
this.con_txt_mysql_password.Size = new System.Drawing.Size(207, 20);
|
||||
@@ -205,9 +225,9 @@
|
||||
this.con_GroupBox_3.Controls.Add(this.con_txt_3rd_srs);
|
||||
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_lotatc);
|
||||
this.con_GroupBox_3.Controls.Add(this.con_check_3rd_srs);
|
||||
this.con_GroupBox_3.Location = new System.Drawing.Point(12, 160);
|
||||
this.con_GroupBox_3.Location = new System.Drawing.Point(12, 187);
|
||||
this.con_GroupBox_3.Name = "con_GroupBox_3";
|
||||
this.con_GroupBox_3.Size = new System.Drawing.Size(324, 69);
|
||||
this.con_GroupBox_3.Size = new System.Drawing.Size(324, 68);
|
||||
this.con_GroupBox_3.TabIndex = 6;
|
||||
this.con_GroupBox_3.TabStop = false;
|
||||
this.con_GroupBox_3.Text = "3rd Party";
|
||||
@@ -250,7 +270,7 @@
|
||||
//
|
||||
// con_Button_Quit
|
||||
//
|
||||
this.con_Button_Quit.Location = new System.Drawing.Point(250, 405);
|
||||
this.con_Button_Quit.Location = new System.Drawing.Point(250, 434);
|
||||
this.con_Button_Quit.Name = "con_Button_Quit";
|
||||
this.con_Button_Quit.Size = new System.Drawing.Size(86, 39);
|
||||
this.con_Button_Quit.TabIndex = 7;
|
||||
@@ -298,14 +318,14 @@
|
||||
//
|
||||
// tim_10000ms
|
||||
//
|
||||
this.tim_10000ms.Interval = 10000;
|
||||
this.tim_10000ms.Interval = 30000;
|
||||
this.tim_10000ms.Tick += new System.EventHandler(this.tim_10000ms_Tick);
|
||||
//
|
||||
// form_Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(348, 456);
|
||||
this.ClientSize = new System.Drawing.Size(349, 483);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.con_lab_github);
|
||||
this.Controls.Add(this.con_Button_Quit);
|
||||
@@ -361,6 +381,8 @@
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog_SRS;
|
||||
private System.Windows.Forms.OpenFileDialog openFileDialog_LotATC;
|
||||
private System.Windows.Forms.Timer tim_10000ms;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox con_txt_mysql_port;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,16 +36,15 @@ namespace Perun_v1
|
||||
public void SendToMySql(string raw_udp_frame)
|
||||
{
|
||||
// Main function to send data to mysql
|
||||
// TODO : persistent connection and error handling
|
||||
|
||||
dynamic udp_frame = JsonConvert.DeserializeObject(raw_udp_frame);
|
||||
|
||||
// Cut raw data to type and paylod for proper mysql insert
|
||||
string type = udp_frame.type;
|
||||
|
||||
string type = udp_frame.type;
|
||||
string payload = "";
|
||||
string sql = "";
|
||||
|
||||
// Type specyfic
|
||||
if (type == "1") // Inject app version information
|
||||
// Modify specific
|
||||
if (type == "1") // Inject app version information
|
||||
{
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
@@ -53,7 +52,21 @@ namespace Perun_v1
|
||||
udp_frame.payload["v_win"] = "v"+version;
|
||||
}
|
||||
|
||||
string payload = JsonConvert.SerializeObject(udp_frame.payload);
|
||||
// Specific SQL
|
||||
if(type == "50")
|
||||
{
|
||||
sql = "INSERT INTO `pe_LogChat` (`pe_LogChat_id`, `pe_LogChat_playerid`, `pe_LogChat_msg`, `pe_LogChat_all`) VALUES (NULL, '"+udp_frame.payload.player+ "', '" + udp_frame.payload.msg + "', '" + udp_frame.payload.all + "');";
|
||||
}
|
||||
else if(type == "51")
|
||||
{
|
||||
sql = "INSERT INTO `pe_LogEvent` (`pe_LogEvent_id`, `pe_LogEvent_datetime`, `pe_LogEvent_type`, `pe_LogEvent_content`) VALUES (NULL, CURRENT_TIMESTAMP, '" + udp_frame.payload.log_type + "', '" + udp_frame.payload.log_content + "');";
|
||||
}
|
||||
else
|
||||
{
|
||||
payload = JsonConvert.SerializeObject(udp_frame.payload);
|
||||
sql = "INSERT INTO pe_DataRaw(pe_dataraw_type,pe_dataraw_payload) VALUES (" + type + ",JSON_QUOTE('" + payload + "')) ON DUPLICATE KEY UPDATE pe_dataraw_payload = JSON_QUOTE('" + payload + "')";
|
||||
}
|
||||
|
||||
// Connect to mysql
|
||||
MySqlConnection conn = new MySqlConnection(MySql_connStr);
|
||||
try
|
||||
@@ -61,8 +74,6 @@ namespace Perun_v1
|
||||
Console.WriteLine("Sending data to MySQL - Begin");
|
||||
conn.Open();
|
||||
|
||||
string sql = "INSERT INTO pe_DataRaw(pe_dataraw_type,pe_dataraw_payload) VALUES (" + type+",JSON_QUOTE('" + payload + "')) ON DUPLICATE KEY UPDATE pe_dataraw_payload = JSON_QUOTE('" + payload + "')";
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, conn);
|
||||
MySqlDataReader rdr = cmd.ExecuteReader();
|
||||
|
||||
@@ -162,10 +173,16 @@ namespace Perun_v1
|
||||
con_txt_mysql_username.Text = Properties.Settings.Default.MYSQL_User;
|
||||
con_txt_mysql_password.Text = Properties.Settings.Default.MYSQL_Password;
|
||||
con_txt_mysql_server.Text = Properties.Settings.Default.MYSQL_Server;
|
||||
con_txt_mysql_port.Text = Properties.Settings.Default.MYSQL_Port;
|
||||
con_txt_3rd_lotatc.Text = Properties.Settings.Default.OTHER_LOTATC_FILE;
|
||||
con_txt_3rd_srs.Text = Properties.Settings.Default.OTHER_SRS_FILE;
|
||||
con_check_3rd_lotatc.Checked = Properties.Settings.Default.OTHER_LOTATC_USE;
|
||||
con_check_3rd_srs.Checked = Properties.Settings.Default.OTHER_SRS_USE;
|
||||
|
||||
// Version to title header
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
this.Text = this.Text + " - v" + fileVersionInfo.ProductVersion;
|
||||
}
|
||||
|
||||
private void con_Button_Listen_ON_Click(object sender, EventArgs e)
|
||||
@@ -178,21 +195,22 @@ namespace Perun_v1
|
||||
// Update form controls
|
||||
con_Button_Listen_ON.Enabled = false;
|
||||
con_Button_Listen_OFF.Enabled = true;
|
||||
|
||||
con_txt_mysql_database.Enabled = false;
|
||||
con_txt_mysql_username.Enabled = false;
|
||||
con_txt_mysql_password.Enabled = false;
|
||||
con_txt_mysql_server.Enabled = false;
|
||||
con_txt_mysql_port.Enabled = false;
|
||||
con_txt_3rd_lotatc.Enabled = false;
|
||||
con_txt_3rd_srs.Enabled = false;
|
||||
con_check_3rd_lotatc.Enabled = false;
|
||||
con_check_3rd_srs.Enabled = false;
|
||||
// Prepare connection string
|
||||
MySql_connStr = "server="+con_txt_mysql_server.Text+";user="+con_txt_mysql_username.Text+";database="+con_txt_mysql_database.Text+";port=3306;password="+con_txt_mysql_password.Text;
|
||||
MySql_connStr = "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;
|
||||
|
||||
// Start timmers
|
||||
tim_1000ms.Enabled = true;
|
||||
tim_10000ms.Enabled = true;
|
||||
|
||||
}
|
||||
|
||||
private void con_Button_Listen_OFF_Click(object sender, EventArgs e)
|
||||
@@ -207,6 +225,7 @@ namespace Perun_v1
|
||||
con_txt_mysql_database.Enabled = true;
|
||||
con_txt_mysql_username.Enabled = true;
|
||||
con_txt_mysql_password.Enabled = true;
|
||||
con_txt_mysql_port.Enabled = true;
|
||||
con_txt_mysql_server.Enabled = true;
|
||||
con_txt_3rd_lotatc.Enabled = true;
|
||||
con_txt_3rd_srs.Enabled = true;
|
||||
@@ -261,7 +280,9 @@ namespace Perun_v1
|
||||
Properties.Settings.Default.MYSQL_DB = con_txt_mysql_database.Text;
|
||||
Properties.Settings.Default.MYSQL_User = con_txt_mysql_username.Text;
|
||||
Properties.Settings.Default.MYSQL_Password = con_txt_mysql_password.Text;
|
||||
Properties.Settings.Default.MYSQL_Port = con_txt_mysql_port.Text;
|
||||
Properties.Settings.Default.MYSQL_Server = con_txt_mysql_server.Text;
|
||||
Properties.Settings.Default.MYSQL_Port = con_txt_mysql_port.Text;
|
||||
Properties.Settings.Default.OTHER_LOTATC_FILE = con_txt_3rd_lotatc.Text;
|
||||
Properties.Settings.Default.OTHER_SRS_FILE = con_txt_3rd_srs.Text;
|
||||
Properties.Settings.Default.OTHER_LOTATC_USE = con_check_3rd_lotatc.Checked;
|
||||
@@ -333,14 +354,31 @@ namespace Perun_v1
|
||||
private void tim_10000ms_Tick(object sender, EventArgs e)
|
||||
{
|
||||
// Main timer to send JSON files to MySQL
|
||||
string strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
||||
LogHistoryAdd(ref LogHistory, "SRS data loaded");
|
||||
string strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text);
|
||||
LogHistoryAdd(ref LogHistory, "LotATC data loaded");
|
||||
string strSRSJson;
|
||||
string strLotATCJson;
|
||||
|
||||
if (con_check_3rd_srs.Checked)
|
||||
{
|
||||
strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text);
|
||||
LogHistoryAdd(ref LogHistory, "SRS data loaded");
|
||||
strSRSJson = "{'type':'100','payload':'" + strSRSJson + "'}";
|
||||
}
|
||||
else
|
||||
{
|
||||
strSRSJson = "{'type':'100','payload':{'ignore':'true'}}";
|
||||
}
|
||||
|
||||
strSRSJson = "{'type':'100','payload':'" + strSRSJson + "'}";
|
||||
SendToMySql(strSRSJson);
|
||||
strLotATCJson = "{'type':'101','payload':'" + strLotATCJson + "'}";
|
||||
if (con_check_3rd_lotatc.Checked)
|
||||
{
|
||||
strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text);
|
||||
LogHistoryAdd(ref LogHistory, "LotATC data loaded");
|
||||
strLotATCJson = "{'type':'101','payload':'" + strLotATCJson + "'}";
|
||||
|
||||
} else
|
||||
{
|
||||
strLotATCJson = "{'type':'101','payload':{'ignore':'true'}}";
|
||||
}
|
||||
SendToMySql(strLotATCJson);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user