From 397c405d32ff0673688e16a40e80e1d566350485 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 16 Jan 2015 17:11:51 -0600 Subject: [PATCH 1/2] Fixed string handling for client --- pc/CODEC2 GUI/CODEC2 GUI/Form1.cs | 43 ++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/pc/CODEC2 GUI/CODEC2 GUI/Form1.cs b/pc/CODEC2 GUI/CODEC2 GUI/Form1.cs index 9baa74e..541d371 100644 --- a/pc/CODEC2 GUI/CODEC2 GUI/Form1.cs +++ b/pc/CODEC2 GUI/CODEC2 GUI/Form1.cs @@ -289,25 +289,38 @@ namespace CODEC2_GUI void slc_WaveformStatusReceived(Slice slc, string status) { - string[] words = status.Split(' '); - - foreach (string kv in words) + if(status.StartsWith("string")) { - string[] tokens = kv.Split('='); - if (tokens.Length != 2) + Debug.WriteLine(status); + string x = "ASDLKFJASLDKJ"; + + int start_pos = status.IndexOf("\""); + // did we find beginning quotes? + if(start_pos < 0) return; // no -- return + + /*int end_pos = status.LastIndexOf("\""); + // did we find ending quotes? + if(end_pos == start_pos) return; // no -- return + */ + start_pos += 1; // ignore beginning quotes + string value = status.Substring(start_pos); + + Control c = FindControlByName(this, "txtIn" + slc.Index); + if (c == null) return; + + TextBox txtbox = c as TextBox; + if (txtbox == null) return; + + if (InvokeRequired) { - Debug.WriteLine("slc_WaveformStatusReceived: Invalid key/value pair (" + kv + ")"); - continue; + Invoke(new MethodInvoker(delegate + { + txtbox.Text = value; + })); } - - string key = tokens[0]; - string value = tokens[1]; - - switch (key) + else { - case "string": - // TODO: update the string - break; + txtbox.Text = value; } } } From e6866791974d2496a9db17c8dd35ec768cd1c434 Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 22 Jan 2015 13:28:11 -0600 Subject: [PATCH 2/2] Fixed GUI not building in Release mode --- pc/CODEC2 GUI/CODEC2 GUI.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/pc/CODEC2 GUI/CODEC2 GUI.sln b/pc/CODEC2 GUI/CODEC2 GUI.sln index 95ccb6e..2272084 100644 --- a/pc/CODEC2 GUI/CODEC2 GUI.sln +++ b/pc/CODEC2 GUI/CODEC2 GUI.sln @@ -24,6 +24,7 @@ Global {19634B34-7569-4D1D-8182-B10AC27E13FF}.Debug|x86.ActiveCfg = Debug|x86 {19634B34-7569-4D1D-8182-B10AC27E13FF}.Debug|x86.Build.0 = Debug|x86 {19634B34-7569-4D1D-8182-B10AC27E13FF}.Release|Any CPU.ActiveCfg = Release|x86 + {19634B34-7569-4D1D-8182-B10AC27E13FF}.Release|Any CPU.Build.0 = Release|x86 {19634B34-7569-4D1D-8182-B10AC27E13FF}.Release|x86.ActiveCfg = Release|x86 {19634B34-7569-4D1D-8182-B10AC27E13FF}.Release|x86.Build.0 = Release|x86 {7927817C-D5EF-4A9E-B38E-29668F308343}.Debug|Any CPU.ActiveCfg = Debug|Any CPU