Example #1
0
        private void RunInner()
        {
            AppIdStarter.CleanUpForOthers();

            SteamRunningHelper.EnsureSteamIsRunning(RunSteamIfNeeded, false);
            SetAcX86Param();

            if (!IsAssettoCorsaRunning)
            {
                TryToRunAssettoCorsa();
                throw new InformativeException("Running AssettoCorsa.exe is required", "You’re using Module Starter, it works only though original launcher.");
            }

            var backdoor = BackdoorFilename;

            if (!File.Exists(backdoor))
            {
                throw new InformativeException("Connection file is missing", "Make sure UI module is working properly.");
            }

            RaisePreviewRunEvent(AcsFilename);
            IniFile.Write(backdoor, "COMMAND", "CURRENT", JsonConvert.SerializeObject(new {
                name = @"start"
            }).ToBase64());
            Thread.Sleep(2000);

            if (new IniFile(backdoor)["COMMAND"].GetNonEmpty("CURRENT") != null)
            {
                throw new InformativeException("UI module does not respond", "Make sure UI module is working properly.");
            }
        }
Example #2
0
        public override void Run()
        {
            AppIdStarter.CleanUpForOthers();
            SteamRunningHelper.EnsureSteamIsRunning(RunSteamIfNeeded, false);
            InstallSidePassage();

            var passage = EstablishConnection();

            if (passage == null)
            {
                throw new InformativeException("Can’t connect to side passage",
                                               "Please, make sure AC Service  (replacement for AssettoCorsa.exe — don’t worry, original file is renamed to AssettoCorsa_original.exe, and you can always restore it) is running well or switch starters.");
            }

            RaisePreviewRunEvent(AcsFilename);
            passage.Start(AcsName);
        }
Example #3
0
        public override Task RunAsync(CancellationToken cancellation)
        {
            AppIdStarter.CleanUpForOthers();
            switch (CheckVersion())
            {
            case Mode.DefaultMode:
                return(Task.Run(() => RunInner(), cancellation));

            case Mode.AcServiceMode:
                return(AcsStarterFactory.PrepareCreated(new SidePassageStarter()).RunAsync(cancellation));

            case Mode.CmMode:
                return(AcsStarterFactory.PrepareCreated(new CmStarter()).RunAsync(cancellation));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #4
0
        public override void Run()
        {
            AppIdStarter.CleanUpForOthers();
            switch (CheckVersion())
            {
            case Mode.DefaultMode:
                RunInner();
                break;

            case Mode.AcServiceMode:
                AcsStarterFactory.PrepareCreated(new SidePassageStarter()).Run();
                break;

            case Mode.CmMode:
                AcsStarterFactory.PrepareCreated(new CmStarter()).Run();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #5
0
        public override async Task RunAsync(CancellationToken cancellation)
        {
            AppIdStarter.CleanUpForOthers();
            await Task.Run(() => SteamRunningHelper.EnsureSteamIsRunning(RunSteamIfNeeded, false));

            new IniFile(AcPaths.GetRaceIniFilename())
            {
                ["AUTOSPAWN"] =
                {
                    ["ACTIVE"]       = true,
                    ["__CM_SERVICE"] = true
                }
            }.Save();

            await Task.Run(() => InstallSidePassage());

            if (cancellation.IsCancellationRequested)
            {
                return;
            }

            var passage = await EstablishConnectionAsync(cancellation);

            if (cancellation.IsCancellationRequested)
            {
                return;
            }

            if (passage == null)
            {
                throw new InformativeException("Can’t connect to side passage", "Please, make sure AC Service is running well or switch starters.");
            }

            RaisePreviewRunEvent(AcsFilename);
            passage.Start(AcsName);
        }