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); }
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); 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); }
static ProcessStartInfo BuildProcessStartInfo(LaunchGameInfoBase spec, IEnumerable<string> args) => new ProcessStartInfoBuilder(Common.Paths.ServiceExePath, args.CombineParameters()) { WorkingDirectory = spec.WorkingDirectory }.Build();
Task<Process> PerformUpdaterAction(LaunchGameInfoBase spec, IEnumerable<string> args) { var startInfo = BuildProcessStartInfo(spec, args); return LaunchUpdaterProcess(spec, startInfo); }