Save() public method

Saves the current INI file.
public Save ( ) : void
return void
Exemplo n.º 1
0
            /// <summary>
            /// Saves all custom vehicles
            /// </summary>
            public static void SaveCustomVehicles()
            {
                if (File.Exists(CONFIG_FILE_CUSTOM_VEHICLES)) File.Delete(CONFIG_FILE_CUSTOM_VEHICLES);
                if (CustomVehicles == null || CustomVehicles.Count == 0) return;

                IniFile ini = new IniFile(CONFIG_FILE_CUSTOM_VEHICLES);

                ini.SetValue(CONFIG_CV, CONFIG_CV_COUNT, CustomVehicles.Count.ToString());
                for (int i = 0; i < CustomVehicles.Count; i++)
                {
                    ini.SetValue(CONFIG_CV, Utils.FormatML(CONFIG_CV_ITEM, i + 1), CustomVehicles[i].Serialize());
                }
                ini.Save();
            }
Exemplo n.º 2
0
            /// <summary>
            /// Saves custom locations
            /// </summary>
            public static void SaveCustomLocations()
            {
                if (File.Exists(CONFIG_FILE_CUSTOM_LOCATIONS)) File.Delete(CONFIG_FILE_CUSTOM_LOCATIONS);
                if (Targets == null || Targets.Count == 0) return;

                IniFile ini = new IniFile(CONFIG_FILE_CUSTOM_LOCATIONS);

                ini.SetValue(CONFIG_CL, CONFIG_CL_COUNT, Targets.Count.ToString());
                for (int i = 0; i < Targets.Count; i++)
                {
                    ini.SetValue(CONFIG_CL, Utils.FormatML(CONFIG_CL_ENTRY, i + 1), Targets[i].Serialize());
                }

                ini.Save();
            }
Exemplo n.º 3
0
            /// <summary>
            /// Saves player model &amp; skin &amp; props custom sets
            /// </summary>
            public static void SaveMSPCustomSets()
            {
                if (File.Exists(CONFIG_FILE_MSPCS)) File.Delete(CONFIG_FILE_MSPCS);
                if (Items == null || Items.Count == 0) return;

                IniFile ini = new IniFile(CONFIG_FILE_MSPCS);

                ini.SetValue(CONFIG_MSPCS, CONFIG_MSPCS_COUNT, Items.Count.ToString());
                for (int i = 1; i <= Items.Count; i++)
                {
                    MSPCustomSet set = Items[i - 1];
                    ini.SetValue(CONFIG_MSPCS, Utils.FormatML(CONFIG_MSPCS_ENTRY, i), set.Serialize());
                }

                ini.Save();
            }
Exemplo n.º 4
0
        /// <summary>
        /// Save configurations
        /// </summary> 
        public static void Save(bool showNotification = true)
        {
            if (File.Exists(CONFIG_FILE))
            {
                File.Delete(CONFIG_FILE);
            }

            try
            {
                IniFile ini = new IniFile(CONFIG_FILE);

                // Trainer
                ini.SetValue(CONFIG_TRAINER, CONFIG_TRAINER_AUTO_SAVE, Feature.Config.AutoSave.ToString());

                // Keys
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_STOP_VEHICLE, Enum.GetName(typeof(Keys), InputKey.StopVehicle));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_BOOST_VEHICLE, Enum.GetName(typeof(Keys), InputKey.BoostVehicle));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_BACK, Enum.GetName(typeof(Keys), InputKey.MenuBack));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_DOWN, Enum.GetName(typeof(Keys), InputKey.MenuDown));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_LEFT, Enum.GetName(typeof(Keys), InputKey.MenuLeft));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_RIGHT, Enum.GetName(typeof(Keys), InputKey.MenuRight));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_SELECT, Enum.GetName(typeof(Keys), InputKey.MenuSelect));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_MENU_UP, Enum.GetName(typeof(Keys), InputKey.MenuUp));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_TOGGLE_MENU, Enum.GetName(typeof(Keys), InputKey.ToggleMenu));
                ini.SetValue(CONFIG_KEYS, CONFIG_KEYS_VEHICLE_ROCKET, Enum.GetName(typeof(Keys), InputKey.VehicleRocket));

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

                // Location
                ini.SetValue(CONFIG_LOCATION, CONFIG_LOCATION_SHOW_COORDINATES, Feature.Location.ShowCoordinates.ToString());

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

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

                // Time
                ini.SetValue(CONFIG_TIME, CONFIG_TIME_SHOW_TIME, Feature.DateTimeSpeed.ShowTime.ToString());
                ini.SetValue(CONFIG_TIME, CONFIG_TIME_PAUSED, Feature.DateTimeSpeed.Paused.ToString());
                ini.SetValue(CONFIG_TIME, CONFIG_TIME_SYNC_WITH_SYSTEM, Feature.DateTimeSpeed.SyncWithSystem.ToString());

                // World
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_MOON_GRAVITY, Feature.World.MoonGravity.ToString());
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_COPS, Feature.World.RandomCops.ToString());
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_TRAINS, Feature.World.RandomTrains.ToString());
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_RANDOM_BOATS, Feature.World.RandomBoats.ToString());
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_GARBATE_TRUCKS, Feature.World.GarbageTrucks.ToString());
                ini.SetValue(CONFIG_WORLD, CONFIG_WORLD_RESTRICTED_ZONES, Feature.World.RestrictedZones.ToString());

                // Misc
                ini.SetValue(CONFIG_MISC, CONFIG_MISC_PORTABLE_RADIO, Feature.Misc.PortableRadio.ToString());
                ini.SetValue(CONFIG_MISC, CONFIG_MISC_HIDE_HUD, Feature.Misc.HideHud.ToString());

                // Language
                ini.SetValue(CONFIG_LANGUAGE, CONFIG_LANGUAGE_VALUE, Trainer.LanguageCode.ToString());

                ini.Save();

                if (showNotification) Utils.ShowNotificationAboveMap(GlobalConst.Message.CONFIGURATION_SAVED);
            }
            catch
            {
            }
        }