From 6c10f5bace10fc95bdf3ef0bdc2081e8d48172ee Mon Sep 17 00:00:00 2001 From: szporowolik Date: Sat, 2 Nov 2019 18:18:40 +0100 Subject: [PATCH] Update for DCS SRS 1.7.2 ( SRS's JSON file format was changed) --- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs index 1b1baca..e6c4882 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -506,46 +506,40 @@ namespace Perun_v1 ExtSRSJson = System.IO.File.ReadAllText(con_txt_3rd_srs.Text); dynamic raw_lotatc = JsonConvert.DeserializeObject(ExtSRSJson); - for (int i = 0; i < raw_lotatc.Count; i++) + for (int i = 0; i < raw_lotatc.Clients.Count; i++) { - if (raw_lotatc[i].RadioInfo != null) + if (raw_lotatc.Clients[i].RadioInfo != null) { - int temp = raw_lotatc[i].RadioInfo.radios.Count - 1; + int temp = raw_lotatc.Clients[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(); + raw_lotatc.Clients[i].RadioInfo.radios[j].enc.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].encKey.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].encMode.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].freqMax.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].freqMin.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].modulation.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].freqMode.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].volMode.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].expansion.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].channel.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].simul.Parent.Remove(); - if (raw_lotatc[i].RadioInfo.radios[j].name == "No Radio") + if (raw_lotatc.Clients[i].RadioInfo.radios[j].name == "No Radio") { - raw_lotatc[i].RadioInfo.radios[j].Remove(); + raw_lotatc.Clients[i].RadioInfo.radios[j].Remove(); } } - raw_lotatc[i].ClientChannelId.Parent.Remove(); - raw_lotatc[i].RadioInfo.simultaneousTransmission.Parent.Remove(); + raw_lotatc.Clients[i].ClientChannelId.Parent.Remove(); + raw_lotatc.Clients[i].RadioInfo.simultaneousTransmission.Parent.Remove(); } } - if (raw_lotatc.Count > 0) - { - ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc); - ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtSRSJson + "'}"; - } - else - { - ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':{'ignore':'false'}}"; // No SRS clients connected - } + ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc); + ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtSRSJson + "'}"; + ExtSRSUseDefault = false; PerunHelper.AddLog(ref Globals.AppLogHistory, "SRS data loaded", 3, 0, "100", true); ExtSRSStatus = true;