Пример #1
0
        private static InitializationFile initialiseFile(string filepath)
        {
            InitializationFile ini = new InitializationFile(filepath);

            ini.Create();
            return(ini);
        }
Пример #2
0
            public static InitializationFile initialiseFile()
            {
                InitializationFile ini = new InitializationFile("plugins/LSPDFR/Motorcade.ini");

                ini.Create();
                return(ini);
            }
Пример #3
0
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/British Policing Script.ini");

            ini.Create();
            try
            {
                ToggleMenuKey                   = (Keys)kc.ConvertFromString(ini.ReadString("General", "ToggleMenuKey", "F9"));
                ToggleMenuModifierKey           = (Keys)kc.ConvertFromString(ini.ReadString("General", "ToggleMenuModifierKey", "None"));
                FailtostopEnabled               = ini.ReadBoolean("Callouts", "FailToStopEnabled", true);
                FailtostopFrequency             = ini.ReadInt32("Callouts", "FailToStopFrequency", 2);
                ANPRHitEnabled                  = ini.ReadBoolean("Callouts", "ANPRHitEnabled", true);
                ANPRHitFrequency                = ini.ReadInt32("Callouts", "ANPRHitFrequency", 2);
                TWOCEnabled                     = ini.ReadBoolean("Callouts", "TWOCEnabled", true);
                TWOCFrequency                   = ini.ReadInt32("Callouts", "TWOCFrequency", 2);
                CourtSystem.RealisticCourtDates = ini.ReadBoolean("General", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading British Policing Script INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading British Policing Script INI file. Loading defaults");
            }
            BetaCheck();
        }
Пример #4
0
        private static InitializationFile InitializeFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/BackWeapon.ini");

            ini.Create();
            return(ini);
        }
        public static InitializationFile initialiseFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/Traffic Policer.ini");

            ini.Create();
            return(ini);
        }
Пример #6
0
        internal static void LoadSettings()
        {
            Game.LogTrivial("Loading Config file from UnitedCallouts by sEbi3");
            var path = "Plugins/LSPDFR/UnitedCallouts.ini";
            var ini  = new InitializationFile(path);

            ini.Create();
            Burglary                = ini.ReadBoolean("Settings", "Burglary", true);
            ArrestWarrant           = ini.ReadBoolean("Settings", "ArrestWarrant", true);
            RobberyHL               = ini.ReadBoolean("Settings", "RobberyHL", true);
            StolenEmergencyVehicle  = ini.ReadBoolean("Settings", "StolenEmergencyVehicle", true);
            StolenEmergencyVehicle2 = ini.ReadBoolean("Settings", "StolenEmergencyVehicle2", true);
            DrugDealer              = ini.ReadBoolean("Settings", "DrugDealer", true);
            DrugDeal                = ini.ReadBoolean("Settings", "DrugDeal", true);
            KillerClownWasSeen      = ini.ReadBoolean("Settings", "KillerClownWasSeen", true);
            Fighting                = ini.ReadBoolean("Settings", "Fighting", true);
            PersonWithKnife         = ini.ReadBoolean("Settings", "PersonWithKnife", true);
            StolenBus               = ini.ReadBoolean("Settings", "StolenBus", true);
            StolenTruck             = ini.ReadBoolean("Settings", "StolenTruck", true);
            MoneyTruckIsRobbed      = ini.ReadBoolean("Settings", "MoneyTruckIsRobbed", true);
            troublemaker            = ini.ReadBoolean("Settings", "troublemaker", true);
            CarTrade                = ini.ReadBoolean("Settings", "CarTrade", true);
            ArmoredPerson           = ini.ReadBoolean("Settings", "ArmoredPerson", true);
            ShotsFired              = ini.ReadBoolean("Settings", "ShotsFired", true);
            Bicycle       = ini.ReadBoolean("Settings", "Bicycle", true);
            WelfareCheck  = ini.ReadBoolean("Settings", "WelfareCheck", true);
            K9Backup      = ini.ReadBoolean("Settings", "K9Backup", true);
            store         = ini.ReadBoolean("Settings", "store", true);
            TrafficBackup = ini.ReadBoolean("Settings", "TrafficBackup", true);
            Hostages      = ini.ReadBoolean("Settings", "Hostages", true);
            EndCall       = ini.ReadEnum("Keys", "EndCall", Keys.End);
            Dialog        = ini.ReadEnum("Keys", "Dialog", Keys.Y);
        }
Пример #7
0
        //INI

        public static InitializationFile InitializeFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/Arrest Manager+.ini");

            ini.Create();
            return(ini);
        }
Пример #8
0
        /// <summary>
        /// Setup ini file for LSPDE
        /// </summary>
        /// <returns></returns>
        private InitializationFile InitialiseFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR Enhancer Config/LSPDFREnhancer.ini");

            ini.Create();
            return(ini);
        }
