Open codinkai opened 6 years ago
Sorry for the trouble! Looks like a bug in the Logic software and in the C# socket library - it doesn't handle your locale properly. You have comma characters where our application expects periods.
A quick workaround might be to add this to the top of the static void Main( string[] args )
function:
var usCulture = new System.Globalization.CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = usCulture;
Thread.CurrentThread.CurrentUICulture = usCulture;
I think that should do it for now.
This might be a better solution:
System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
I need to look into best practices for handling this kind of problem with public APIs.
Let me know if you still have trouble with it.
Thanks! This working solution!
But may not be necessary to force everyone to change culture:
--- a/SaleaeSocketApi/SocketApi.cs +++ b/SaleaeSocketApi/SocketApi.cs @@ -131,9 +131,9 @@ namespace Saleae.SocketApi command.Add( channel.GetDescription() ); if( channel == Trigger.PositivePulse || channel == Trigger.NegativePulse ) {
command.Add( maximum_pulse_width_s.ToString(System.Globalization.CultureInfo.InvariantCulture) ); }
}
@@ -179,7 +179,7 @@ namespace Saleae.SocketApi public void SetCaptureSeconds( double seconds ) { String export_command = set_capture_seconds_cmd + ", ";
export_command += seconds.ToString(System.Globalization.CultureInfo.InvariantCulture); WriteString( export_command );
String response = "";
@@ -1016,8 +1016,8 @@ namespace Saleae.SocketApi
return new ViewState
{
Hi everybody,
in my setup: Windows 10 with Visual Studio Community, Salae Logic 8, Salae Logic 1.2.18. The commands for setting trigger, settting capture time and setting ViewState respond with NAK. This leads to socket api exceptions. In SocketAPI.cs in Line 91 "throw new SaleaeSocketApiException();".
These are the outputs from the console, when I comment out Line 91.
What could be the problem here? Thanks in advance