diff --git a/01_DCS/Hooks/Perun.lua b/01_DCS/Hooks/Perun.lua index 4642079..23bbc76 100644 --- a/01_DCS/Hooks/Perun.lua +++ b/01_DCS/Hooks/Perun.lua @@ -10,14 +10,13 @@ Perun.Refresh = 15 -- base refresh rate in secounds (values lower than 60 may affect performance!) Perun.JsonLocation = "Scripts\\Json\\perun_export.json" -- relatve do user's SaveGames DCS folder Perun.UDPTargetPort = 48620 -- UDP port to send data to - Perun.MOTD_L1 = "Witamy na serwerze Gildia.org" -- Message send to players connecting the server - Line 1 - Perun.MOTD_L2 = "Wymagamy obecnoci na 255Mhz (DCS SRS)" -- Message send to players connecting the server - Line 2 - Perun.MOTD_L3 = "Udanej zabawy" -- Message send to players connecting the server - Line 3 + Perun.MOTD_L1 = "Witamy na serwerze Gildia.org !" -- Message send to players connecting the server - Line 1 + Perun.MOTD_L2 = "Wymagamy obecnosci na 255Mhz (DCS SRS)" -- Message send to players connecting the server - Line 2 -- ########### END OF SETTINGS ########### -- Variable init - Perun.Version = "v0.2.1" + Perun.Version = "v0.3.0" Perun.StatusData = {} Perun.SlotsData = {} Perun.VersionData = {} @@ -156,7 +155,6 @@ Perun.onPlayerStart = function (id) net.send_chat(Perun.MOTD_L1, id); net.send_chat(Perun.MOTD_L2, id); - net.send_chat(Perun.MOTD_L3, id); end Perun.onPlayerTrySendChat = function (playerID, msg, all) @@ -193,7 +191,7 @@ elseif eventName == "disconnect" then --"disconnect", playerID, name, playerSide, reason_code - Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " disconnected; reason: " .. arg4); + Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " disconnected"); elseif eventName == "crash" then --"crash", playerID, unit_missionID @@ -213,7 +211,7 @@ elseif eventName == "pilot_death" then --"pilot_death", playerID, unit_missionID - Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. "died"); + Perun.LogEvent(eventName,net.get_player_info(arg1, "name") .. " died"); else Perun.LogEvent(eventName,"Unknown event type"); diff --git a/02_Windows_App/Perun_v1/Perun_v1.csproj b/02_Windows_App/Perun_v1/Perun_v1.csproj index 65d7b32..69b3183 100644 --- a/02_Windows_App/Perun_v1/Perun_v1.csproj +++ b/02_Windows_App/Perun_v1/Perun_v1.csproj @@ -24,8 +24,8 @@ false true true - 2 - 0.2.1.%2a + 1 + 0.3.0.%2a false true true @@ -48,6 +48,8 @@ TRACE prompt 4 + + perun_logo.ico @@ -65,6 +67,15 @@ true + + false + + + LocalIntranet + + + Properties\app.manifest + ..\packages\Google.Protobuf.3.5.1\lib\net45\Google.Protobuf.dll @@ -118,6 +129,7 @@ + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs b/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs index 71e7591..cc1e05a 100644 --- a/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs +++ b/02_Windows_App/Perun_v1/Properties/AssemblyInfo.cs @@ -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.2.0.0")] -[assembly: AssemblyFileVersion("0.2.0.0")] +[assembly: AssemblyVersion("0.3.0.0")] +[assembly: AssemblyFileVersion("0.3.0.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/02_Windows_App/Perun_v1/Properties/app.manifest b/02_Windows_App/Perun_v1/Properties/app.manifest new file mode 100644 index 0000000..70833e8 --- /dev/null +++ b/02_Windows_App/Perun_v1/Properties/app.manifest @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/02_Windows_App/Perun_v1/form_Main.cs b/02_Windows_App/Perun_v1/form_Main.cs index 4ab4e8d..fbdac93 100644 --- a/02_Windows_App/Perun_v1/form_Main.cs +++ b/02_Windows_App/Perun_v1/form_Main.cs @@ -9,6 +9,7 @@ using System.Windows.Forms; using MySql.Data.MySqlClient; using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Perun_v1 { @@ -21,7 +22,7 @@ namespace Perun_v1 public string[] LogHistory=new string[10]; // Log history for GUI public string[] SendBuffer=new string[10]; // Mysql send buffer public bool LetMeOut=false; // Helper to handle system tray - public string MySql_connStr; // MySQL connection string + public string MySql_connStr; // MySQL connection string public static void LogHistoryAdd(ref string[] LogHistory, string Comment) { @@ -87,8 +88,8 @@ namespace Perun_v1 catch (Exception ex) { Console.WriteLine(ex.ToString()); - LogHistoryAdd(ref LogHistory, "ERROR: MySQL"); - } + LogHistoryAdd(ref LogHistory, "ERROR: MySQL"); + } conn.Close(); Console.WriteLine("Sending data to MySQL - Done"); @@ -204,8 +205,22 @@ namespace Perun_v1 con_txt_3rd_srs.Enabled = false; con_check_3rd_lotatc.Enabled = false; con_check_3rd_srs.Enabled = false; + + // Save settings + Properties.Settings.Default.MYSQL_Server = con_txt_mysql_database.Text; + 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; + Properties.Settings.Default.OTHER_SRS_USE = con_check_3rd_srs.Checked; + // Prepare connection string - 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; + 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; @@ -360,22 +375,53 @@ namespace Perun_v1 bool SRSdefault = true; bool LotATCdefault = true; + // Handle SRS if (con_check_3rd_srs.Checked) { try { strSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text); - JsonConvert.DeserializeObject(strSRSJson); + dynamic raw_lotatc = JsonConvert.DeserializeObject(strSRSJson); - LogHistoryAdd(ref LogHistory, "SRS data loaded"); + for (int i = 0; i < raw_lotatc.Count; i++) + { + + int temp = raw_lotatc[i].RadioInfo.radios.Count - 1; + for (int j = temp; j >= 0; j--) + { + raw_lotatc[i].RadioInfo.radios[j].enc.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].encKey.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].encMode.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].freqMax.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].freqMin.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].modulation.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].freqMode.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].volMode.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].expansion.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].channel.Parent.Remove(); + raw_lotatc[i].RadioInfo.radios[j].simul.Parent.Remove(); + + if (raw_lotatc[i].RadioInfo.radios[j].name == "No Radio") + { + raw_lotatc[i].RadioInfo.radios[j].Remove(); + } + } + raw_lotatc[i].ClientChannelId.Parent.Remove(); + raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove(); + } + + strSRSJson = JsonConvert.SerializeObject(raw_lotatc); strSRSJson = "{'type':'100','payload':'" + strSRSJson + "'}"; - SRSdefault = false; + LogHistoryAdd(ref LogHistory, "SRS data loaded"); + } catch { - + LogHistoryAdd(ref LogHistory, "SRS data ERROR"); } + + } if(SRSdefault) { @@ -383,20 +429,24 @@ namespace Perun_v1 } SendToMySql(strSRSJson); + // Handle LotATC if (con_check_3rd_lotatc.Checked) { try { strLotATCJson = System.IO.File.ReadAllText(con_txt_3rd_lotatc.Text); - JsonConvert.DeserializeObject(strLotATCJson); - LogHistoryAdd(ref LogHistory, "LotATC data loaded"); + dynamic raw_srs = JsonConvert.DeserializeObject(strLotATCJson); + strLotATCJson = "{'type':'101','payload':'" + strLotATCJson + "'}"; + LotATCdefault = false; + LogHistoryAdd(ref LogHistory, "LotATC data loaded"); } catch { - + LogHistoryAdd(ref LogHistory, "LotATC data ERROR"); } + } if (LotATCdefault)