Added Settings class & Settings file

- All settings are moved in a new Settings class
- Settings can be loaded by parsing an INI file
- A default INI file is generated with default settings
- By default, loads MinecraftClient.ini if no command-line arguments are
used
- Another INI file can be loaded with MinecraftClient.exe MyFile.ini
- All the config files can be renamed or moved, just edit the INI file
- A title for the console window can be specified in the INI file
- Regular command-line arguments still works but will probably be
simplified in the future.
- Smal code optimizations and adjustments
This commit is contained in:
ORelio 2013-08-06 16:11:46 +02:00
parent 88105d30ad
commit df4a9cd7b7
6 changed files with 373 additions and 142 deletions

View file

@ -96,9 +96,9 @@ namespace MinecraftClient
TranslationRules["commands.message.display.outgoing"] = "§7You whisper to %s: %s";
//Load an external dictionnary of translation rules
if (System.IO.File.Exists("translations.lang"))
if (System.IO.File.Exists(Settings.TranslationsFile))
{
string[] translations = System.IO.File.ReadAllLines("translations.lang");
string[] translations = System.IO.File.ReadAllLines(Settings.TranslationsFile);
foreach (string line in translations)
{
if (line.Length > 0)
@ -118,9 +118,9 @@ namespace MinecraftClient
else //No external dictionnary found.
{
Console.ForegroundColor = ConsoleColor.DarkGray;
ConsoleIO.WriteLine("MC 1.6+ warning: Translations file \"translations.lang\" not found."
ConsoleIO.WriteLine("MC 1.6+ warning: Translations file \"" + Settings.TranslationsFile + "\" not found."
+ "\nYou can pick a translation file from .minecraft\\assets\\lang\\"
+ "\nCopy to the same folder as MinecraftClient & rename to \"translations.lang\""
+ "\nCopy to the same folder as MinecraftClient & rename to \"" + Settings.TranslationsFile + "\""
+ "\nSome messages won't be properly printed without this file.");
Console.ForegroundColor = ConsoleColor.Gray;
}