Beispiel #1
0
        public static void Main()
        {
            //Initiates Log File
            Log Log = new Log();

            //Checks if .ini file is created.
            Settings.IniCheck();

            //Version check and logging.
            FileVersionInfo rphVer = FileVersionInfo.GetVersionInfo("ragepluginhook.exe");

            Game.LogTrivial("Detected RPH " + rphVer.FileVersion);
            if (rphVer.FileMinorPart < 78)
            {
                Game.LogTrivial("RPH 78+ is required to use this mod");
                "ERROR: RPH 78+ is required but not found".ToLog();
                Game.DisplayNotification($"~y~Unable to load DLS~w~\nRagePluginHook version ~b~78~w~ or later is required, you are on version ~b~{rphVer.FileMinorPart}");
                return;
            }
            AssemblyName pluginInfo = Assembly.GetExecutingAssembly().GetName();

            Game.LogTrivial($"LOADED DLS v{pluginInfo.Version}");

            //Load DLS Models
            dlsModels = Vehicles.GetAllModels();
            "Loaded: DLS Vehicle Configurations".ToLog();

            //Load TAgroups
            tagroups = Vehicles.GetAllTAgroups();
            "Loaded: TAgroups".ToLog();

            //Loads Keys
            Controls.RefreshKeys();
            "Loaded: DLS Keys".ToLog();

            //Loads MPDATA audio
            NativeFunction.Natives.SET_AUDIO_FLAG("LoadMPData", true);

            //If DLS controls lights/sirens on AI vehicles
            AILightsC = Settings.ReadKey("Settings", "AILightsControl").ToBoolean();

            //Creates player controller
            "Loading: DLS - Player Controller".ToLog();
            GameFiber.StartNew(delegate { PlayerController.Process(); }, "DLS - Player Controller");
            "Loaded: DLS - Player Controller".ToLog();

            //Creates special modes managers
            "Loading: DLS - Special Modes Managers".ToLog();
            if (AILightsC)
            {
                GameFiber.StartNew(delegate { SpecialModesManager.ProcessAI(); }, "DLS - Special Modes AI Manager");
            }
            GameFiber.StartNew(delegate { SpecialModesManager.ProcessPlayer(); }, "DLS - Special Modes Player Manager");
            "Loaded: DLS - Special Modes Managers".ToLog();

            //Creates cleanup manager
            "Loading: DLS - Cleanup Manager".ToLog();
            GameFiber.StartNew(delegate { Threads.CleanupManager.Process(); }, "DLS - Cleanup Manager");
            "Loaded: DLS - Cleanup Manager".ToLog();

            //If DLS controls lights/sirens on non-DLS vehicles
            SCforNDLS = Settings.ReadKey("Settings", "SirenControlNonDLS").ToBoolean();

            //If DLS controls the indicators
            IndEnabled = Settings.ReadKey("Settings", "IndEnabled").ToBoolean();

            //If DLS enables brake lights
            BLightsEnabled = Settings.ReadKey("Settings", "BrakeLightsEnabled").ToBoolean();

            //If DLS UI is enabled
            UIEnabled = Settings.ReadKey("Settings", "UIEnabled").ToBoolean();
            if (UIEnabled)
            {
                UIManager.Process();
            }

            //If Siren Kill is enabled
            SirenKill = Settings.ReadKey("Settings", "SirenKill").ToBoolean();
        }