Example #1
0
        public static void Load(string filename)
        {
            var file = new IniFile(Directory.GetCurrentDirectory() + "\\" + filename);

            //MapLegend
            SpawnPointSymbol = file.IniReadValue("MapLegend", "SpawnPoint", "S").ToCharArray()[0];
            HeroSymbol = file.IniReadValue("MapLegend", "Hero", "H").ToCharArray()[0];
            PathSymbol = file.IniReadValue("MapLegend", "Path", ".").ToCharArray()[0];
            WallSymbol = file.IniReadValue("MapLegend", "Wall", "#").ToCharArray()[0];
            EnemySymbol = file.IniReadValue("MapLegend", "Enemy", "E").ToCharArray()[0];
            TreasureSymbol = file.IniReadValue("MapLegend", "Treasure", "T").ToCharArray()[0];
            ExitSymbol = file.IniReadValue("MapLegend", "Exit", "G").ToCharArray()[0];

            //Paths
            LevelsPath = file.IniReadValue("Paths", "Levels", @"\Levels\");
            MapsSubPath = file.IniReadValue("Paths", "Maps", @"Maps\");
            EnemiesSubPath = file.IniReadValue("Paths", "Enemies", @"Enemies\");
            TexturesSubPath = file.IniReadValue("Paths", "Textures", @"Textures\");
            TreasuresSubPath = file.IniReadValue("Paths", "Treasures", @"Treasures\");
            LogFile = file.IniReadValue("Paths", "LogFile", "\\log.txt");

            //Hero
            MaxHealthPotions = int.Parse(file.IniReadValue("Hero", "MaxHealthPotions", "3"));
            MaxManaPotions = int.Parse(file.IniReadValue("Hero", "MaxManaPotions", "3"));
            HealthPotionPercent = float.Parse(file.IniReadValue("Hero", "HealthPotionPercent", "30"));
            ManaPotionPercent = float.Parse(file.IniReadValue("Hero", "ManaPotionPercent", "30"));
        }
Example #2
0
        public IniFile GetIniFile([Localizable(false)] string name) {
            AbstractDataFile cached;
            if (_cache.TryGetValue(name, out cached)) return (IniFile)cached;

            var result = new IniFile(_carDirectory, name, _acd);
            _cache[name] = result;
            return result;
        }
Example #3
0
 private static void PrepareIni(string carId, string carSkinId, string showroomId) {
     var filename = FileUtils.GetCfgShowroomFilename();
     var iniFile = new IniFile(filename);
     iniFile["SHOWROOM"].Set("CAR", (carId ?? "").ToLowerInvariant());
     iniFile["SHOWROOM"].Set("SKIN", (carSkinId ?? "").ToLowerInvariant());
     iniFile["SHOWROOM"].Set("TRACK", (showroomId ?? "").ToLowerInvariant());
     iniFile.Save();
 }
Example #4
0
 private static void SetCurrentFilterIni(string filter) {
     var filename = FileUtils.GetCfgVideoFilename();
     var iniFile = new IniFile(filename);
     iniFile["POST_PROCESS"].Set("FILTER", filter);
     iniFile.Save();
 }
Example #5
0
        public override void SaveData(IniFile ini) {
            var section = ini["SERVER"];
            section.Set("NAME", Name);
            section.Set("PASSWORD", Password);
            section.Set("ADMIN_PASSWORD", AdminPassword);
            section.Set("REGISTER_TO_LOBBY", ShowOnLobby);
            section.Set("LOOP_MODE", LoopMode);
            section.Set("PICKUP_MODE_ENABLED", PickupMode);
            section.Set("MAX_CLIENTS", Capacity);

            section.Set("UDP_PORT", UdpPort);
            section.Set("TCP_PORT", TcpPort);
            section.Set("HTTP_PORT", HttpPort);
            section.Set("CLIENT_SEND_INTERVAL_HZ", SendIntervalHz);
            section.Set("NUM_THREADS", Threads);

            section.Set("TRACK", TrackId);
            section.Set("CONFIG_TRACK", TrackLayoutId);
            section.Set("CARS", CarIds, ';');

            section.SetIntEnum("ABS_ALLOWED", Abs);
            section.SetIntEnum("TC_ALLOWED", TractionControl);
            section.Set("STABILITY_ALLOWED", StabilityControl);
            section.Set("AUTOCLUTCH_ALLOWED", AutoClutch);
            section.Set("TYRE_BLANKETS_ALLOWED", TyreBlankets);
            section.Set("FORCE_VIRTUAL_MIRROR", ForceVirtualMirror);

            section.Set("FUEL_RATE", FuelRate);
            section.Set("DAMAGE_MULTIPLIER", DamageRate);
            section.Set("TYRE_WEAR_RATE", TyreWearRate);
            section.Set("ALLOWED_TYRES_OUT", AllowTyresOut);
            section.Set("MAX_BALLAST_KG", MaxBallast);
            section.Set("QUALIFY_MAX_WAIT_PERC", QualifyLimitPercentage);
            section.SetIntEnum("START_RULE", JumpStart);
        }
Example #6
0
        protected override void LoadData(IniFile ini) {
            var section = ini["SERVER"];
            Name = section.GetPossiblyEmpty("NAME");
            Password = section.GetNonEmpty("PASSWORD");
            AdminPassword = section.GetNonEmpty("ADMIN_PASSWORD");
            ShowOnLobby = section.GetBool("REGISTER_TO_LOBBY", true);
            LoopMode = section.GetBool("LOOP_MODE", true);
            PickupMode = section.GetBool("PICKUP_MODE_ENABLED", false);
            Capacity = section.GetInt("MAX_CLIENTS", 3);

            UdpPort = section.GetInt("UDP_PORT", 9600);
            TcpPort = section.GetInt("TCP_PORT", 9600);
            HttpPort = section.GetInt("HTTP_PORT", 8081);
            SendIntervalHz = section.GetInt("CLIENT_SEND_INTERVAL_HZ", 18);
            Threads = section.GetInt("NUM_THREADS", 2);

            TrackId = section.GetNonEmpty("TRACK");
            TrackLayoutId = section.GetNonEmpty("CONFIG_TRACK");
            CarIds = section.GetStrings("CARS", ';');

            Abs = section.GetIntEnum("ABS_ALLOWED", ServerPresetAssistState.Factory);
            TractionControl = section.GetIntEnum("TC_ALLOWED", ServerPresetAssistState.Factory);
            StabilityControl = section.GetBool("STABILITY_ALLOWED", false);
            AutoClutch = section.GetBool("AUTOCLUTCH_ALLOWED", false);
            TyreBlankets = section.GetBool("TYRE_BLANKETS_ALLOWED", false);
            ForceVirtualMirror = section.GetBool("FORCE_VIRTUAL_MIRROR", true);

            FuelRate = section.GetInt("FUEL_RATE", 100);
            DamageRate = section.GetInt("DAMAGE_MULTIPLIER", 100);
            TyreWearRate = section.GetInt("TYRE_WEAR_RATE", 100);
            AllowTyresOut = section.GetInt("ALLOWED_TYRES_OUT", 2);
            MaxBallast = section.GetInt("MAX_BALLAST_KG", 0);
            QualifyLimitPercentage = section.GetInt("QUALIFY_MAX_WAIT_PERC", 120);
            JumpStart = section.GetIntEnum("START_RULE", ServerPresetJumpStart.CarLocked);
        }
 public IniWriter(IniFile file, TextWriter writer)
 {
     _file = file;
     _writer = writer;
 }
Example #8
0
		public VoxelDrawable(IniFile.IniSection rules, IniFile.IniSection art) : base(rules, art) { }