diff --git a/KaddaOK.AvaloniaApp.Windows/Program.cs b/KaddaOK.AvaloniaApp.Windows/Program.cs index eb23dfe..afe5664 100644 --- a/KaddaOK.AvaloniaApp.Windows/Program.cs +++ b/KaddaOK.AvaloniaApp.Windows/Program.cs @@ -1,9 +1,8 @@ -using System; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using Avalonia; +using Avalonia; using Avalonia.Svg.Skia; +using System; +using System.Globalization; +using System.Threading; namespace KaddaOK.AvaloniaApp.Windows; @@ -15,6 +14,11 @@ 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..cc523f2 100644 --- a/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs +++ b/KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs @@ -150,7 +150,11 @@ 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 +200,10 @@ 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; }