Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ytmm export updates #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions KaddaOK.AvaloniaApp.Windows/Program.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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()
Expand Down
11 changes: 9 additions & 2 deletions KaddaOK.AvaloniaApp/ViewModels/ExportViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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;
}

Expand Down
Loading