async Task <Process> LaunchUpdaterProcess(LaunchGameInfoBase spec, ProcessStartInfo startInfo)
        {
            LogGameInfo(spec);
            LogStartupInfo(startInfo);
            if (spec.WaitForExit)
            {
                // TODO: Problem; WaitForExit actually doesnt stop after the child process is exited, but also all i'ts child processes>?!
                if (spec.LaunchAsAdministrator)
                {
                    await LaunchAsAdmin(startInfo).ConfigureAwait(false);
                }
                else
                {
                    var lResult = await LaunchNormally(startInfo).ConfigureAwait(false);

                    try {
                        var p    = Process.GetProcessById(lResult.ProcessId);
                        var path = Tools.ProcessManager.Management.GetProcessPath(lResult.ProcessId);
                        if ((path != null) && path.Equals(spec.ExpectedExecutable))
                        {
                            return(p);
                        }
                    } catch (ArgumentException) {}
                }
            }
            else
            {
                using (var p = _processManager.Start(startInfo)) {}
            }
            var procName = spec.ExpectedExecutable.FileNameWithoutExtension;

            return(await FindGameProcess(procName).ConfigureAwait(false));
        }
 static ProcessStartInfo BuildProcessStartInfo(LaunchGameInfoBase spec, IEnumerable <string> args)
 => new ProcessStartInfoBuilder(Common.Paths.ServiceExePath,
                                args.CombineParameters())
 {
     //AsAdministrator = spec.LaunchAsAdministrator,
     WorkingDirectory = Common.Paths.ServiceExePath.ParentDirectoryPath
 }.Build();
示例#3
0
 void LogGameInfo(LaunchGameInfoBase spec)
 {
     // TODO: Par file logging... needs RV specific support..
     this.Logger()
     .Info("Launching the game: {0} from {1}, with: {2}. AsAdmin: {3}. Expecting: {4}", spec.LaunchExecutable,
           spec.WorkingDirectory, spec.StartupParameters.CombineParameters(), spec.LaunchAsAdministrator,
           spec.ExpectedExecutable);
 }
示例#4
0
        async Task <Process> LaunchUpdaterProcess(LaunchGameInfoBase spec, ProcessStartInfo startInfo)
        {
            LogGameInfo(spec);
            LogStartupInfo(startInfo);
            var lInfo = new BasicLaunchInfo(startInfo);

            if (spec.WaitForExit)
            {
                await(spec.LaunchAsAdministrator ? _processManager.LaunchElevatedAsync(lInfo) : _processManager.LaunchAsync(lInfo)).ConfigureAwait(false);
            }
            else
            {
                using (var p = spec.LaunchAsAdministrator ? _processManager.StartElevated(startInfo) : _processManager.Start(startInfo)) { }
            }

            var procName = spec.ExpectedExecutable.FileNameWithoutExtension;

            return(await FindGameProcess(procName).ConfigureAwait(false));
        }
 protected SULaunchGameArgumentsBuilder(LaunchGameInfoBase spec)
 {
     if (spec == null)
     {
         throw new ArgumentNullException(nameof(spec));
     }
     if (!(spec.LaunchExecutable != null))
     {
         throw new ArgumentNullException("spec.LaunchExecutable != null");
     }
     if (!(spec.WorkingDirectory != null))
     {
         throw new ArgumentNullException("spec.WorkingDirectory != null");
     }
     if (!(spec.StartupParameters != null))
     {
         throw new ArgumentNullException("spec.StartupParameters != null");
     }
     Spec = spec;
 }
示例#6
0
 static ProcessStartInfo BuildProcessStartInfo(LaunchGameInfoBase spec, IEnumerable <string> args)
 => new ProcessStartInfoBuilder(Common.Paths.ServiceExePath,
                                args.CombineParameters())
 {
     WorkingDirectory = spec.WorkingDirectory
 }.Build();
示例#7
0
        Task <Process> PerformUpdaterAction(LaunchGameInfoBase spec, IEnumerable <string> args)
        {
            var startInfo = BuildProcessStartInfo(spec, args);

            return(LaunchUpdaterProcess(spec, startInfo));
        }
 public static GameLauncherProcessInternal.GameLauncher.GameLaunchSpec ToLaunchSpec(this LaunchGameInfoBase info)
 => new GameLauncherProcessInternal.GameLauncher.GameLaunchSpec
 {
     GamePath = info.LaunchExecutable.ToString(),
     WorkingDirectory = info.WorkingDirectory.ToString(),
     SteamPath        = SteamPathHelper.SteamPath,
     Arguments        = info.StartupParameters.CombineParameters(),
     Priority         = info.Priority,
     Affinity         = info.Affinity
 };