Пример #1
0
 public MapParser(FOGMParser GMParser, string PathMaps, string PathCity)
 {
     this.PathCity = PathCity;
     this.PathMaps = PathMaps;
     this.Ini = new IniReader(PathMaps);
     this.GMParser = GMParser;
 }
Пример #2
0
 public void LoadConfigItem(IniReader ini, ConfigItem it)
 {
     string Val = ini.IniReadValue(it.Section, it.Key);
     if (string.IsNullOrEmpty(Val))
         SetVariable(it.Variable, it.Default);
     else
         SetVariable(it.Variable, ini.IniReadValue(it.Section, it.Key));
 }
Пример #3
0
 public LocationParser(string locationsCfgPath, MapParser mapParse, GWParser gwParse, FOGMParser gmParser)
 {
     _ini              = new IniReader(locationsCfgPath);
     _locationsCfgPath = locationsCfgPath;
     _mapParse         = mapParse;
     _gwParser         = gwParse;
     _gmParser         = gmParser;
 }
Пример #4
0
 public void Load()
 {
     Ini = new IniReader(".\\" + ConfigName + ".cfg");
     foreach (ConfigItem It in ConfigItems)
         LoadConfigItem(Ini, It);
     Ini = new IniReader(".\\" + ConfigName + ".user.cfg");
     foreach (ConfigItem It in UserConfigItems)
         LoadConfigItem(Ini, It);
 }
Пример #5
0
        List<ConfigItem> UserConfigItems = new List<ConfigItem>(); // <ConfigName>.user.cfg

        #endregion Fields

        #region Constructors

        public Config(String ConfigName)
        {
            this.ConfigName = ConfigName;

            Ini = new IniReader(".\\"+ConfigName+".cfg");
            if (!File.Exists(".\\" + ConfigName + ".cfg"))
            {
                SetDefaultValues(false);
                _firstTime = true;
            }
            if (!File.Exists(".\\" + ConfigName + ".user.cfg"))
                SetDefaultValues(true);
        }
Пример #6
0
 public void Load()
 {
     Ini = new IniReader(".\\" + ConfigName + ".cfg");
     foreach (ConfigItem It in ConfigItems)
     {
         LoadConfigItem(Ini, It);
     }
     Ini = new IniReader(".\\" + ConfigName + ".user.cfg");
     foreach (ConfigItem It in UserConfigItems)
     {
         LoadConfigItem(Ini, It);
     }
 }
Пример #7
0
 public void Save()
 {
     Ini = new IniReader(".\\" + ConfigName + ".cfg");
     foreach (ConfigItem It in ConfigItems)
     {
         Ini.IniWriteValue(It.Section, It.Key, GetVariable(It.Variable));
     }
     Ini = new IniReader(".\\" + ConfigName + ".user.cfg");
     foreach (ConfigItem It in UserConfigItems)
     {
         Ini.IniWriteValue(It.Section, It.Key, GetVariable(It.Variable));
     }
 }
Пример #8
0
        public Config(String ConfigName)
        {
            this.ConfigName = ConfigName;

            Ini = new IniReader(".\\" + ConfigName + ".cfg");
            if (!File.Exists(".\\" + ConfigName + ".cfg"))
            {
                SetDefaultValues(false);
                _firstTime = true;
            }
            if (!File.Exists(".\\" + ConfigName + ".user.cfg"))
            {
                SetDefaultValues(true);
            }
        }
Пример #9
0
 public void Save()
 {
     Ini = new IniReader(".\\" + ConfigName + ".cfg");
     foreach(ConfigItem It in ConfigItems)
         Ini.IniWriteValue(It.Section, It.Key, GetVariable(It.Variable));
     Ini = new IniReader(".\\" + ConfigName + ".user.cfg");
     foreach (ConfigItem It in UserConfigItems)
         Ini.IniWriteValue(It.Section, It.Key, GetVariable(It.Variable));
 }