private void logStatus() { txtStatus.Text = ""; string desktopT = (DesktopThemePath == null) ? "Aero" : DesktopThemeName; string gameT = (GameThemePath == null) ? "High Contrast White" : GameThemeName; //Note(Eli): Magic numbers for CreateWhiteSpace make these values line up in a monospaced font. log( "Version:" + HelperFunc.CreateWhiteSpace(7) + VERSION_NUM, "Is Enabled:" + HelperFunc.CreateWhiteSpace(4) + IsEnabled, "Boot on start:" + HelperFunc.CreateWhiteSpace(1) + BootOnStart, "", "Desktop theme:" + HelperFunc.CreateWhiteSpace(1) + desktopT, "In-game theme:" + HelperFunc.CreateWhiteSpace(1) + gameT, "\n" ); log("Hotkeys<Key, Theme>:" + HelperFunc.CreateWhiteSpace(4) + "{"); if (HotKeys != null) { foreach (KeyValuePair <HotKey, ThemePathContainer> entry in HotKeys) { log(HelperFunc.CreateWhiteSpace(4) + "[" + entry.Key.ToString() + ", " + entry.Value.ToString() + "]"); } } log("}"); log( "", "Clean Logs:" + HelperFunc.CreateWhiteSpace(8) + USettings.GetOptions().Contains(Options.CLEAN_LOGS), "Clean Old Logs:" + HelperFunc.CreateWhiteSpace(4) + USettings.GetOptions().Contains(Options.CLEAN_LOGS_ONLY_BEFORE_TODAY), "Clean Fatal Logs:" + HelperFunc.CreateWhiteSpace(2) + USettings.GetOptions().Contains(Options.CLEAN_FATAL_LOGS) ); }
private void WriteConfig() { string programExePathFolder = GetExeDirectory(); StreamWriter sw = new StreamWriter(programExePathFolder + Constants.APP_CONFIG_LOCATION); try { sw.WriteLine("//Note to those reading:\n//Modifying this file could result in the breaking of your config.\n"); sw.WriteLine(nameof(IsEnabled) + HelperFunc.CreateWhiteSpace(1) + "\"" + IsEnabled.ToString() + "\""); foreach (Options o in USettings.GetOptions()) { sw.WriteLine(o.ToString() + HelperFunc.CreateWhiteSpace(1) + "\"True\""); } if (DesktopThemePath != null) { sw.WriteLine(nameof(DesktopThemePath) + HelperFunc.CreateWhiteSpace(1) + "\"" + DesktopThemePath + "\""); } if (GameThemePath != null) { sw.WriteLine(nameof(GameThemePath) + HelperFunc.CreateWhiteSpace(1) + "\"" + GameThemePath + "\""); } if (HotKeys != null) { foreach (KeyValuePair <HotKey, ThemePathContainer> entry in HotKeys) { sw.Write("Hotkey{ "); sw.Write(entry.Key.id + " " + entry.Key.keyModifier + " " + entry.Key.key); sw.Write(" " + entry.Value.ToAbsoluteString()); sw.Write(" }\n"); } } } catch (Exception e) { if (e is IOException) { FileLogger.Log("Could not read CFG file: " + e.Message, LogOptions.DISPLAY_ERROR); } else { FileLogger.Log("Unknown exception caught while reading config file: " + e.Message, LogOptions.SHOULD_THROW); } } finally { sw.Close(); } }