private static string NewSettingsFilePath(string source, Regex mask, string targetIdentifier) { var match = mask.Match(source); return(Path.Combine(GenFilePaths.ConfigFolderPath, GenText.SanitizeFilename($"Mod_{targetIdentifier}_{match.Groups[1].Value}.xml"))); }
private static void Prefix(string modIdentifier, string modHandleName, ref string __result) { if (modHandleName.Contains("Controller_ModdedFactions")) { modHandleName = "Controller_ModdedFactions"; } __result = Path.Combine(GenFilePaths.ConfigFolderPath, GenText.SanitizeFilename(string.Format("Mod_{0}_{1}.xml", modIdentifier, modHandleName))); }
public PRMod(ModContentPack content) : base(content) { settings = GetSettings <PRModSettings>(); var modConfigFile = $"Mod_{Content.FolderName}_{GetType().Name}.xml"; if (File.Exists(Path.Combine(GenFilePaths.ConfigFolderPath, GenText.SanitizeFilename(modConfigFile)))) { PRModSettings.DoMigrations = false; } }
public static void DefsLoaded() { // Log.Warning("LWM.deepstorag - defs loaded"); // Todo? If settings are different from defaults, then: // Def-related changes: //TODO: this should probably have an option.... if (defaultStoragePriority != StoragePriority.Important) { foreach (ThingDef d in AllDeepStorageUnits) { d.building.defaultStorageSettings.Priority = defaultStoragePriority; } } // Re-read Mod Settings - some won't have been read because Defs weren't loaded: // (do this after priority changes above to allow user to override changes) //todo: Utils.Mess(Utils.DBF.Settings, "Defs Loaded. About to re-load settings"); // NOTE/WARNING: the mod's settings' FolderName will be different for non-steam and steam versions. // Internally, they are loaded using: // this.modSettings = LoadedModManager // .ReadModSettings<T>(this.intContent.FolderName, base.GetType().Name); // So don't do this: // var s = LoadedModManager.ReadModSettings<Settings>("LWM.DeepStorage", "DeepStorageMod"); // Do this instead: var mod = LoadedModManager.GetMod(typeof(LWM.DeepStorage.DeepStorageMod)); Utils.Warn(Utils.DBF.Settings, "About to re-read mod settings from: " + GenText .SanitizeFilename(string.Format("Mod_{0}_{1}.xml", mod.Content.FolderName, "DeepStorageMod"))); var s = LoadedModManager.ReadModSettings <Settings>(mod.Content.FolderName, "DeepStorageMod"); // Architect Menu: if (architectMenuActualDef == null) { architectMenuActualDef = DefDatabase <DesignationCategoryDef> .GetNamed(architectMenuDefaultDesigCatDef); } if (architectMenuDesigCatDef != architectMenuDefaultDesigCatDef || architectMenuMoveALLStorageItems) // in which case, we need to redo menu anyway { ArchitectMenu_ChangeLocation(architectMenuDesigCatDef, true); } }
private static Regex SettingsMask(string identifier) { return(new Regex($@"Mod_{GenText.SanitizeFilename( identifier )}_(.*)\.xml")); }