Exemple #1
0
        public void Run()
        {
            SteamRunningHelper.EnsureSteamIsRunning(RunSteamIfNeeded, false);

            _acLauncher       = AcPaths.GetAcLauncherFilename(AcRoot);
            _acLauncherBackup = _acLauncher.ApartFromLast(".exe", StringComparison.OrdinalIgnoreCase) + "_backup_ts.exe";

            if (File.Exists(_acLauncherBackup) && new FileInfo(_acLauncher).Length > ApproximateAcstarterSize)
            {
                File.Move(_acLauncherBackup, _acLauncherBackup.ApartFromLast(".exe", StringComparison.OrdinalIgnoreCase) + "_" + DateTime.Now.Ticks + ".exe");
            }

            if (!File.Exists(_acLauncherBackup))
            {
                File.Move(_acLauncher, _acLauncherBackup);
            }

            if (!File.Exists(_acLauncher))
            {
                File.WriteAllBytes(_acLauncher, Resources.AcStarter);
            }

            PreviewRun?.Invoke(this, new AcsRunEventArgs(Path.Combine(AcRoot, AcsName), Use32BitVersion));
            _launcherProcess = Process.Start(new ProcessStartInfo {
                WorkingDirectory = AcRoot,
                FileName         = Path.GetFileName(_acLauncher),
                Arguments        = $"--first-stage {AcsName}"
            });
        }