Пример #9
0
 /// <summary>
 /// In this method, we load up the .ini file so other methods can use it.
 /// </summary>
 /// <returns></returns>
 public static InitializationFile initialiseFile()
 {
     //InitializationFile is a Rage class.
     InitializationFile ini = new InitializationFile("Plugins/IniFileDemo.ini");
     ini.Create();
     return ini;
 }
Пример #10
0
        public static InitializationFile initialiseFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/RandomCallouts.ini");

            ini.Create();
            return(ini);
        }
        private static InitializationFile GetInitializationFile()
        {
            var ini = new InitializationFile("Plugins/LSPDFR/PursuitOnTheFly.ini");

            ini.Create();
            return(ini);
        }
Пример #12
0
        private static void CreateCfg()
        {
            mCfgFile.Create();

            Logger.LogTrivial("Filling config file with default settings...");
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.ToggleKey.ToString(), Keys.F8.ToString());
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.ToggleKeyModifier.ToString(), Keys.None.ToString());
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.PlayAlertSound.ToString(), true.ToString());
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.PlayScanSound.ToString(), true.ToString());
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.AutoDisableOnTrafficStops.ToString(), true.ToString());
            mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.AutoDisableOnPursuits.ToString(), true.ToString());
            //mCfgFile.Write(ECfgSections.SETTINGS.ToString(), ESettings.BetaKey.ToString(), "YourBetaKeyHere");

            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.CameraDegreesFOV.ToString(), cCameraDegreesFOV);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.CameraRange.ToString(), cCameraRange);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.CameraMinimum.ToString(), cCameraMinRange);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.DriverFrontAngle.ToString(), cDriverFrontAngle);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.DriverRearAngle.ToString(), cDriverRearAngle);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.PassengerRearAngle.ToString(), cPassengerRearAngle);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.PassengerFrontAngle.ToString(), cPassengerFrontAngle);
            mCfgFile.Write(ECfgSections.CAMERAS.ToString(), ECameras.VehicleRescanBuffer.ToString(), cVehicleRescanBuffer);

            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.SecondsBetweenAlerts.ToString(), cSecondsBetweenAlerts);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.ProbabilityOfAlerts.ToString(), cProbabilityOfAlerts);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.StolenVehicleWeight.ToString(), cDefaultStolenVehicleWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.OwnerWantedWeight.ToString(), cDefaultOwnerWantedWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.OwnerLicenseSuspendedWeight.ToString(), cDefaultOwnerLicenseSuspendedWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.OwnerLicenseExpiredWeight.ToString(), cDefaultOwnerLicenseExpiredWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.UnregisteredVehicleWeight.ToString(), cDefaultUnregisteredVehicleWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.RegisrationExpiredWeight.ToString(), cDefaultRegisrationExpiredWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.NoInsuranceWeight.ToString(), cDefaultNoInsuranceWeight);
            mCfgFile.Write(ECfgSections.ALERTS.ToString(), EAlerts.InsuranceExpiredWeight.ToString(), cDefaultInsuranceExpiredWeight);
        }
