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); }
static ProcessStartInfo BuildProcessStartInfo(LaunchGameInfoBase spec, IEnumerable<string> args) { return new ProcessStartInfoBuilder(Common.Paths.ServiceExePath, args.CombineParameters()) { AsAdministrator = spec.LaunchAsAdministrator, WorkingDirectory = spec.WorkingDirectory.ToString() }.Build(); }
protected SULaunchGameArgumentsBuilder(LaunchGameInfoBase spec) { Contract.Requires<ArgumentNullException>(spec != null); Contract.Requires<ArgumentNullException>(spec.LaunchExecutable != null); Contract.Requires<ArgumentNullException>(spec.WorkingDirectory != null); Contract.Requires<ArgumentNullException>(spec.StartupParameters != null); Spec = spec; }
async Task<Process> LaunchUpdaterProcess(LaunchGameInfoBase spec, ProcessStartInfo startInfo) { LogGameInfo(spec); LogStartupInfo(startInfo); if (spec.WaitForExit) await _processManager.LaunchAsync(new BasicLaunchInfo(startInfo)).ConfigureAwait(false); else using (var p = _processManager.Start(startInfo)) {} var procName = spec.ExpectedExecutable.FileNameWithoutExtension; return await FindGameProcess(procName).ConfigureAwait(false); }
Task<Process> PerformUpdaterAction(LaunchGameInfoBase spec, IEnumerable<string> args) { var startInfo = BuildProcessStartInfo(spec, args); return LaunchUpdaterProcess(spec, startInfo); }