/// <summary> /// Returns true, if the time saved into the file with added FileThresholdHours is larger than the current time. /// </summary> bool IsUpdateTime() { if (MopSettings.RuleFilesUpdateChecked) { return(false); } MopSettings.RuleFilesUpdateChecked = true; if (DateTime.TryParse(File.ReadAllText(lastDateFilePath), out DateTime past)) { int fileThresholdsHours = MopSettings.GetRuleFilesUpdateDaysFrequency() * 24; past = past.AddHours(fileThresholdsHours); return(DateTime.Now > past); } return(true); }
/// <summary> /// Generates the report about mod's settings and list of installed mods /// </summary> /// <returns></returns> static string GetGameInfo() { string output = $"Modern Optimization Plugin\nVersion: {MOP.ModVersion}{(MOP.ModVersion.EndsWith(".0") ? " Development" : "")}\n"; output += $"MSC Mod Loader Version: {ModLoader.MSCLoader_Ver}\n"; output += $"Date and Time: {DateTime.Now:yyyy-MM-ddTHH:mm:ssZ}\n"; output += $"{GetSystemInfo()} \n\n"; output += "=== MOP SETTINGS ===\n\n"; output += $"ActiveDistance: {MopSettings.ActiveDistance}\n"; output += $"ActiveDistanceMultiplicationValue: {MopSettings.ActiveDistanceMultiplicationValue}\n"; output += $"SafeMode: {MopSettings.SafeMode}\n"; output += $"RemoveEmptyBeerBottles: {MopSettings.RemoveEmptyBeerBottles}\n"; output += $"ToggleVehiclePhysicsOnly: {Rules.instance.SpecialRules.ToggleAllVehiclesPhysicsOnly}\n"; output += $"IgnoreModVehicles: {Rules.instance.SpecialRules.IgnoreModVehicles}\n"; output += $"EnableFramerateLimiter: {(bool)MOP.EnableFramerateLimiter.GetValue()}\n"; output += $"FramerateLimiter: {MOP.FramerateLimiter.GetValue()}\n"; output += $"EnableShadowAdjusting: {(bool)MOP.EnableShadowAdjusting.GetValue()}\n"; output += $"KeepRunningInBackground: {(bool)MOP.KeepRunningInBackground.GetValue()}\n"; output += $"DynamicDrawDistance: {(bool)MOP.DynamicDrawDistance.GetValue()}\n"; output += $"ShadowDistance: {MOP.ShadowDistance.GetValue()}\n"; output += $"RulesAutoUpdate: {MOP.RulesAutoUpdate.GetValue()}\n"; output += $"RulesAutoUpdateFrequency: {MopSettings.GetRuleFilesUpdateDaysFrequency()}\n"; output += $"CustomRuleFile: {File.Exists($"{MOP.ModConfigPath}/Custom.txt")}\n\n"; // Steam stuff. output += $"CheckSteam: {ModLoader.CheckSteam()} \n"; output += $"ExperimentalBranch: {ModLoader.CheckIfExperimental()}\n"; // List installed mods. output += "\n=== MODS ===\n\n"; foreach (var mod in ModLoader.LoadedMods) { // Ignore MSCLoader or MOP. if (mod.ID.EqualsAny("MSCLoader_Console", "MSCLoader_Settings", "MOP")) { continue; } output += $"{mod.Name}:\n ID: {mod.ID}\n Version: {mod.Version}\n Author: {mod.Author}\n\n"; } // If only 3 mods have been found, that means the only mods active are MOP and two ModLoader modules. if (ModLoader.LoadedMods.Count <= 3) { output += "No other mods found!\n\n"; } // List rule files. output += "=== RULE FILES ===\n\n"; foreach (string ruleFile in Rules.instance.RuleFileNames) { output += $"{ruleFile}\n"; } if (Rules.instance.RuleFileNames.Count == 0) { output += $"No rule files loaded!\n"; } if (File.Exists($"{MOP.ModConfigPath}/Custom.txt")) { output += "\n=== CUSTOM.TXT CONTENT ===\n\n"; output += File.ReadAllText($"{MOP.ModConfigPath}/Custom.txt") + "\n\n"; } return(output); }