Пример #13
0
        internal static void CreateINIFile()
        {
            ini_file.Create();
            ini_file.Write("SETTINGS", "LoginName", "OfficerHotStuff");
            ini_file.Write("SETTINGS", "LoginPass", "DoNuTz");
            ini_file.Write("SETTINGS", "SkipLogin", "false");
            ini_file.Write("SETTINGS", "UnitNumber", "1-A-12");
            ini_file.Write("SETTINGS", "FontSize", 16);
            ini_file.Write("SETTINGS", "FontName", "Microsoft Sans Serif");
            ini_file.Write("SETTINGS", "RandomHistoryRecords", "true");

            ini_file.Write("KEYBINDINGS", "OpenComputerPlusKey", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusModifierKey", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerButton", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerModifierButton", "None");

            ini_file.Write("KEYBINDINGS", "CloseComputerPlusKey", "None");
            ini_file.Write("KEYBINDINGS", "CloseComputerPlusModifierKey", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerModifierButton", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerModifierButton", "None");

            ini_file.Write("KEYBINDINGS", "OpenSimpleNotepadKey", "None");
            ini_file.Write("KEYBINDINGS", "OpenSimpleNotepadModifierKey", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerModifierButton", "None");
            ini_file.Write("KEYBINDINGS", "OpenComputerPlusControllerModifierButton", "None");

            ini_file.Write("KEYBINDINGS", "GiveCitationsToPedKey", "None");
            ini_file.Write("KEYBINDINGS", "GiveCitationsToPedModifierKey", "None");
            ini_file.Write("KEYBINDINGS", "GiveCitationsToPedControllerButton", "None");
            ini_file.Write("KEYBINDINGS", "GiveCitationsToPedControllerModifierButton", "None");
        }
Пример #14
0
        internal static void GetIni()
        {
            KeysConverter kc = new KeysConverter();

            InitializationFile ini = new InitializationFile("Plugins/lspdfr/Officer_Status_Plugin.ini");

            ini.Create();

            string menuKey = ini.ReadString("KeyBindings", "menuKey", "F7");

            Globals.rank      = ini.ReadString("Officer", "rank", "CPT");
            Globals.firstName = ini.ReadString("Officer", "firstName", "Officer");
            Globals.lastName  = ini.ReadString("Officer", "lastName", "Pope");
            Globals.unitNum   = ini.ReadString("Officer", "unitNumber", "5H65");

            try
            {
                Globals.firstName = Globals.firstName.Substring(0, 1);
                Globals.Unit      = Globals.rank + " " + Globals.firstName + "." + Globals.lastName + " " + Globals.unitNum;
                Globals.menuKey   = (Keys)kc.ConvertFromString(menuKey);
            }
            catch
            {
                Globals.menuKey = Keys.F7;
                Game.DisplayNotification("~r~Officer Status Plugin: ~w~There was an error reading the .ini file. Setting defaults...");
            }
        }
Пример #15
0
        public static InitializationFile InitializeIni()
        {
            var ini = new InitializationFile(_location, CultureInfo.InvariantCulture, false);

            ini.Create();
            return(ini);
        }
Пример #16
0
 internal static void CreateINIFile()
 {
     ini_file.Create();
     ini_file.Write("SETTINGS", "LoginName", "OfficerHotStuff");
     ini_file.Write("SETTINGS", "LoginPass", "DoNuTz");
     ini_file.Write("SETTINGS", "SkipLogin", "false");
     ini_file.Write("SETTINGS", "UnitNumber", "1-A-12");
 }
        private Configuration()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/RealPolice.ini");

            ini.Create();
            this._Ini           = ini;
            this._KeysConverter = new KeysConverter();
        }
Пример #18
0
        /// <summary>
        /// In this method, we load up the .ini file so other methods can use it.
        /// </summary>
        /// <returns></returns>
        public static InitializationFile initialiseFile()
        {
            //InitializationFile is a Rage class.
            InitializationFile ini = new InitializationFile("Plugins/IniFileDemo.ini");

            ini.Create();
            return(ini);
        }
Пример #19
0
        public static InitializationFile InitialiseFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/Custom Pullover.ini");

            ini.Create();
            // Game.LogTrivial("Custom Pullover: Reading INI file.");
            return(ini);
        }
Пример #20
0
 public IniReader(string file, string cat, string option, string value)
 {
     this.file   = file;
     this.cat    = cat;
     this.option = option;
     this.value  = value;
     ini         = new InitializationFile(file);
     ini.Create();
 }
 private static void GenerateConfig()
 {
     configuration = new Configuration(2);
     InitializationFile.Create();
     InitializationFile.Write("Main", "Version", configuration.Version);
     InitializationFile.Write("Main", "DefaultDifficulty", configuration.DefaultDifficulty);
     InitializationFile.Write("Main", "LoopInterval", configuration.ProcessInterval);
     InitializationFile.Write("Main", "Riot", configuration.Riot);
     InitializationFile.Write("Event", "RequirementChance", configuration.EventRequirement);
     InitializationFile.Write("Event", "MaxValue", configuration.EventMax);
     InitializationFile.Write("Event", "MinimalValue", configuration.EventMinimal);
 }
Пример #22
0
 private static void loadActiveELSModels()
 {
     if (File.Exists("ELS.ini") && File.Exists("ELS.asi"))
     {
         InitializationFile elsini = new InitializationFile("ELS.ini");
         elsini.Create();
         string        vcffolder = elsini.ReadString("ADMIN", "VcfContainerFolder");
         List <string> vcffiles  = Directory.EnumerateFiles("ELS/" + vcffolder, "*.xml", SearchOption.TopDirectoryOnly).ToList();
         DisabledModels = vcffiles.Select(x => new Model(Path.GetFileNameWithoutExtension(x))).ToArray();
         Game.LogTrivial("Siren Mastery detected ELS models with an active VCF:");
         foreach (Model m in DisabledModels)
         {
             Game.LogTrivial(m.Name);
         }
         Game.LogTrivial("-END-");
     }
 }
