internal static void Load() { SRRandomizer.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); SRRandomizer.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. cfg.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod/library names that this mod requires to function. Format: SomeMod:1.50,SomeLibrary:0.60 cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.53.0")); cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //This will prevent the mod from being loaded after the next major UMF release cfg.Write("UpdateURL", new UMFConfigString("")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); SRRandomizer.Log("Finished UMF Settings."); //keybind to bring up menu? SRRandomizer.Log("Finished loading settings."); } } catch (Exception e) { SRRandomizer.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")"); } }
//Add your config vars here. internal void Load() { SRAirNetUpgrade.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); SRAirNetUpgrade.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.52")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //Uncomment if you think your mod may break with the next major UMF release. cfg.Write("UpdateURL", new UMFConfigString("")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); SRAirNetUpgrade.Log("Finished UMF Settings."); //Add your settings here SRAirNetUpgrade.Log("Finished loading settings."); } } catch (Exception e) { SRAirNetUpgrade.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")"); } }
//Add your config vars here. internal static void Load() { CENoIntroVideoMod.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); CENoIntroVideoMod.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. //cfg.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod names that this mod requires to function. //cfg.Write("ModDependenciesVersions", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod versions matching the ModDependencies setting. cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.52.1")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //Uncomment if you think your mod may break with the next major UMF release. cfg.Write("UpdateURL", new UMFConfigString("")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); CENoIntroVideoMod.Log("Finished UMF Settings."); //Add your settings here CENoIntroVideoMod.Log("Finished loading settings."); } } catch (Exception e) { CENoIntroVideoMod.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")"); } }
internal void Load() { SRCubeSlimeMod.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(); SRCubeSlimeMod.Log("The config file was outdated and has been deleted. A new config will be generated."); } cfg.Write("SupportsHotLoading", new UMFConfigBool(false));//Due to where the mod overwrites Slime meshes/icons it does not support hot loading. cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.52")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); cfg.Write("UpdateURL", new UMFConfigString("https://umodframework.com/updatemod?id=8")); //cfg.Write("UpdateURL", new UMFConfigString(@"https://raw.githubusercontent.com/EmeraldPlay27/SRCubeSlimeMod/master/version.txt")); //cfg.Write("UpdateURL", new UMFConfigString(@"https://umodframework.com/new/updatemod?id=")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); SRCubeSlimeMod.Log("Finished UMF Settings."); AutoSetLOD = cfg.Read("AutoSetLOD", new UMFConfigBool(true, null, true), "Automatically sets the internal LOD setting so that Cube Slimes are always visible at all Model Quality settings."); SRCubeSlimeMod.Log("Finished loading settings."); } } catch (Exception e) { SRCubeSlimeMod.Log("Error loading mod settings: " + e.Message + " (" + e.InnerException.Message + ")"); } }
public void Load() { SRCheatMenu.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(); SRCheatMenu.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.53.0")); cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //cfg.Write("UpdateURL", new UMFConfigString(@"https://raw.githubusercontent.com/UMFDev/SRCheatMenu/master/version.txt")); cfg.Write("UpdateURL", new UMFConfigString(@"https://umodframework.com/updatemod?id=2")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); SRCheatMenu.Log("Finished UMF Settings."); GetAllItems = cfg.Read("GetAllItems", new UMFConfigBool(false, null, true), "If enabled will let you add all items from the game, rather than just the items normally available. USE AT YOUR OWN RISK!"); IncDecTimeDefault = cfg.Read("IncDecTimeDefault", new UMFConfigDouble(60d, 1d, 1440d, 0), "The default value used for increasing and decreasing time in minutes."); KeysCheatMenu = cfg.Read("KeysCheatMenu", new UMFConfigStringArray(new string[] { "B" }, true), "The key(s) used to toggle the Cheat Menu window."); KeysRefill = cfg.Read("KeysRefill", new UMFConfigStringArray(new string[0], true), "The key(s) used to Refilling items."); KeysNoClip = cfg.Read("KeysNoClip", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle No Clip."); KeysInfHealth = cfg.Read("KeysInfHealth", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle Infinite Health."); KeysInfEnergy = cfg.Read("KeysInfEnergy", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle Infinite Energy."); KeysIncTime = cfg.Read("KeysIncTime", new UMFConfigStringArray(new string[0], true), "The key(s) used to Increase Time."); KeysDecTime = cfg.Read("KeysDecTime", new UMFConfigStringArray(new string[0], true), "The key(s) used to Decrease Time."); KeysPauseTime = cfg.Read("KeysPauseTime", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle pausing of time."); KeysSleepwalk = cfg.Read("KeysSleepwalk", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle Sleepwalking."); UpdateBinds(); TextColor = cfg.Read("TextColor", new UMFConfigColorHexRGBA(new Color(0.604f, 1f, 0.604f, 1f)), "The main text color in Hex RGBA."); GUIColor = cfg.Read("GUIColor", new UMFConfigColorHexRGBA(new Color(0f, 0.7f, 1f, 1f)), "The main GUI color in Hex RGBA."); SRCheatMenu.Log("Finished loading settings."); } } catch (Exception e) { SRCheatMenu.Log("Error loading mod settings: " + e.Message + " (" + e.InnerException.Message + ")"); } }
internal static void Load() { DysonsGalaxy.Log("Loading settings."); try { using (var cfg = new UMFConfig()) { var cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); DysonsGalaxy.Log("The config file was outdated and has been deleted. A new config will be generated.", false, true); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. cfg.Write("ModDependencies", new UMFConfigStringArray(new [] { "" })); //A comma separated list of mod/library names that this mod requires to function. Format: SomeMod:1.50,SomeLibrary:0.60 cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.53.0")); cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //This will prevent the mod from being loaded after the next major UMF release cfg.Write("UpdateURL", new UMFConfigString("https://umodframework.com/updatemod?id=27")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); DysonsGalaxy.Log("Finished UMF Settings."); //Add your settings here Logging = cfg.Read("EnableLogging", new UMFConfigBool(false, false, false), "This will enable logging to [GameDirectory]/uModFramework/Logs/DysonsGalaxy.log.", "Warning: This can bloat the log file. Please only enable it if you encounter issues with this mod or suspect this mod of being the cause of issues with the game."); SkipPrologue = cfg.Read("SkipPrologue", new UMFConfigBool(true, false, false), "Enable this to skip the prologue when you start a new game."); MinStarCount = cfg.Read("MinStarCount", new UMFConfigInt(32, 5, 32, 32, true), "Maximum stars that can be created when starting a new game. (32 = default)", " I have to make the minimum value 5 since going lower than this the game will really not be happy. sorry, no 1 System challenge just yet."); MaxStarCount = cfg.Read("MaxStarCount", new UMFConfigInt(64, 64, 255, 64, true), "Maximum stars that can be created when starting a new game. (64 = default) ", "The maximum is 255 since the game handles the planet count with a byte.", "And I'm somewhat sure that even 255 will make the game burn through the CPU. So USE AT YOUR OWN RISK."); MinStarDistance = cfg.Read("MinStarDistance", new UMFConfigDouble(2d, 0.0d, 1000d, 1, 2d, false), "Minimum distance between stars when generating a new galaxy. (2 = default)", "The minimum of 0 will possibly result in all stars becoming one and the Universe ending. I have not tested it.", "The maximum will likely result in other stars being pretty much absent from the game. I have not tested this either."); DysonsGalaxy.Log("Finished loading settings."); } } catch (Exception e) { DysonsGalaxy.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")", false, true); } }
internal void Load() { SRWeatherMod.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(); SRWeatherMod.Log("The config file was outdated and has been deleted. A new config will be generated."); } cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.52")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //Uncomment if a future release is expected to break the mod cfg.Write("UpdateURL", new UMFConfigString("https://umodframework.com/updatemod?id=7")); //cfg.Write("UpdateURL", new UMFConfigString(@"https://raw.githubusercontent.com/EmeraldPlay27/SRWeatherMod/master/version.txt")); //cfg.Write("UpdateURL", new UMFConfigString(@"https://umodframework.com/new/updatemod?id=")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); SRWeatherMod.Log("Finished UMF Settings."); //RainEnabled = cfg.Read("RainEnabled", new UMFConfigBool(true, false, false), "Should rain be enabled? Changing this setting takes effect immediately, although if raining it won't stop until next weather change."); var weatherString = cfg.Read("WeatherOption", new UMFConfigString(WeatherOptions.Changing_Weather.ToString(), WeatherOptions.No_Weather.ToString(), false, false, Enum.GetNames(typeof(WeatherOptions)))); try { WeatherOption = (WeatherOptions)Enum.Parse(typeof(WeatherOptions), weatherString, true); }catch (Exception) { WeatherOption = WeatherOptions.Changing_Weather; } var ambianceDirector = SRSingleton <SceneContext> .Instance?.AmbianceDirector; if (ambianceDirector != null) { WMShared.SetWeather(ambianceDirector); } SRWeatherMod.Log("Finished loading settings."); } } catch (Exception e) { SRWeatherMod.Log("Error loading mod settings: " + e.Message + " (" + e.InnerException.Message + ")"); } }
public void Load() { Loader.Log("Loading Settings..."); try { using (var umfconfig = new UMFConfig()) { var a = umfconfig.Read("ConfigVersion", new UMFConfigString("", "", false, false, Array.Empty <string>()), Array.Empty <string>()); if (a != string.Empty && a != ConfigVersion) { umfconfig.DeleteConfig(); Loader.Log( "The config file was outdated and has been deleted. A new config will be generated."); } umfconfig.Read("Enabled", new UMFConfigBool(true, null), Array.Empty <string>()); umfconfig.Read("LoadPriority", new UMFConfigString("Normal", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write("MinVersion", new UMFConfigString("0.45", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write("MaxVersion", new UMFConfigString("0.53", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write("ConfigVersion", new UMFConfigString(ConfigVersion, "", false, false, Array.Empty <string>()), Array.Empty <string>()); Loader.Log("Finished UMF Settings."); MobsCantHurtYou = umfconfig.Read("MobsCantHurtYou", new UMFConfigBool(true, false), "Mobs cant see you"); FreeCrafting = umfconfig.Read("FreeCrafting", new UMFConfigBool(true, false), "Craft any item in Crafting"); DisableCorruptionDamage = umfconfig.Read("DisableCorruptionDamage", new UMFConfigBool(true, false), "Disable Corruption Damage?"); InstantKill = umfconfig.Read("InstantKill", new UMFConfigBool(true, false), "Instant Kill?"); InstantTool = umfconfig.Read("Instant Tool", new UMFConfigBool(true, false), "Instant Tool?"); InfiniteItem = umfconfig.Read("InfiniteItem", new UMFConfigBool(true, false), "Infinite Item?"); AvoidCraftNotice = umfconfig.Read("AvoidCraftNotice", new UMFConfigBool(true, false), "Remove Crafting Notice"); InstantMining = umfconfig.Read("InstantMining", new UMFConfigBool(true, false), "InstantMining"); NoFall = umfconfig.Read("NoFall", new UMFConfigBool(true, false), "NoFall"); Loader.Log("Finished loading settings."); } } catch (Exception ex) { Loader.Log(string.Concat("Error loading mod settings: ", ex.Message, " (", ex.InnerException?.Message, ")")); } }
//Add your config vars here. internal static void Load() { try { using (UMFConfig cfg = new UMFConfig()) { string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); GadgetCore.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. //cfg.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod names that this mod requires to function. //cfg.Write("ModDependenciesVersions", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod versions matching the ModDependencies setting. cfg.Read("LoadPriority", new UMFConfigString("AboveNormal")); cfg.Write("MinVersion", new UMFConfigString("0.52.1")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //Uncomment if you think your mod may break with the next major UMF release. cfg.Write("UpdateURL", new UMFConfigString("")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); GadgetCore.Log("Finished UMF Settings."); MaxConnections = cfg.Read("MaxConnections", new UMFConfigInt(4, 1, int.MaxValue, 4), "The maximum number of connections allowed when using host-and-play. This setting only matters on the host."); UseUPnP = cfg.Read("UseUPnP", new UMFConfigBool(false), "If True, will attempt to use UPnP to bypass the need to port-forward to host-and-play over the internet. Not all routers support this. Disabled by default due to severe unresolved bugs that prevent the game from working at all sometimes."); GadgetNetwork.MatrixTimeout = cfg.Read("NetworkTimeout", new UMFConfigFloat(2.5f), "How long to wait for the host's game to respond to Gadget Core's ID synchronization. If the host's game does not respond in time, it will be assumed that the host does not have Gadget Core installed."); string enabledModsString = PlayerPrefs.GetString("EnabledMods", ""); try { enabledMods = enabledModsString.Split(',').Select(x => x.Split(':')).ToDictionary(x => x[0], x => bool.Parse(x[1])); } catch (IndexOutOfRangeException) { enabledMods = new Dictionary <string, bool>(); } foreach (GadgetModInfo mod in GadgetMods.ListAllModInfos()) { mod.Mod.Enabled = enabledMods.ContainsKey(mod.Attribute.Name) ? enabledMods[mod.Attribute.Name] : (enabledMods[mod.Attribute.Name] = mod.Attribute.EnableByDefault); } GadgetCore.Log("Finished loading settings."); } } catch (Exception e) { GadgetCore.Log("Error loading mod settings: " + e.ToString()); } }
/// Legacy code for future improvement purposes //public static bool enableResourceEditNewgame; //public static bool enableResourceEditMidgame; internal static void Load() { CEOverlordCheatMenu.Log("Loading settings."); try { using (UMFConfig cfg = new UMFConfig()) { cfg.Write("UpdateURL", new UMFConfigString("https://umodframework.com/updatemod?id=16")); string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(false); CEOverlordCheatMenu.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. //cfg.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod names that this mod requires to function. //cfg.Write("ModDependenciesVersions", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod versions matching the ModDependencies setting. cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.52.1")); //cfg.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //Uncomment if you think your mod may break with the next major UMF release. cfg.Write("UpdateURL", new UMFConfigString("")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); CEOverlordCheatMenu.Log("Finished UMF Settings."); //Add your settings here enableUnlimitedResources = cfg.Read("Enable unlimited resources", new UMFConfigBool(false, false, false), "This is a toggle to enable/disable unlimited resources."); /// Legacy code for future improvement purposes //enableResourceEditNewgame = cfg.Read("Change resources on new game", new UMFConfigBool(true), "This is a switch to toggle if you want to change your resources when starting a new game."); //enableResourceEditMidgame = cfg.Read("Change resource counts mid game", new UMFConfigBool(true), "This is a switch to toggle if you want to edit your resource count mid-game (Overwrites 'Change resources on new game' settings)"); //resourceList["wood"] = cfg.Read("Wood", new UMFConfigInt(200, 200, 99999), "This is the amount of wood you spawn with / have mid-game (if applicable)"); //resourceList["food"] = cfg.Read("Food", new UMFConfigInt(200, 200, 99999), "This is the amount of food you spawn with / have mid-game (if applicable)"); //resourceList["gold"] = cfg.Read("Gold", new UMFConfigInt(0, 0, 99999), "This is the amount of gold you spawn with / have mid-game (if applicable)"); CEOverlordCheatMenu.Log("Finished loading settings."); } } catch (Exception e) { CEOverlordCheatMenu.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")"); } }
internal void Load() { PrepperMod.Log("Loading settings."); try { using (UMFConfig config = new UMFConfig()) { string configVersion = config.Read("ConfigVersion", new UMFConfigString()); if (configVersion != string.Empty && configVersion != PrepperModConfig.configVersion) { config.DeleteConfig(false); PrepperMod.Log("The config file was outdated and has been deleted. A new config will be generated."); } //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started. config.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod/library names that this mod requires to function. Format: SomeMod:1.50,SomeLibrary:0.60 config.Read("LoadPriority", new UMFConfigString("Normal")); config.Write("MinVersion", new UMFConfigString("0.53.0")); config.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //This will prevent the mod from being loaded after the next major UMF release config.Write("UpdateURL", new UMFConfigString("")); config.Write("ConfigVersion", new UMFConfigString(PrepperModConfig.configVersion)); PrepperMod.Log("Finished UMF Settings."); KeysIncTime = config.Read("Skip Time Forwards", new UMFConfigStringArray(new string[0], true), "The key(s) used to skip forwards in time."); KeysDecTime = config.Read("Skip Time Backwards", new UMFConfigStringArray(new string[0], true), "The key(s) used to skip backwards in time."); KeysStopTime = config.Read("Toggle Time-Stop", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle stopped time."); UpdateBinds(); SkipDelta = config.Read("Time skip delta", new UMFConfigInt(15, 5, 60), "How far to skip each time."); PrepperModController.Instance.SkipDelta(SkipDelta); PrepperMod.Log("Finished loading settings."); } } catch (Exception e) { PrepperMod.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")"); } }
public void Load() { //Logging is important in case you do something wrong. //We are logging before we log the settings, after we finish loading the UMF specific settings and when we have finished loading the settings. //We are also catching errors using the try catch clause and logging them. //All this logging will help you figure out exactly in which part something went wrong. PlortMarket.Log("Loading settings."); try { //Here we are actually doing all the config changes to the ini file where the settings are stored. //This is using an IDisposible in a using clause which is automatically disposed at the end, which basically means the ini file is no longer locked by the mod. using (UMFConfig cfg = new UMFConfig()) { //Config version related code string cfgVer = cfg.Read("ConfigVersion", new UMFConfigString()); if (cfgVer != string.Empty && cfgVer != configVersion) { cfg.DeleteConfig(); PlortMarket.Log("The config file was outdated and has been deleted. A new config will be generated."); } //This is the UMF specific settings for the mod, these are not shown in game and are mostly set by the mod creator. //Setting enabled to false means preventing the mod from being loaded by UMF. //The load priority can be First, Normal and Last, and is used to ensure your mods that depend on each other work correctly. //Min and max version is used to set which version of UMF the mod requires, and which version it might stop working again. //UpdateURL is used to make your mod auto update it self when a new version is out. The response or contents should be "1.0|https://mymodwebsite.com/PlortMarket_v1.0.zip" without the quotes. //ConfigVersion is as explained above. //Read is used to only read a variable, and set the default if it does not exist. //Write is used to always write the variable, regardless of if it exists or not. cfg.Read("Enabled", new UMFConfigBool(true)); cfg.Read("LoadPriority", new UMFConfigString("Normal")); cfg.Write("MinVersion", new UMFConfigString("0.45")); cfg.Write("MaxVersion", new UMFConfigString("0.49.99999.99999")); cfg.Write("UpdateURL", new UMFConfigString(@"https://mymodwebsite.com/mymodversion.txt")); cfg.Write("ConfigVersion", new UMFConfigString(configVersion)); PlortMarket.Log("Finished UMF Settings."); //Here we actually load all the mod's ini settings into their respective variables. //You can read more about the UMFConfigParsers in the API section of this documentation. //MyFirstIntSetting = cfg.Read("MyFirstIntSetting ", new UMFConfigInt(10, 0, 100, 1), "A description of what my int setting does."); //MyFirstBoolSetting = cfg.Read("MyFirstBoolSetting ", new UMFConfigBool(true, false), "A description of what my bool setting does."); float health4_default = 500f; float health4_vanilla = 350f; float health4_rangeStart = 350f; float health4_rangeEnd = 1000f; //HealthUpgrade4 = cfg.Read("HealthUpgrade4", new UMFConfigInt(health4_default, health4_rangeStart, health4_rangeEnd, health4_vanilla), "The health level for the 4th Health Upgrade."); HealthUpgrade4 = cfg.Read("HealthUpgrade4", new UMFConfigFloat(health4_default, health4_rangeStart, health4_rangeEnd, 1, health4_vanilla), "The health level for the 4th Health Upgrade."); float ancientWater_default = 1.0f; float ancientWater_rangeStart = 0.5f; float ancientWater_rangeEnd = 10.0f; float ancientWater_vanilla = 0.5f; AncientWaterLifetime = cfg.Read("AncientWaterLifetime", new UMFConfigFloat(ancientWater_default, ancientWater_rangeStart, ancientWater_rangeEnd, 1, ancientWater_vanilla), "Time modifier for the Ancient Water effect."); PlortMarket.Log("Finished loading settings."); } } catch (Exception e) { PlortMarket.Log("Error loading mod settings: " + e.Message + " (" + e.InnerException.Message + ")"); } }
public void Load() { Loader.Log("Loading Settings...", false); try { using (UMFConfig umfconfig = new UMFConfig()) { string a = umfconfig.Read <string>("ConfigVersion", new UMFConfigString("", "", false, false, Array.Empty <string>()), Array.Empty <string>()); if (a != string.Empty && a != LoaderConfig.configVersion) { umfconfig.DeleteConfig(); Loader.Log("The config file was outdated and has been deleted. A new config will be generated.", false); } umfconfig.Read <bool>("Enabled", new UMFConfigBool(new bool?(true), null, false), Array.Empty <string>()); umfconfig.Read <string>("LoadPriority", new UMFConfigString("Normal", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write <string>("MinVersion", new UMFConfigString("0.45", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write <string>("MaxVersion", new UMFConfigString("0.49.99999.99999", "", false, false, Array.Empty <string>()), Array.Empty <string>()); umfconfig.Write <string>("ConfigVersion", new UMFConfigString(LoaderConfig.configVersion, "", false, false, Array.Empty <string>()), Array.Empty <string>()); Loader.Log("Finished UMF Settings.", false); this.MobsCantHurtYou = umfconfig.Read <bool>("MobsCantHurtYou", new UMFConfigBool(new bool?(true), new bool?(false), false), new string[] { "Mobs cant see you" }); this.FreeCrafting = umfconfig.Read <bool>("FreeCrafting", new UMFConfigBool(new bool?(true), new bool?(false), false), new string[] { "Craft any item in Crafting" }); this.DisableCorruptionDamage = umfconfig.Read <bool>("DisableCorruptionDamage", new UMFConfigBool(new bool?(true), new bool?(false), false), new string[] { "Disable Corruption Damage?" }); this.InstantKill = umfconfig.Read <bool>("InstantKill", new UMFConfigBool(new bool?(true), new bool?(false), false), new string[] { "Instant Kill?" }); this.InstantTool = umfconfig.Read <bool>("Instant Tool", new UMFConfigBool(new bool?(false), new bool?(false), false), new string[] { "Instant Tool?" }); this.InfiniteItem = umfconfig.Read <bool>("InfiniteItem", new UMFConfigBool(new bool?(false), new bool?(false), false), new string[] { "Infinite Item?" }); this.AvoidCraftNotice = umfconfig.Read <bool>("AvoidCraftNotice", new UMFConfigBool(new bool?(false), new bool?(false), false), new string[] { "Remove Crafting Notice" }); Loader.Log("Finished loading settings.", false); } } catch (Exception ex) { Loader.Log(string.Concat(new string[] { "Error loading mod settings: ", ex.Message, " (", ex.InnerException.Message, ")" }), false); } }