GetValue() public method

Gets the value with the specified section and the specified key.
public GetValue ( string section, string key ) : string
section string Section name
key string Key name
return string
Example #1
0
            /// <summary>
            /// Loads all custom vehicles
            /// </summary>
            public static void LoadCustomVehicles()
            {
                CustomVehicles = new List<CustomVehicle>();
                if (!File.Exists(CONFIG_FILE_CUSTOM_VEHICLES)) return;

                IniFile ini = new IniFile(CONFIG_FILE_CUSTOM_VEHICLES);
                int count = 0; if (!int.TryParse(ini.GetValue(CONFIG_CV, CONFIG_CV_COUNT), out count)) count = 0;
                if (count <= 0) return;

                CustomVehicles.Capacity = count;

                for (int i = 0; i < count; i++)
                {
                    string data = ini.GetValue(CONFIG_CV, Utils.FormatML(CONFIG_CV_ITEM, i + 1));
                    CustomVehicle cv = CustomVehicle.Deserialize(data);
                    if (cv != null)
                    {
                        CustomVehicles.Add(cv);
                    }
                }

                CustomVehicles.Sort();
            }
Example #2
0
            /// <summary>
            /// Loads all custom locations
            /// </summary>
            public static void LoadCustomLocations()
            {
                Targets = new List<SimpleTeleportTarget>();
                if (!File.Exists(CONFIG_FILE_CUSTOM_LOCATIONS)) return;

                IniFile ini = new IniFile(CONFIG_FILE_CUSTOM_LOCATIONS);

                int count = Utils.ParseInt(ini.GetValue(CONFIG_CL, CONFIG_CL_COUNT));
                if (count <= 0) return;

                Targets.Capacity = count;

                for (int i = 0; i < count; i++)
                {
                    SimpleTeleportTarget target = SimpleTeleportTarget.Deserialize(ini.GetValue(CONFIG_CL, Utils.FormatML(CONFIG_CL_ENTRY, i + 1)));
                    if (target != null) Targets.Add(target);
                }
                Targets.Sort();
            }
Example #3
0
            /// <summary>
            /// Loads player model &amp; skin &amp; props custom sets
            /// </summary>
            public static void LoadMSPCustomSets()
            {
                Items = new List<MSPCustomSet>();
                if (!File.Exists(CONFIG_FILE_MSPCS)) return;

                IniFile ini = new IniFile(CONFIG_FILE_MSPCS);

                int count = 0; if (!int.TryParse(ini.GetValue(CONFIG_MSPCS, CONFIG_MSPCS_COUNT), out count)) count = 0;
                if (count == 0) return;

                Items.Capacity = count;

                for (int i = 1; i <= count; i++)
                {
                    MSPCustomSet set = MSPCustomSet.Deserialize(ini.GetValue(CONFIG_MSPCS, Utils.FormatML(CONFIG_MSPCS_ENTRY, i)));
                    if (set != null) Items.Add(set);
                }

                Items.Sort();
            }