Пример #23
0
        // Token: 0x06000024 RID: 36 RVA: 0x000054A8 File Offset: 0x000036A8
        public override void Initialize()
        {
            Game.Console.Print("Loading LSPS config files...");
            string      productVersion  = FileVersionInfo.GetVersionInfo("RAGEPluginHook.exe").ProductVersion;
            GameConsole console         = Game.Console;
            string      str             = "RPH version ";
            string      str2            = productVersion;
            string      str3            = " + game version ";
            Version     productVersion2 = Game.ProductVersion;

            console.Print(str + str2 + str3 + ((productVersion2 != null) ? productVersion2.ToString() : null));
            if (!File.Exists("Plugins/LSPDFR/ProtectionSquad.ini"))
            {
                Game.DisplayNotification("~r~Unable to find the file : ProtectionSquad.ini. Please reinstall the plugin.");
                Game.LogTrivial("Unable to find ProtectionSquad.ini on Plugins/LSPDFR.");
                throw new FileNotFoundException();
            }
            Game.Console.Print("Fetching config files...");
            InitializationFile initializationFile = new InitializationFile("Plugins/LSPDFR/ProtectionSquad.ini");

            initializationFile.Create();
            Game.Console.Print("Reading .ini file...");
            Main.vPatrol1   = initializationFile.ReadString("MOTORCADE SETTINGS", "limoModel", null);
            Main.vPatrol2   = initializationFile.ReadString("MOTORCADE SETTINGS", "firstBackupVehicleModel", null);
            Main.vPatrol3   = initializationFile.ReadString("MOTORCADE SETTINGS", "secondBackupVehicleModel", null);
            Main.pedModel1  = initializationFile.ReadString("MOTORCADE SETTINGS", "limoDriver", null);
            Main.pedModel2  = initializationFile.ReadString("MOTORCADE SETTINGS", "firstBackupDriver", null);
            Main.pedModel1  = initializationFile.ReadString("MOTORCADE SETTINGS", "secondBackupDriver", null);
            Main.muteSirens = Convert.ToBoolean(initializationFile.ReadString("MOTORCADE SETTINGS", "muteSirens", null));
            Main.shRisk     = Convert.ToBoolean(initializationFile.ReadString("DIFFICULTY", "DisplayDangerLevel", null));
            Main.shBlips    = Convert.ToBoolean(initializationFile.ReadString("DIFFICULTY", "ShowBlips", null));
            Game.Console.Print(" ");
            Game.Console.Print("                                                 [Los Santos Protection Squad 2.0]");
            Game.Console.Print(" ");
            Game.Console.Print("-> Plugin initialized.");
            Game.Console.Print(" ");
            Functions.OnOnDutyStateChanged += new Functions.OnDutyStateChangedEventHandler(Main.Functions_OnOnDutyStateChanged);
        }
Пример #24
0
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/LSPDFR+.ini");

            ini.Create();
            try
            {
                EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton = ini.ReadEnum <ControllerButtons>("General", "BringUpTrafficStopMenuControllerButton", ControllerButtons.DPadRight);
                EnhancedTrafficStop.BringUpTrafficStopMenuKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "BringUpTrafficStopMenuKey", "E"));
                CourtSystem.OpenCourtMenuKey                        = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuKey", "F9"));
                CourtSystem.OpenCourtMenuModifierKey                = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuModifierKey", "None"));
                EnhancedTrafficStop.EnhancedTrafficStopsEnabled     = ini.ReadBoolean("General", "EnhancedTrafficStopsEnabled", true);
                EnhancedPursuitAI.EnhancedPursuitAIEnabled          = ini.ReadBoolean("General", "EnhancedPursuitAIEnabled", true);
                EnhancedPursuitAI.AutoPursuitBackupEnabled          = ini.ReadBoolean("General", "AutoPursuitBackupEnabled", false);
                EnhancedPursuitAI.OpenPursuitTacticsMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuKey", "Q"));
                EnhancedPursuitAI.OpenPursuitTacticsMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuModifierKey", "LShiftKey"));
                EnhancedPursuitAI.DefaultAutomaticAI                = ini.ReadBoolean("General", "DefaultAutomaticAI", true);

                Offence.maxpoints    = ini.ReadInt32("General", "MaxPoints", 12);
                Offence.pointincstep = ini.ReadInt32("General", "PointsIncrementalStep", 1);
                Offence.maxFine      = ini.ReadInt32("General", "MaxFine", 5000);

                Offence.OpenTicketMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuKey", "Q"));
                Offence.OpenTicketMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuModifierKey", "LShiftKey"));
                Offence.enablePoints = ini.ReadBoolean("General", "EnablePoints", true);

                CourtSystem.RealisticCourtDates = ini.ReadBoolean("OnlyWithoutBritishPolicingScriptInstalled", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading LSPDFR+ INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading LSPDFR+ INI file. Loading defaults");
            }
            BetaCheck();
        }
Пример #25
0
        private static void SetupTextures()
        {
            GeneralIni.Create();
            SetupBackgroundSettings();
            ButtonsPerPage = PositioningIni.ReadInt32("General", "ButtonsPerPage", 4);
            for (int i = 1; i <= ButtonsPerPage; i++)
            {
                if (PositioningIni.DoesKeyExist("Button" + i, "XOffset") && PositioningIni.DoesKeyExist("Button" + i, "YOffset"))
                {
                    int XOffset = PositioningIni.ReadInt32("Button" + i, "XOffset", 0);
                    int YOffset = PositioningIni.ReadInt32("Button" + i, "YOffset", 0);
                    buttonOffsets.Add(new Point(XOffset, YOffset));
                }
                else
                {
                    Albo1125.Common.CommonLibrary.ExtensionMethods.DisplayPopupTextBoxWithConfirmation("PoliceSmartRadio DisplayPositioning.ini Error", "Your UI has set " + ButtonsPerPage + " buttons per page, but has not specified XOffsets and YOffsets for so many buttons. Aborting.", true);
                    return;
                }
            }

            OnFootButtonPages    = SetupButtonPage(onFootXML);
            InVehicleButtonPages = SetupButtonPage(inVehicleXML);
            if (firstTimeLaunch)
            {
                HandleFirstLaunch();
            }
            CurrentButtonPages = OnFootButtonPages;
            CurrentPage        = CurrentButtonPages.Count > 0 ? CurrentButtonPages[0] : new ButtonPage();

            DoneLoadingTextures = true;
            Game.LogTrivial("Police SmartRadio is done loading. Button actions ready to be added.");
            SetupUserGeneralSettings();
            ButtonSelectSound.Load();
            ButtonScrollSound.Load();
            MainLogic();
        }
