Skip to content

Commit

Permalink
Try fix line
Browse files Browse the repository at this point in the history
  • Loading branch information
Menci committed Nov 24, 2024
1 parent 7a0fb57 commit 3d7bb84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion AquaMai/AquaMai.Build/GenerateExampleConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Text;
using AquaMai.Config.Interfaces;
using AquaMai.Config.HeadlessLoader;
using Microsoft.Build.Framework;
Expand Down Expand Up @@ -28,7 +29,7 @@ public override bool Execute()
OverrideLocaleValue = true
});
var example = configSerializer.Serialize(config);
File.WriteAllText(Path.Combine(OutputPath, $"AquaMai.{lang}.toml"), example);
File.WriteAllBytes(Path.Combine(OutputPath, $"AquaMai.{lang}.toml"), Encoding.UTF8.GetBytes(example));
}

return true;
Expand Down
7 changes: 4 additions & 3 deletions AquaMai/AquaMai.Core/ConfigLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using MelonLoader;
using AquaMai.Config;
using AquaMai.Config.Interfaces;
Expand Down Expand Up @@ -32,7 +33,7 @@ public static bool LoadConfig(Assembly modsAssembly)
foreach (var (lang, example) in examples)
{
var filename = ConfigExampleFile(lang);
File.WriteAllText(filename, example);
File.WriteAllBytes(filename, Encoding.UTF8.GetBytes(example));
}
MelonLogger.Error("======================================!!!");
MelonLogger.Error("AquaMai.toml not found! Please create it.");
Expand All @@ -48,7 +49,7 @@ public static bool LoadConfig(Assembly modsAssembly)
var configVersion = ConfigMigrationManager.Instance.GetVersion(configView);
if (configVersion != ConfigMigrationManager.Instance.latestVersion)
{
File.WriteAllText(OldConfigFile(configVersion), configText);
File.WriteAllBytes(OldConfigFile(configVersion), Encoding.UTF8.GetBytes(configText));
configView = (ConfigView)ConfigMigrationManager.Instance.Migrate(configView);
}

Expand All @@ -60,7 +61,7 @@ public static bool LoadConfig(Assembly modsAssembly)

public static void SaveConfig(string lang)
{
File.WriteAllText(ConfigFile, SerailizeCurrentConfig(lang));
File.WriteAllBytes(ConfigFile, Encoding.UTF8.GetBytes(SerailizeCurrentConfig(lang)));
}

private static string SerailizeCurrentConfig(string lang) =>
Expand Down

0 comments on commit 3d7bb84

Please sign in to comment.