public HighlightJSON GetHighlight(string file) { HighlightReader reader = HighlightReader.FromFile(file); HighlightJSON output = new HighlightJSON { PlayerID = reader.Data.PlayerId, Flags = reader.Data.Flags.ToString(), HeroInfo = new List <HeroInfoJSON>(), HighlightInfo = new List <HighlightInfoJSON>(), UUID = reader.Data.Info[0]?.UUID.ToString() }; ulong mapMetadataKey = (reader.Data.MapDataKey & ~0xFFFFFFFF00000000ul) | 0x0790000000000000ul; output.Map = GetMapName(mapMetadataKey); foreach (Common.HeroInfo heroInfo in reader.Data.HeroInfo) { output.HeroInfo.Add(GetHeroInfo(heroInfo)); } foreach (Highlight.HighlightInfoNew infoNew in reader.Data.Info) { output.HighlightInfo.Add(GetHighlightInfo(infoNew)); } output.Replay = GetReplay(reader.Data.Replay); output.Gamemode = GetGamemode(reader.Data.Gamemode); return(output); }
public HighlightJSON GetHighlight(string file) { tePlayerHighlight playerHighlight = new tePlayerHighlight(File.OpenRead(file)); HighlightJSON output = new HighlightJSON { PlayerID = playerHighlight.PlayerId, Flags = playerHighlight.Flags.ToString(), HeroInfo = new List <HeroInfoJSON>(), HighlightInfo = new List <HighlightInfoJSON>(), UUID = playerHighlight.Info.FirstOrDefault()?.UUID.Value.ToString() }; ulong mapHeaderGuid = (playerHighlight.Map & ~0xFFFFFFFF00000000ul) | 0x0790000000000000ul; output.Map = GetMapName(mapHeaderGuid); foreach (HeroData heroInfo in playerHighlight.Heroes) { output.HeroInfo.Add(GetHeroInfo(heroInfo)); } foreach (tePlayerHighlight.HighlightInfo infoNew in playerHighlight.Info) { output.HighlightInfo.Add(GetHighlightInfo(infoNew)); } output.Replay = GetReplay(new tePlayerReplay(playerHighlight.Replay)); output.GameMode = GetGamemode(playerHighlight.GameMode); return(output); }
private void timerHighLight_Tick(object sender, EventArgs e) { TextRange tr = new TextRange(rtbTextEditor.Document.ContentStart, rtbTextEditor.Document.ContentEnd); string str = tr.Text; rtbTextEditor.AppendText(HighlightJSON.SyntaxHighlightJson(str)); }