From a9bc99a174d3b9737b8f91e7434b6e9273eb0267 Mon Sep 17 00:00:00 2001 From: VladMordock Date: Wed, 17 Feb 2021 01:33:27 +0100 Subject: [PATCH] Fix: dirty solution for non-alphanumeric symbols in SRS usernames #54 --- 02_Windows_App/Perun_v1/02_Forms/form_Main.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 64cbe1e..7232ca6 100644 --- a/02_Windows_App/Perun_v1/02_Forms/form_Main.cs +++ b/02_Windows_App/Perun_v1/02_Forms/form_Main.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; using System.Drawing; +using System.Text.RegularExpressions; using System.Threading; using System.Windows.Forms; @@ -534,6 +535,7 @@ namespace Perun_v1 // Take care of 3rd party stuff string ExtSRSJson = ""; string ExtLotATCJson = ""; + string ClientName = ""; bool ExtSRSUseDefault = true; bool ExtLotATCUseDefault = true; @@ -564,9 +566,17 @@ namespace Perun_v1 } } } + if (raw_lotatc.Clients[i].Name != null) + { + ClientName = raw_lotatc.Clients[i].Name; + Regex rgx = new Regex("[^a-zA-Z0-9 -]"); + ClientName = rgx.Replace(ClientName, ""); + + raw_lotatc.Clients[i].Name = ClientName; + } } - ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc); + ExtSRSJson = JsonConvert.SerializeObject(raw_lotatc); ExtSRSJson = "{'type':'100','instance':'" + Int32.Parse(con_txt_dcs_instance.Text) + "','payload':'" + ExtSRSJson + "'}"; ExtSRSUseDefault = false;