public ReplayServer(MFroReplay replay) { this.replay = replay; this.alive = true; try { server = new HttpListener(); server.Prefixes.Add("http://127.0.0.1:" + port + "/observer-mode/rest/consumer/"); server.Start(); } catch { try { AddAddress("http://127.0.0.1:" + port + "/"); } catch { return; } server = new HttpListener(); server.Prefixes.Add("http://127.0.0.1:" + port + "/observer-mode/rest/consumer/"); server.Start(); } new Thread(this.Stopper) { IsBackground = true, Name = "Server Stopper" }.Start(); new Thread(() => { Logger.WriteLine("Starting Spectator Server [ID: {0}]... ".Format(replay.GameId)); try { while (alive) { Handle(server.GetContext()); } } catch { } server.Close(); Logger.WriteLine("Closing Spectator Server"); }) { IsBackground = true, Name = "ServerHandler" }.Start(); var dir = new System.IO.DirectoryInfo(@"C:\Riot Games\League of Legends\RADS\" + @"solutions\lol_game_client_sln\releases\"); var versions = dir.EnumerateDirectories().ToList(); versions.Sort((a, b) => b.Name.CompareTo(a.Name)); ProcessStartInfo info = new ProcessStartInfo(versions[0].FullName + @"\deploy\League of Legends.exe", String.Join(" ", SpectateArgs).Format(replay.MetaData["encryptionKey"], replay.GameId)); info.WorkingDirectory = versions[0].FullName + @"\deploy"; Process.Start(info); }
public ReplayDetails(MFroReplay replay, Window parent) { InitializeComponent(); Owner = parent; WindowStartupLocation = WindowStartupLocation.CenterOwner; JSONObject data = replay.Combine; this.replay = replay; this.gameId = data["gameId"]; int red = 0, blue = 0, redGold = 0, blueGold = 0, redKill = 0, blueKill = 0, redAssist = 0, blueAssist = 0, redDeaths = 0, blueDeaths = 0; foreach (var info in data["players"].Values) { if (info.teamId == 100) { if(info.statistics.win > 0){ BlueOutcome.Content = "Victory"; RedOutcome.Content = "Defeat"; } BluePlayerDetails player = new BluePlayerDetails() { DataContext = new PlayerInfo(info) }; if (info.summonerId == replay.SummonerId) player.Background = person; this.PlayerGrid.Children.Add(player); Grid.SetColumn(player, 0); Grid.SetRow(player, blue++); blueGold += info.statistics.goldEarned; blueKill += info.statistics.championsKilled; blueAssist += info.statistics.assists; blueDeaths += info.statistics.numDeaths; } else { if (info.statistics.win > 0) { BlueOutcome.Content = "Defeat"; RedOutcome.Content = "Victory"; } RedPlayerDetails player = new RedPlayerDetails() { DataContext = new PlayerInfo(info) }; if (info.summonerId == replay.SummonerId) player.Background = person; this.PlayerGrid.Children.Add(player); Grid.SetColumn(player, 1); Grid.SetRow(player, red++); redGold += info.statistics.goldEarned; redKill += info.statistics.championsKilled; redAssist += info.statistics.assists; redDeaths += info.statistics.numDeaths; } } BlueGold.Content = (blueGold * .001).ToString("F1") + "k"; RedGold.Content = (redGold * .001).ToString("F1") + "k"; BlueKDA.Content = blueKill + " / " + blueDeaths + " / " + blueAssist; RedKDA.Content = redKill + " / " + redDeaths + " / " + redAssist; PlayerGrid.Height = (red > blue) ? red * 72 : blue * 72; }
public SummaryData(MFroReplay replay) { dynamic combine = replay.Combine; var player = combine.players[replay.SummonerId.ToString()]; var stats = player.statistics; kills = stats.championsKilled; deaths = stats.numDeaths; assists = stats.assists; win = stats.ContainsKey("win") && stats.win == 1; championId = player.championId; spell1Id = player.spell1Id; spell2Id = player.spell2Id; mapId = combine.mapId; queueId = combine.gameQueueConfigId; gameTime = combine.gameStartTime; gameId = combine.gameId; item0 = stats.item0; item1 = stats.item1; item2 = stats.item2; item3 = stats.item3; item4 = stats.item4; item5 = stats.item5; item6 = stats.item6; }