Пример #26
0
        public static void MainMenuOnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool Checked)
        {
            if (checkboxItem.Text == "Player God Mode")
            {
                UpdateValue = "PlayerGodMode"; EntryPoint.PlayerGodMode = Checked;
            }
            if (checkboxItem.Text == "Vehicle God Mode")
            {
                UpdateValue = "VehicleGodMode"; EntryPoint.VehicleGodMode = Checked;
            }
            if (checkboxItem.Text == "Freeze Weather")
            {
                UpdateValue = "FreezeWeather"; EntryPoint.FreezeWeather = Checked;
            }
            if (checkboxItem.Text == "Snow on Ground")
            {
                UpdateValue = "SnowOnGround"; EntryPoint.SnowOnGround = Checked;
            }
            if (checkboxItem.Text == "Freeze Time")
            {
                UpdateValue = "FreezeTime"; EntryPoint.FreezeTime = Checked;
            }

            InitializationFile ini = new InitializationFile(EntryPoint.INIpath);

            ini.Create();

            try
            {
                ini.Write("RestoreOptions", UpdateValue, Checked);
            }
            catch (Exception e)
            {
                EntryPoint.ErrorLogger(e, "MenuUpdate", "Unable to update INI file.");
            }
        }
Пример #27
0
        internal static void Initalize()
        {
            string pathToFile = "Plugins/LSPDFR/FireyCallouts.ini";
            var    ini        = new InitializationFile(pathToFile);

            ini.Create();

            // Controls
            endKey      = ini.ReadEnum("Controls", "endKey", Keys.Delete);
            dialogueKey = ini.ReadEnum("Controls", "dialogueKey", Keys.Y);

            // Callouts
            burningTruck    = ini.ReadBoolean("Callouts", "burningTruck", true);
            burningGarbage  = ini.ReadBoolean("Callouts", "burningGarbage", true);
            lostFreight     = ini.ReadBoolean("Callouts", "lostFreight", true);
            heliCrash       = ini.ReadBoolean("Callouts", "heliCrash", true);
            planeLanding    = ini.ReadBoolean("Callouts", "planeLanding", true);
            illegalFirework = ini.ReadBoolean("Callouts", "illegalFirework", true);
            structuralFire  = ini.ReadBoolean("Callouts", "structuralFire", true);
            campfire        = ini.ReadBoolean("Callouts", "campfire", true);
            //smokeDetected = ini.ReadBoolean("Callouts", "smokeDetected", false);

            Game.LogTrivial("[FireyCallouts][Init] successfully initialized");
        }
Пример #28
0
        private static void LoadValuesFromIniFile()
        {
            InitializationFile ini = new InitializationFile(INIpath);

            ini.Create();

            try
            {
                //Keyboard ini

                if (ini.DoesKeyExist("Keyboard", "CinematicKey"))
                {
                    CinematicKey = ini.ReadEnum <Keys>("Keyboard", "CinematicKey", Keys.R);
                }
                else
                {
                    ini.Write("Keyboard", "CinematicKey", "R");
                    CinematicKey = Keys.R;
                }

                if (ini.DoesKeyExist("Keyboard", "CinematicModifierKey"))
                {
                    CinematicModifierKey = ini.ReadEnum <Keys>("Keyboard", "CinematicModifierKey", Keys.ControlKey);
                }
                else
                {
                    ini.Write("Keyboard", "CinematicModifierKey", "ControlKey");
                    CinematicModifierKey = Keys.ControlKey;
                }

                // Controller ini

                if (ini.DoesKeyExist("Controller", "CinematicButton"))
                {
                    CinematicButton = ini.ReadEnum <ControllerButtons>("Controller", "CinematicButton", ControllerButtons.None);
                }
                else
                {
                    ini.Write("Controller", "CinematicButton", "None");
                    CinematicButton = ControllerButtons.None;
                }

                if (ini.DoesKeyExist("Controller", "CinematicModifierButton"))
                {
                    CinematicModifierButton = ini.ReadEnum <ControllerButtons>("Controller", "CinematicModifierButton", ControllerButtons.None);
                }
                else
                {
                    ini.Write("Controller", "CinematicModifierButton", "None");
                    CinematicModifierButton = ControllerButtons.None;
                }

                // Other ini

                if (ini.DoesKeyExist("Other", "ShowDebug"))
                {
                    ShowDebug = ini.ReadBoolean("Other", "ShowDebug", false);
                }
                else
                {
                    ini.Write("Other", "ShowDebug", "false");
                    ShowDebug = false;
                }

                Game.LogTrivial("Settings initialisation complete.");
            }
            catch (Exception e)
            {
                ErrorLogger(e, "Initialisation", "Unable to read INI file.");
            }
        }