Example #4
0
        /// <summary>
        /// Load configurations
        /// </summary>
        public static void Load()
        {
            if (!File.Exists(CONFIG_FILE))
            {
                Utils.ShowNotificationAboveMap(GlobalConst.Message.CONFIGURATION_CREATING);
                Save();
                return;
            }

            try
            {
                IniFile ini = new IniFile(CONFIG_FILE);

                // Trainer
                Feature.Config.AutoSave = Utils.ParseBoolStr(ini.GetValue(CONFIG_TRAINER, CONFIG_TRAINER_AUTO_SAVE));

                // Keys
                InputKey.ToggleMenu = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_TOGGLE_MENU));
                InputKey.MenuUp = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_UP));
                InputKey.MenuDown = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_DOWN));
                InputKey.MenuLeft = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_LEFT));
                InputKey.MenuRight = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_RIGHT));
                InputKey.MenuSelect = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_SELECT));
                InputKey.MenuBack = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_BACK));
                InputKey.BoostVehicle = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_BOOST_VEHICLE));
                InputKey.StopVehicle = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_STOP_VEHICLE));
                InputKey.VehicleRocket = Utils.ParseKey(ini.GetValue(CONFIG_KEYS, CONFIG_KEYS_VEHICLE_ROCKET));

                // Player
                Feature.Player.Invincible = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_INVINCIBLE));
                Feature.Player.InfiniteAbility = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_INFINITE_ABILITY));
                Feature.Player.FastRun = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_FAST_RUN));
                Feature.Player.FastSwim = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_FAST_SWIM));
                Feature.Player.SuperJump = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_SUPER_JUMP));
                Feature.Player.Noiseless = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_NOISELESS));
                Feature.Player.Wanted.NeverWanted = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_NEVER_WANTED));
                Feature.Player.Wanted.PoliceIgnored = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_POLICE_IGNORED));
                Feature.Player.Wanted.EveryoneIgnored = Utils.ParseBoolStr(ini.GetValue(CONFIG_PLAYER, CONFIG_PLAYER_EVERYONE_IGNORED));

                // Player MSP Custom Sets
                MSPCustomSets.LoadMSPCustomSets();

                // Location
                Feature.Location.ShowCoordinates = Utils.ParseBoolStr(ini.GetValue(CONFIG_LOCATION, CONFIG_LOCATION_SHOW_COORDINATES));
                Location.LoadCustomLocations();

                // Vehicle
                Feature.Vehicle.Boost = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_BOOST));
                Feature.Vehicle.Invincible = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_INVINCIBLE));
                Feature.Vehicle.SeatBelt = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_SEATBELT));
                Feature.Vehicle.SpawnIntoVehicle = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_SPAWN_INTO));
                Feature.Vehicle.SpeedMeter.Show = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_SPEEDMETER_SHOW));
                Feature.Vehicle.SpeedMeter.ShowInMetric = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_SPEEDMETER_SHOW_IN_METRIC));
                Feature.Vehicle.SpeedMeter.ShowWithoutVehicle = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_SPEEDMETER_SHOW_WITHOUT_VEHICLE));
                Feature.Vehicle.Door.InstantOpenClose = Utils.ParseBoolStr(ini.GetValue(CONFIG_VEHICLE, CONFIG_VEHICLE_DOOR_INSTANT));
                Vehicle.LoadCustomVehicles();

                // Weapon
                Feature.Weapon.ExplosiveAmmo = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_EXPLOSIVE_AMMO));
                Feature.Weapon.ExplosiveMelee = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_EXPLOSIVE_MELEE));
                Feature.Weapon.FireAmmo = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_FIRE_AMMO));
                Feature.Weapon.InfiniteAmmo = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_INFINITE_AMMO));
                Feature.Weapon.NoReload = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_NO_RELOAD));
                Feature.Weapon.PermanentParachute = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_PERMANENT_PARACHUTE));
                Feature.Weapon.VehicleRocket = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEAPON, CONFIG_WEAPON_VEHICLE_ROCKETS));

                // Time
                Feature.DateTimeSpeed.ShowTime = Utils.ParseBoolStr(ini.GetValue(CONFIG_TIME, CONFIG_TIME_SHOW_TIME));
                Feature.DateTimeSpeed.Paused = Utils.ParseBoolStr(ini.GetValue(CONFIG_TIME, CONFIG_TIME_PAUSED));
                Feature.DateTimeSpeed.SyncWithSystem = Utils.ParseBoolStr(ini.GetValue(CONFIG_TIME, CONFIG_TIME_SYNC_WITH_SYSTEM));

                // World
                Feature.World.MoonGravity = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_MOON_GRAVITY));
                Feature.World.RandomCops = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_COPS), true);
                Feature.World.RandomTrains = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_TRAINS), true);
                Feature.World.RandomBoats = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_BOATS), true);
                Feature.World.GarbageTrucks = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_GARBATE_TRUCKS), true);
                Feature.World.RestrictedZones = Utils.ParseBoolStr(ini.GetValue(CONFIG_WORLD, CONFIG_WORLD_RESTRICTED_ZONES), true);

                // Weather
                Feature.Weather.Wind = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEATHER, CONFIG_WEATHER_WIND));
                Feature.Weather.Freeze = Utils.ParseBoolStr(ini.GetValue(CONFIG_WEATHER, CONFIG_WEATHER_FREEZE));

                // Misc
                Feature.Misc.PortableRadio = Utils.ParseBoolStr(ini.GetValue(CONFIG_MISC, CONFIG_MISC_PORTABLE_RADIO));
                Feature.Misc.HideHud = Utils.ParseBoolStr(ini.GetValue(CONFIG_MISC, CONFIG_MISC_HIDE_HUD));

                // Language
                Trainer.LanguageCode = Utils.ParseInt(ini.GetValue(CONFIG_LANGUAGE, CONFIG_LANGUAGE_VALUE));

                Utils.ShowNotificationAboveMap(GlobalConst.Message.CONFIGURATION_LOADED);
            }
            catch
            {
            }
        }