GetBoolSetting() public méthode

public GetBoolSetting ( string section, string setting ) : bool
section string
setting string
Résultat bool
Exemple #1
0
        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);
        }
Exemple #2
0
 public bool GetBoolValue(string Section, string Setting, bool defaultValue = false)
 {
     if (!PlutonConfig.ContainsSetting(Section, Setting))
     {
         PlutonConfig.AddSetting(Section, Setting, defaultValue.ToString().ToLower());
         PlutonConfig.Save();
     }
     return(PlutonConfig.GetBoolSetting(Section, Setting, defaultValue));
 }
Exemple #3
0
        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);
        }
Exemple #4
0
 public bool GetBoolValue(string Section, string Setting)
 {
     return(ConfigFile.GetBoolSetting(Section, Setting));
 }