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);
        }
Exemplo n.º 2
0
        public void AddExecutable(LeagueExecutable newExecutable)
        {
            // Validate file
            if (newExecutable == null)
            {
                _log.Warning($"Given Executable is null");
                throw new ArgumentNullException(nameof(newExecutable));
            }

            // Add character to the end of the name if already exists
            string name = newExecutable.Name;

            while (!CheckExecutableName(name))
            {
                name += "+";
            }
            newExecutable.Name = name;

            // Will throw exception if executable is invalid
            newExecutable.Validate();

            Settings.Executables.Add(newExecutable);
        }