public override void ModSettingsLoaded() { IniPtr ini = new IniPtr(Path.GetFullPath("doorstop_config.ini")); string skipIntro = ini.ReadValue("MSCLoader", "skipIntro"); bool introSkip; if (!bool.TryParse(skipIntro, out introSkip)) { skipGameIntro.Value = false; ModConsole.Error(string.Format("Excepted boolean, received '{0}'.", skipIntro ?? "<null>")); } else { skipGameIntro.Value = introSkip; } ModSettingsToggle(); ExpUIScaling(); if ((bool)checkLaunch.GetValue()) { cfmu_set = 0; } if ((bool)checkDaily.GetValue()) { cfmu_set = 1; } if ((bool)checkWeekly.GetValue()) { cfmu_set = 7; } }
static void InjectModLoader() { try { if (File.Exists("ModLoaderSettings.json")) { File.Delete("ModLoaderSettings.json"); } IniPtr ini = new IniPtr(Path.GetFullPath("doorstop_config.ini")); cfg = ini.ReadValue("MSCLoader", "mods"); string skipIntro = ini.ReadValue("MSCLoader", "skipIntro"); if (!bool.TryParse(skipIntro, out introSkip)) { introSkip = false; Console.WriteLine($"[FAIL] Parse failed, readed value: {skipIntro}"); } HarmonyInstance.Create(nameof(MSCLoader)).PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception ex) { //Generate early crash file (before output_log can happen) using (TextWriter tw = File.CreateText("MSCLOADER_CRASH.txt")) { tw.WriteLine(ex.ToString()); tw.WriteLine(ex.Message); tw.Flush(); } } }
private static void SkipIntroSet() { IniPtr ini = new IniPtr(Path.GetFullPath("doorstop_config.ini")); ini.WriteValue("MSCLoader", "skipIntro", ((bool)skipGameIntro.GetValue()).ToString().ToLower()); }