public LoadOut(string name) { path = Path.Combine(Util.GetLoadoutFolder(), name + ".ini"); bool nu = false; if (!File.Exists(path)) { File.AppendAllText(path, ""); nu = true; } var ini = new IniParser(path); Name = ini.Name; if (!nu) { itemCount = Int32.Parse(ini.GetSetting("Def", "itemCount")); OwnerUse = ini.GetBoolSetting("Def", "ownerCanUse"); ModeratorUse = ini.GetBoolSetting("Def", "modCanUse"); NormalUse = ini.GetBoolSetting("Def", "normalCanUse"); } else { itemCount = 0; OwnerUse = true; NormalUse = true; ModeratorUse = true; } items = new Dictionary <int, LoadOutItem>(30); if (itemCount != 0) { LoadOutItem current; for (var i = 0; i < itemCount; i++) { string namee = ini.GetSetting(i.ToString(), "Name"); int amount; if (!Int32.TryParse(ini.GetSetting(i.ToString(), "Amount"), out amount)) { amount = Int32.MaxValue; } current = new LoadOutItem(namee, amount); items.Add(i, current); } } ini = null; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) { Server.GetInstance().LoadOuts.Remove(Name); } Server.GetInstance().LoadOuts.Add(Name, this); }
public string GetConfigPath(string config) { string path = DirConfig.GetSetting("Directories", config); if (path.StartsWith("%public%")) { path = path.Replace("%public%", Util.GetPublicFolder()); } if (path.StartsWith("%data%")) { path = path.Replace("%data%", Util.GetServerFolder()); } if (path.StartsWith("%root%")) { path = path.Replace("%root%", Util.GetRootFolder()); } if (path.StartsWith("%identity%")) { path = path.Replace("%identity%", Util.GetIdentityFolder()); } return(path); }
public string GetValue(string Section, string Setting, string defaultValue = "") { if (!PlutonConfig.ContainsSetting(Section, Setting)) { PlutonConfig.AddSetting(Section, Setting, defaultValue); PlutonConfig.Save(); } return(PlutonConfig.GetSetting(Section, Setting, defaultValue)); }
public LoadOut(string name) { path = Path.Combine(Util.GetLoadoutFolder(), name + ".ini"); bool nu = false; if (!File.Exists(path)) { File.AppendAllText(path, ""); nu = true; } var ini = new IniParser(path); Name = ini.Name; if (!nu) { itemCount = Int32.Parse(ini.GetSetting("Def", "itemCount")); OwnerUse = ini.GetBoolSetting("Def", "ownerCanUse"); ModeratorUse = ini.GetBoolSetting("Def", "modCanUse"); NormalUse = ini.GetBoolSetting("Def", "normalCanUse"); } else { itemCount = 0; OwnerUse = true; NormalUse = true; ModeratorUse = true; } items = new Dictionary<int, LoadOutItem>(30); if (itemCount != 0) { LoadOutItem current; for (var i = 0; i < itemCount; i++) { string namee = ini.GetSetting(i.ToString(), "Name"); int amount; if (!Int32.TryParse(ini.GetSetting(i.ToString(), "Amount"), out amount)) amount = Int32.MaxValue; current = new LoadOutItem(namee, amount); items.Add(i, current); } } ini = null; if (Server.GetInstance().LoadOuts.ContainsKey(Name)) Server.GetInstance().LoadOuts.Remove(Name); Server.GetInstance().LoadOuts.Add(Name, this); }
public bool AddFromIni(string inipath) { if (File.Exists(inipath)) { IniParser ini = new IniParser(inipath); foreach (string section in ini.Sections) { foreach (string setting in ini.EnumSection(section)) { this.Add(section, setting, ini.GetSetting(section, setting)); } } return true; } return false; }
public bool AddFromIni(string inipath) { if (File.Exists(inipath)) { IniParser ini = new IniParser(inipath); foreach (string section in ini.Sections.Keys) { foreach (string setting in ini.EnumSection(section)) { this.Add(section, setting, ini.GetSetting(section, setting)); } } return(true); } return(false); }
public string GetValue(string Section, string Setting) { return(ConfigFile.GetSetting(Section, Setting)); }
public static string GetValue(string Section, string Setting) { return(PlutonConfig.GetSetting(Section, Setting)); }