diff --git a/KaddaOK.AvaloniaApp.Windows/Program.cs b/KaddaOK.AvaloniaApp.Windows/Program.cs index eb23dfe..89810e8 100644 --- a/KaddaOK.AvaloniaApp.Windows/Program.cs +++ b/KaddaOK.AvaloniaApp.Windows/Program.cs @@ -1,6 +1,8 @@ using System; using System.Drawing; +using System.Globalization; using System.Text; +using System.Threading; using System.Windows.Forms; using Avalonia; using Avalonia.Svg.Skia; @@ -15,6 +17,10 @@ class Program [STAThread] public static void Main(string[] args) { + CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); + culture.NumberFormat.NumberDecimalSeparator = "."; //Force use . for regions that use , + Thread.CurrentThread.CurrentCulture = culture; + try { BuildAvaloniaApp() diff --git a/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs b/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs index 1f462ad..95d48c7 100644 --- a/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs +++ b/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs @@ -150,7 +150,10 @@ protected async Task ExportToRzlrc() if (file != null) { await using var stream = await file.OpenWriteAsync(); - using var streamWriter = new StreamWriter(stream) + // UTF-16 LE BOM + Encoding encoding = new UnicodeEncoding(false, true); + + using var streamWriter = new StreamWriter(stream, encoding) { AutoFlush = true }; @@ -196,7 +199,9 @@ protected async Task ExportToRzlrc() } var projectContents = RzProjectSerializer.Serialize(generatedProject); - File.WriteAllText(projectPath, projectContents); + using var writer = new StreamWriter(projectPath, false, encoding); + await writer.WriteAsync(projectContents); + pathToLaunch = projectPath; }