diff --git a/MinecraftClient/CSharpRunner.cs b/MinecraftClient/CSharpRunner.cs index 6327a45b..58c1885a 100644 --- a/MinecraftClient/CSharpRunner.cs +++ b/MinecraftClient/CSharpRunner.cs @@ -399,7 +399,7 @@ namespace MinecraftClient { string[] lines = null; ChatBots.Script.LookForScript(ref script); - try { lines = File.ReadAllLines(script); } + try { lines = File.ReadAllLines(script, Encoding.UTF8); } catch (Exception e) { throw new CSharpException(CSErrorType.FileReadError, e); } return CSharpRunner.Run(this, tickHandler, lines, args, localVars); } diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs index 781d3d17..41e29bad 100644 --- a/MinecraftClient/ChatBot.cs +++ b/MinecraftClient/ChatBot.cs @@ -791,7 +791,7 @@ namespace MinecraftClient { //Read all lines from file, remove lines with no text, convert to lowercase, //remove duplicate entries, convert to a string array, and return the result. - return File.ReadAllLines(file) + return File.ReadAllLines(file, Encoding.UTF8) .Where(line => !String.IsNullOrWhiteSpace(line)) .Select(line => line.ToLower()) .Distinct().ToArray(); diff --git a/MinecraftClient/ChatBots/AutoRelog.cs b/MinecraftClient/ChatBots/AutoRelog.cs index d94818a3..ac788357 100644 --- a/MinecraftClient/ChatBots/AutoRelog.cs +++ b/MinecraftClient/ChatBots/AutoRelog.cs @@ -45,7 +45,7 @@ namespace MinecraftClient.ChatBots if (Settings.DebugMessages) LogToConsole("Loading messages from file: " + System.IO.Path.GetFullPath(Settings.AutoRelog_KickMessagesFile)); - dictionary = System.IO.File.ReadAllLines(Settings.AutoRelog_KickMessagesFile); + dictionary = System.IO.File.ReadAllLines(Settings.AutoRelog_KickMessagesFile, Encoding.UTF8); for (int i = 0; i < dictionary.Length; i++) { diff --git a/MinecraftClient/ChatBots/AutoRespond.cs b/MinecraftClient/ChatBots/AutoRespond.cs index 030f9a0b..abe9814d 100644 --- a/MinecraftClient/ChatBots/AutoRespond.cs +++ b/MinecraftClient/ChatBots/AutoRespond.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Collections.Generic; +using System.Text; using System.Text.RegularExpressions; namespace MinecraftClient.ChatBots @@ -143,7 +144,7 @@ namespace MinecraftClient.ChatBots if (Settings.DebugMessages) LogToConsole("Loading matches from file: " + System.IO.Path.GetFullPath(matchesFile)); - foreach (string lineRAW in File.ReadAllLines(matchesFile)) + foreach (string lineRAW in File.ReadAllLines(matchesFile, Encoding.UTF8)) { string line = lineRAW.Split('#')[0].Trim(); if (line.Length > 0) diff --git a/MinecraftClient/ChatBots/HangmanGame.cs b/MinecraftClient/ChatBots/HangmanGame.cs index 0ea3c2ea..49ec5ea1 100644 --- a/MinecraftClient/ChatBots/HangmanGame.cs +++ b/MinecraftClient/ChatBots/HangmanGame.cs @@ -143,7 +143,7 @@ namespace MinecraftClient.ChatBots { if (System.IO.File.Exists(English ? Settings.Hangman_FileWords_EN : Settings.Hangman_FileWords_FR)) { - string[] dico = System.IO.File.ReadAllLines(English ? Settings.Hangman_FileWords_EN : Settings.Hangman_FileWords_FR); + string[] dico = System.IO.File.ReadAllLines(English ? Settings.Hangman_FileWords_EN : Settings.Hangman_FileWords_FR, Encoding.UTF8); return dico[new Random().Next(dico.Length)]; } else diff --git a/MinecraftClient/ChatBots/Script.cs b/MinecraftClient/ChatBots/Script.cs index 62e97940..89eb92a4 100644 --- a/MinecraftClient/ChatBots/Script.cs +++ b/MinecraftClient/ChatBots/Script.cs @@ -132,7 +132,7 @@ namespace MinecraftClient.ChatBots //Load the given file from the startup parameters if (LookForScript(ref file)) { - lines = System.IO.File.ReadAllLines(file); + lines = System.IO.File.ReadAllLines(file, Encoding.UTF8); csharp = file.EndsWith(".cs"); thread = null; diff --git a/MinecraftClient/ChatBots/ScriptScheduler.cs b/MinecraftClient/ChatBots/ScriptScheduler.cs index daf43d72..f418570d 100644 --- a/MinecraftClient/ChatBots/ScriptScheduler.cs +++ b/MinecraftClient/ChatBots/ScriptScheduler.cs @@ -47,7 +47,7 @@ namespace MinecraftClient.ChatBots if (Settings.DebugMessages) LogToConsole("Loading tasks from '" + System.IO.Path.GetFullPath(tasksfile) + "'"); TaskDesc current_task = null; - String[] lines = System.IO.File.ReadAllLines(tasksfile); + String[] lines = System.IO.File.ReadAllLines(tasksfile, Encoding.UTF8); foreach (string lineRAW in lines) { string line = lineRAW.Split('#')[0].Trim(); diff --git a/MinecraftClient/Mapping/BlockPalettes/BlockPaletteGenerator.cs b/MinecraftClient/Mapping/BlockPalettes/BlockPaletteGenerator.cs index 52e8b28f..ff267572 100644 --- a/MinecraftClient/Mapping/BlockPalettes/BlockPaletteGenerator.cs +++ b/MinecraftClient/Mapping/BlockPalettes/BlockPaletteGenerator.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.IO; +using System.Text; namespace MinecraftClient.Mapping.BlockPalettes { @@ -11,7 +12,7 @@ namespace MinecraftClient.Mapping.BlockPalettes public static class BlockPaletteGenerator { /// - /// Generate mapping from Minecraft blocks.jsom + /// Generate mapping from Minecraft blocks.json /// /// path to blocks.json /// output path for blocks.cs @@ -23,7 +24,7 @@ namespace MinecraftClient.Mapping.BlockPalettes HashSet knownStates = new HashSet(); Dictionary> blocks = new Dictionary>(); - Json.JSONData palette = Json.ParseJson(File.ReadAllText(blocksJsonFile)); + Json.JSONData palette = Json.ParseJson(File.ReadAllText(blocksJsonFile, Encoding.UTF8)); foreach (KeyValuePair item in palette.Properties) { //minecraft:item_name => ItemName diff --git a/MinecraftClient/McTcpClient.cs b/MinecraftClient/McTcpClient.cs index ded49bd8..44086df7 100644 --- a/MinecraftClient/McTcpClient.cs +++ b/MinecraftClient/McTcpClient.cs @@ -1633,7 +1633,7 @@ namespace MinecraftClient public void OnExplosion(Location location, float strength, int affectedBlocks) { foreach (ChatBot bot in bots.ToArray()) - bot.OnExplosion(explode, strength, ExplosionRecordCount); + bot.OnExplosion(location, strength, affectedBlocks); } ///