diff --git a/AquaMai/AquaMai.Build/GenerateExampleConfig.cs b/AquaMai/AquaMai.Build/GenerateExampleConfig.cs index 4e7b0028..286a5e97 100644 --- a/AquaMai/AquaMai.Build/GenerateExampleConfig.cs +++ b/AquaMai/AquaMai.Build/GenerateExampleConfig.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Text; using AquaMai.Config.Interfaces; using AquaMai.Config.HeadlessLoader; using Microsoft.Build.Framework; @@ -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; diff --git a/AquaMai/AquaMai.Core/ConfigLoader.cs b/AquaMai/AquaMai.Core/ConfigLoader.cs index 92a9eaa1..7c9ecab0 100644 --- a/AquaMai/AquaMai.Core/ConfigLoader.cs +++ b/AquaMai/AquaMai.Core/ConfigLoader.cs @@ -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; @@ -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."); @@ -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); } @@ -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) =>