public void Reset() { Language = LangSystem.Language.EN; Keybind_Add = ConsoleKey.F1; Keybind_Edit = ConsoleKey.F2; Keybind_Delete = ConsoleKey.F3; Keybind_GetPassword = ConsoleKey.Enter; Keybind_Save = ConsoleKey.S; Keybind_Exit = ConsoleKey.X; Keybind_Up = ConsoleKey.UpArrow; Keybind_Down = ConsoleKey.DownArrow; Keybind_Reset = ConsoleKey.F12; Keybind_Help = ConsoleKey.H; Filename = "passwords"; ShowPasswordInput = false; RandomCharSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; }
public void Load() { string[] rawLines = File.ReadAllLines("config.cfg"); for (int i = 0; i < rawLines.Length; i++) { string[] thisLine = rawLines[i].Split(":", StringSplitOptions.RemoveEmptyEntries); if (thisLine[0] == "Language") { if (thisLine[1].ToLower() == "de") { Language = LangSystem.Language.DE; } else if (thisLine[1].ToLower() == "en") { Language = LangSystem.Language.EN; } } else if (thisLine[0] == "Key_Add") { Keybind_Add = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Save") { Keybind_Save = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Delete") { Keybind_Delete = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Edit") { Keybind_Edit = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_GetPassword") { Keybind_GetPassword = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Exit") { Keybind_Exit = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Up") { Keybind_Up = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Down") { Keybind_Down = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Reset") { Keybind_Reset = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "Key_Help") { Keybind_Help = (ConsoleKey)Convert.ToByte(thisLine[1]); } else if (thisLine[0] == "ShowPasswordInput") { ShowPasswordInput = Convert.ToBoolean(thisLine[1]); } else if (thisLine[0] == "Filename") { Filename = thisLine[1]; } else if (thisLine[0] == "RandomCharset") { RandomCharSet = thisLine[1]; } } }