internal static void LoadData() { if (initted) { return; } if (CONFIG.IsLoadable) { ConfigNodeWithSteroids data = CONFIG.Load().NodeWithSteroids; initted = true; registeredMods.Clear(); if (data.HasValue("showWindowAtStartup")) { IntroWindowClass.showIntroAtStartup = data.GetValue <bool>("showWindowAtStartup"); } foreach (ConfigNode node in data.GetNodes()) { if (node.HasValue("name") && node.HasValue("useBlizzy")) { string modName = node.GetValue("name"); string displayName = modName; try { displayName = node.GetValue("displayName"); if (displayName == "") { displayName = modName; } } catch (System.Exception e) { Log.Exception(e, "Error reading value [displayName] from {0}", node.name); } bool useBlizzy = ToBool(node.GetValue("useBlizzy")); bool useStock = true; if (node.HasValue("useStock")) { useStock = ToBool(node.GetValue("useStock")); } bool noneAllowed = true; if (node.HasValue("noneAllowed")) { noneAllowed = ToBool(node.GetValue("noneAllowed")); } Mod mod = new Mod(modName, displayName, useBlizzy, useStock, noneAllowed); registeredMods.Add(modName, mod); // sortedModList.Add(mod); } //sortedModList.Sort((x, y) => x.displayName.CompareTo(y.displayName)); } } }
private Globals() { try { UrlDir.UrlConfig urlc = GameDatabase.Instance.GetConfigs("TWEAKSCALE")[0]; ConfigNodeWithSteroids cn = ConfigNodeWithSteroids.from(urlc.config.GetNode("FEATURES")); this.AllowStealthSave = cn.GetValue <bool>("AllowStealthSave"); } catch (Exception) { this.AllowStealthSave = false; } }
private Globals() { try { UrlDir.UrlConfig urlc = GameDatabase.Instance.GetConfigs("KSP-Recall")[0]; ConfigNodeWithSteroids cn = ConfigNodeWithSteroids.from(urlc.config.GetNode("INSTALLED")); this.Attached = cn.GetValue <bool>("Attached"); this.ChillingOut = cn.GetValue <bool>("ChillingOut"); this.Driftless = cn.GetValue <bool>("Driftless"); this.Refunding = cn.GetValue <bool>("Refunding"); this.Resourceful = cn.GetValue <bool>("Resourceful"); } catch (Exception) { this.Attached = false; this.ChillingOut = false; this.Driftless = false; this.Refunding = false; this.Resourceful = false; } }