public static void Play(LeagueExecutable leagueExe, string replayPath) { if (!File.Exists(replayPath)) { throw new FileNotFoundException($"Replay does not exist"); } // This will throw an exception if exe has issues ExeTools.ValidateLeagueExecutable(leagueExe); // Create the launch arguments, each argument is put in quotes // <replay file path> GameBaseDir=... <other arguments> string launchArgs = $"\"{replayPath}\" " + leagueExe.LaunchArguments + $" \"-Locale={ExeTools.GetLocaleCode(leagueExe.Locale)}\""; ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = leagueExe.TargetPath, Arguments = launchArgs, // The game client uses the working directory to find the data files WorkingDirectory = Path.GetDirectoryName(leagueExe.TargetPath) }; Process game = Process.Start(processStartInfo); game.WaitForExit(); return; }
public static Process PlayReplay(this LeagueExecutable executable, string path) { if (!File.Exists(path)) { throw new FileNotFoundException($"Replay \"{path}\" does not exist"); } // This will throw an exception if exe has issues executable.Validate(); // Create the launch arguments, each argument is put in quotes // <replay file path> GameBaseDir=... <other arguments> string launchArgs = $"\"{path}\" " + executable.LaunchArguments + $" \"-Locale={ExeTools.GetLocaleCode(executable.Locale)}\""; ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = executable.TargetPath, Arguments = launchArgs, // The game client uses the working directory to find the data files WorkingDirectory = Path.GetDirectoryName(executable.TargetPath) }; Process game = Process.Start(processStartInfo); game.EnableRaisingEvents = true; return(game); }