Пример #29
0
        public static void Initialise()
        {
            //ini stuff

            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/LSPDFR+.ini");

            ini.Create();
            try
            {
                EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton = ini.ReadEnum <ControllerButtons>("General", "BringUpTrafficStopMenuControllerButton", ControllerButtons.DPadRight);
                EnhancedTrafficStop.BringUpTrafficStopMenuKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "BringUpTrafficStopMenuKey", "D7"));

                try
                {
                    stockLSPDFRIni = new InitializationFile(LSPDFRKeyIniPath);
                    string[] stockinicontents = File.ReadAllLines(LSPDFRKeyIniPath);
                    //Alternative INI reading implementation, RPH doesn't work with sectionless INIs.
                    foreach (string line in stockinicontents)
                    {
                        if (line.StartsWith("TRAFFICSTOP_INTERACT_Key="))
                        {
                            stockTrafficStopInteractKey = (Keys)kc.ConvertFromString(line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ModifierKey"))
                        {
                            stockTrafficStopInteractModifierKey = (Keys)kc.ConvertFromString(line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ControllerKey"))
                        {
                            stockTrafficStopInteractControllerButton = (ControllerButtons)Enum.Parse(typeof(ControllerButtons), line.Substring(line.IndexOf('=') + 1));
                        }
                        else if (line.StartsWith("TRAFFICSTOP_INTERACT_ControllerModifierKey"))
                        {
                            stockTrafficStopInteractModifierControllerButton = (ControllerButtons)Enum.Parse(typeof(ControllerButtons), line.Substring(line.IndexOf('=') + 1));
                        }
                    }
                    if ((EnhancedTrafficStop.BringUpTrafficStopMenuKey == stockTrafficStopInteractKey && stockTrafficStopInteractModifierKey == Keys.None) || (EnhancedTrafficStop.BringUpTrafficStopMenuControllerButton == stockTrafficStopInteractControllerButton && stockTrafficStopInteractModifierControllerButton == ControllerButtons.None))
                    {
                        TrafficStopMenuPopup = new Popup("LSPDFR+: Traffic Stop Menu Conflict", "Your LSPDFR+ traffic stop menu keys (plugins/lspdfr/lspdfr+.ini) are the same as the default LSPDFR traffic stop keys (lspdfr/keys.ini TRAFFICSTOP_INTERACT_Key and TRAFFICSTOP_INTERACT_ControllerKey). How would you like to solve this?",
                                                         new List <string>()
                        {
                            "Recommended: Automatically disable the default LSPDFR traffic stop menu keys (this will edit keys.ini TRAFFICSTOP_INTERACT_Key and TRAFFICSTOP_INTERACT_ControllerKey to None)", "I know what I'm doing, I will change the keys in the INIs myself!"
                        }, false, true, TrafficStopMenuCb);
                        TrafficStopMenuPopup.Display();
                    }
                }
                catch (Exception e)
                {
                    Game.LogTrivial($"Failed to determine stock LSPDFR key bind/controller button for traffic stop keys: {e}");
                }

                CourtSystem.OpenCourtMenuKey                        = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuKey", "F9"));
                CourtSystem.OpenCourtMenuModifierKey                = (Keys)kc.ConvertFromString(ini.ReadString("OnlyWithoutBritishPolicingScriptInstalled", "OpenCourtMenuModifierKey", "None"));
                EnhancedTrafficStop.EnhancedTrafficStopsEnabled     = ini.ReadBoolean("General", "EnhancedTrafficStopsEnabled", true);
                EnhancedPursuitAI.EnhancedPursuitAIEnabled          = ini.ReadBoolean("General", "EnhancedPursuitAIEnabled", true);
                EnhancedPursuitAI.AutoPursuitBackupEnabled          = ini.ReadBoolean("General", "AutoPursuitBackupEnabled", false);
                EnhancedPursuitAI.OpenPursuitTacticsMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuKey", "Q"));
                EnhancedPursuitAI.OpenPursuitTacticsMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenPursuitTacticsMenuModifierKey", "LShiftKey"));
                EnhancedPursuitAI.DefaultAutomaticAI                = ini.ReadBoolean("General", "DefaultAutomaticAI", true);

                Offence.maxpoints    = ini.ReadInt32("General", "MaxPoints", 12);
                Offence.pointincstep = ini.ReadInt32("General", "PointsIncrementalStep", 1);
                Offence.maxFine      = ini.ReadInt32("General", "MaxFine", 5000);

                Offence.OpenTicketMenuKey         = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuKey", "Q"));
                Offence.OpenTicketMenuModifierKey = (Keys)kc.ConvertFromString(ini.ReadString("General", "OpenTicketMenuModifierKey", "LShiftKey"));
                Offence.enablePoints = ini.ReadBoolean("General", "EnablePoints", true);

                CourtSystem.RealisticCourtDates = ini.ReadBoolean("OnlyWithoutBritishPolicingScriptInstalled", "RealisticCourtDates", true);
            }
            catch (Exception e)
            {
                Game.LogTrivial(e.ToString());
                Game.LogTrivial("Error loading LSPDFR+ INI file. Loading defaults");
                Game.DisplayNotification("~r~Error loading LSPDFR+ INI file. Loading defaults");
            }
            BetaCheck();
        }
Пример #30
0
        public static void RunConfigCheck()
        {
            InitializationFile iniFile = new InitializationFile(@"Plugins\DashcamV.ini");

            if (!iniFile.Exists())
            {
                iniFile.Create();
                iniFile.Write("SETTINGS", "EnableFilter", false);
                iniFile.Write("SETTINGS", "EnableRemoteView", true);
                iniFile.Write("SETTINGS", "EnableDashcamOnAllViews", false);
                iniFile.Write("SETTINGS", "LayoutStyle", 0);
                iniFile.Write("SETTINGS", "MeasurementSystem", 1);
                iniFile.Write("SETTINGS", "DateFormat", 0);
                iniFile.Write("SETTINGS", "UnitName", "");
                iniFile.Write("CONTROLS", "RemoteViewToggleKey", Keys.E);
                iniFile.Write("CONTROLS", "RemoteViewToggleGamepad", ControllerButtons.LeftThumb);
            }

            Filter            = iniFile.ReadBoolean("SETTINGS", "EnableFilter");
            DashTextOnPOVOnly = iniFile.ReadBoolean("SETTINGS", "EnableDashcamOnAllViews");
            Layout            = iniFile.ReadEnum <LayoutType>("SETTINGS", "LayoutStyle", 0);
            System            = iniFile.ReadEnum <MeasurementType>("SETTINGS", "MeasurementSystem", 0);
            DateFormat        = iniFile.ReadString("SETTINGS", "DateFormat");
            Unit = iniFile.ReadString("SETTINGS", "UnitName");

            _remKeys.Key    = iniFile.ReadEnum <Keys>("CONTROLS", "RemoteViewToggleKey", Keys.E);
            _remBtns.Button = iniFile.ReadEnum <ControllerButtons>("CONTROLS", "RemoteViewToggleGamepad", ControllerButtons.LeftThumb);

            if (!iniFile.ReadBoolean("SETTINGS", "EnableRemoteView", true))
            {
                _remKeys.Key    = Keys.None;
                _remBtns.Button = ControllerButtons.None;
            }

            var sections = iniFile.GetSectionNames();

            foreach (var section in sections)
            {
                if (section.Substring(0, 4).ToLower() == "veh:")
                {
                    var vehName = section.Substring(4).ToLower();

                    var depName  = iniFile.ReadString(section, "Department");
                    var depShort = iniFile.ReadString(section, "Acronym");

                    var arrColour = iniFile.ReadString(section, "Colour").Split(',');
                    var colour    = Color.FromArgb(255, int.Parse(arrColour[0]), int.Parse(arrColour[1]), int.Parse(arrColour[2]));

                    var arrOffset = iniFile.ReadString(section, "Offset").Split(',');
                }
            }
            confVehs = temp.ToArray();

            List <String> temp_confDepName  = new List <String>();
            List <String> temp_confDepAbrv  = new List <String>();
            List <String> temp_confDepNameR = new List <String>();
            List <String> temp_confDepNameG = new List <String>();
            List <String> temp_confDepNameB = new List <String>();
            List <String> temp_confOffset   = new List <String>();

            for (int i = 0; i < confVehs.Length; i++)
            {
                temp_confDepName.Add(iniFile.ReadString("Veh:" + confVehs[i], "Department", "Generic Department"));
                temp_confDepAbrv.Add(iniFile.ReadString("Veh:" + confVehs[i], "Acronym", "GD"));
                String[] rgb = iniFile.ReadString("Veh:" + confVehs[i], "Colour", "255,255,255").Split(',');
                temp_confDepNameR.Add(rgb[0]);
                temp_confDepNameG.Add(rgb[1]);
                temp_confDepNameB.Add(rgb[2]);
                temp_confOffset.Add(iniFile.ReadString("Veh:" + confVehs[i], "Offset", "0,0.75,0.65"));
            }
            confDepName  = temp_confDepName.ToArray();
            confDepAbrv  = temp_confDepAbrv.ToArray();
            confDepNameR = temp_confDepNameR.ToArray();
            confDepNameG = temp_confDepNameG.ToArray();
            confDepNameB = temp_confDepNameB.ToArray();
            confOffset   = temp_confOffset.ToArray();
        }
Пример #31
0
        private static void LoadValuesFromIniFile()
        {
            // string path = "Plugins\\RecovFR.ini";
            InitializationFile ini = new InitializationFile(INIpath);

            ini.Create();

            try
            {
                if (ini.DoesKeyExist("Keybindings", "BackupKey"))
                {
                    BackupKey = ini.ReadEnum <Keys>("Keybindings", "BackupKey", Keys.F12);
                }
                else
                {
                    ini.Write("Keybindings", "BackupKey", "F12");
                    BackupKey = Keys.F12;
                }

                if (ini.DoesKeyExist("Keybindings", "BackupModifierKey"))
                {
                    BackupModifierKey = ini.ReadEnum <Keys>("Keybindings", "BackupModifierKey", Keys.ControlKey);
                }
                else
                {
                    ini.Write("Keybindings", "BackupModifierKey", "ControlKey");
                    BackupModifierKey = Keys.ControlKey;
                }

                if (ini.DoesKeyExist("Keybindings", "RestoreKey"))
                {
                    RestoreKey = ini.ReadEnum <Keys>("Keybindings", "RestoreKey", Keys.F12);
                }
                else
                {
                    ini.Write("Keybindings", "RestoreKey", "F12");
                    RestoreKey = Keys.F12;
                }

                if (ini.DoesKeyExist("Keybindings", "RestoreModifierKey"))
                {
                    RestoreModifierKey = ini.ReadEnum <Keys>("Keybindings", "RestoreModifierKey", Keys.Menu);
                }
                else
                {
                    ini.Write("Keybindings", "RestoreModifierKey", "ControlKey");
                    RestoreModifierKey = Keys.Menu;
                }

                if (ini.DoesKeyExist("Keybindings", "MenuKey"))
                {
                    MenuKey = ini.ReadEnum <Keys>("Keybindings", "MenuKey", Keys.F11);
                }
                else
                {
                    ini.Write("Keybindings", "MenuKey", "F11");
                    MenuKey = Keys.F11;
                }

                if (ini.DoesKeyExist("Keybindings", "MenuModifierKey"))
                {
                    MenuModifierKey = ini.ReadEnum <Keys>("Keybindings", "MenuModifierKey", Keys.None);
                }
                else
                {
                    ini.Write("Keybindings", "MenuModifierKey", "None");
                    MenuModifierKey = Keys.None;
                }

                if (ini.DoesKeyExist("Features", "AutoBackups"))
                {
                    AutoBackups = ini.ReadBoolean("Features", "AutoBackups", false);
                }
                else
                {
                    ini.Write("Features", "AutoBackups", "false");
                    AutoBackups = false;
                }

                if (ini.DoesKeyExist("Features", "AutoBackupInt"))
                {
                    AutoBackupInt = ini.ReadByte("Features", "AutoBackupInt", 60);
                }
                else
                {
                    ini.Write("Features", "AutoBackupInt", "60");
                    AutoBackupInt = 60;
                }

                if (ini.DoesKeyExist("Features", "ShowNotifications"))
                {
                    ShowNotifications = ini.ReadBoolean("Features", "ShowNotifications", false);
                }
                else
                {
                    ini.Write("Features", "ShowNotifications", "false");
                    ShowNotifications = false;
                }

                if (ini.DoesKeyExist("RestoreOptions", "PlayerGodMode"))
                {
                    PlayerGodMode = ini.ReadBoolean("RestoreOptions", "PlayerGodMode", false);
                }
                else
                {
                    ini.Write("RestoreOptions", "PlayerGodMode", "False");
                    PlayerGodMode = false;
                }

                if (ini.DoesKeyExist("RestoreOptions", "VehicleGodMode"))
                {
                    VehicleGodMode = ini.ReadBoolean("RestoreOptions", "VehicleGodMode", false);
                }
                else
                {
                    ini.Write("RestoreOptions", "VehicleGodMode", "false");
                    VehicleGodMode = false;
                }

                if (ini.DoesKeyExist("RestoreOptions", "FreezeWeather"))
                {
                    FreezeWeather = ini.ReadBoolean("RestoreOptions", "FreezeWeather", false);
                }
                else
                {
                    ini.Write("RestoreOptions", "FreezeWeather", "false");
                    FreezeWeather = false;
                }

                if (ini.DoesKeyExist("RestoreOptions", "SnowOnGround"))
                {
                    SnowOnGround = ini.ReadBoolean("RestoreOptions", "SnowOnGround", false);
                }
                else
                {
                    ini.Write("RestoreOptions", "SnowOnGround", "false");
                    SnowOnGround = false;
                }

                if (ini.DoesKeyExist("RestoreOptions", "FreezeTime"))
                {
                    FreezeTime = ini.ReadBoolean("RestoreOptions", "FreezeTime", false);
                }
                else
                {
                    ini.Write("RestoreOptions", "FreezeTime", "false");
                    FreezeTime = false;
                }
                Game.LogTrivial("Settings initialisation complete.");
            }
            catch (Exception e)
            {
                ErrorLogger(e, "Initialisation", "Unable to read INI file.");
            }
        }