private static string GetSpectatorCommand(SpectatorHost host, string encryptionKey, long matchId, string platformId) { const string fileName = "\"League of Legends.exe\""; const string maestroParameter1 = "8394"; const string maestroParameter2 = "\"LeagueClient.exe\""; const string maestroParameter3 = "\"/path\""; string SpectatorDomain = ResolveSpectatorApiEndpoint(host); string port = "80"; if (host == SpectatorHost.EUNE || host == SpectatorHost.PBE) { port = "8088"; } return(fileName + " " + maestroParameter1 + " " + maestroParameter2 + " " + maestroParameter3 + " " + "spectator " + SpectatorDomain + ":" + port + " " + encryptionKey + " " + matchId.ToString() + " " + platformId + "\""); }
private static string ResolveSpectatorApiEndpoint(SpectatorHost endpoint) { switch (endpoint) { case SpectatorHost.BR: return(ApiLink.Endpoint_Spectator_BR); case SpectatorHost.EUNE: return(ApiLink.Endpoint_Spectator_EUNE); case SpectatorHost.EUW: return(ApiLink.Endpoint_Spectator_EUW); case SpectatorHost.JP: return(ApiLink.Endpoint_Spectator_JP); case SpectatorHost.KR: return(ApiLink.Endpoint_Spectator_KR); case SpectatorHost.LAN: return(ApiLink.Endpoint_Spectator_LAN); case SpectatorHost.LAS: return(ApiLink.Endpoint_Spectator_LAS); case SpectatorHost.NA: return(ApiLink.Endpoint_Spectator_NA); case SpectatorHost.OCE: return(ApiLink.Endpoint_Spectator_OCE); case SpectatorHost.PBE: return(ApiLink.Endpoint_Spectator_PBE); case SpectatorHost.RU: return(ApiLink.Endpoint_Spectator_RU); case SpectatorHost.TR: return(ApiLink.Endpoint_Spectator_TR); } return(""); }
/* * Utility to create a Process which will start the League Client to spectate the given game. */ #region SPECATOR_PROCESS public static System.Diagnostics.Process GetSpectatorProcess(string leagueClientExe, SpectatorHost host, string encryptionKey, long matchId, string platformId) { string arguments = "/C "; arguments += "cd " + GetSolutionClient(leagueClientExe); arguments += "&" + GetSpectatorCommand(host, encryptionKey, matchId, platformId); System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo() { WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden, FileName = "cmd.exe", Arguments = arguments }; process.StartInfo = startInfo; return(process); }