44using System . IO ;
55using System . Threading ;
66using System . Linq ;
7+ using System . Globalization ;
78
89namespace AwokeKnowing . GnuplotCSharp
910{
@@ -374,15 +375,15 @@ public static void SPlot(List<StoredPlot> storedPlots)
374375 public static void WriteData ( double [ ] y , StreamWriter stream , bool flush = true )
375376 {
376377 for ( int i = 0 ; i < y . Length ; i ++ )
377- stream . WriteLine ( y [ i ] . ToString ( ) ) ;
378+ stream . WriteLine ( y [ i ] . ToString ( CultureInfo . InvariantCulture ) ) ;
378379
379380 if ( flush ) stream . Flush ( ) ;
380381 }
381382
382383 public static void WriteData ( double [ ] x , double [ ] y , StreamWriter stream , bool flush = true )
383384 {
384385 for ( int i = 0 ; i < y . Length ; i ++ )
385- stream . WriteLine ( x [ i ] . ToString ( ) + " " + y [ i ] . ToString ( ) ) ;
386+ stream . WriteLine ( x [ i ] . ToString ( CultureInfo . InvariantCulture ) + " " + y [ i ] . ToString ( CultureInfo . InvariantCulture ) ) ;
386387
387388 if ( flush ) stream . Flush ( ) ;
388389 }
@@ -393,7 +394,7 @@ public static void WriteData(int ySize, double[] z, StreamWriter stream, bool fl
393394 {
394395 if ( i > 0 && i % ySize == 0 )
395396 stream . WriteLine ( ) ;
396- stream . WriteLine ( z [ i ] . ToString ( ) ) ;
397+ stream . WriteLine ( z [ i ] . ToString ( CultureInfo . InvariantCulture ) ) ;
397398 }
398399
399400 if ( flush ) stream . Flush ( ) ;
@@ -408,7 +409,7 @@ public static void WriteData(double[,] zz, StreamWriter stream, bool flush = tru
408409 {
409410 line = "" ;
410411 for ( int j = 0 ; j < n ; j ++ )
411- line += zz [ i , j ] . ToString ( ) + " " ;
412+ line += zz [ i , j ] . ToString ( CultureInfo . InvariantCulture ) + " " ;
412413 stream . WriteLine ( line . TrimEnd ( ) ) ;
413414 }
414415
@@ -423,7 +424,8 @@ public static void WriteData(double[] x, double[] y, double[] z, StreamWriter st
423424 {
424425 if ( i > 0 && x [ i ] != x [ i - 1 ] )
425426 stream . WriteLine ( "" ) ;
426- stream . WriteLine ( x [ i ] + " " + y [ i ] + " " + z [ i ] ) ;
427+
428+ stream . WriteLine ( string . Format ( CultureInfo . InvariantCulture , "{0} {1} {2}" , x [ i ] , y [ i ] , z [ i ] ) ) ;
427429 }
428430
429431 if ( flush ) stream . Flush ( ) ;
0 commit comments