public void Initialize(string filePath) { var matchInfo = "Unable to read match information"; var headerResult = DemoHeaderParser.ParseHeader(filePath) .OnSuccess(header => matchInfo = $"{header.MapName} - {DemoHeaderParser.GetDemoSource(header.ServerName).Name}"); if (headerResult.IsFailure) { return; } FilePath = filePath; transform.Find("TextContainer/Text").GetComponent <Text>().text = $"{matchInfo} | {Path.GetFileName(filePath)}"; }
public static IDemoEventHandler GetEventsHandler(string filePath, Parser parser) { var header = DemoHeaderParser.ParseHeader(filePath); var source = DemoHeaderParser.GetDemoSource(header.Value.ServerName); switch (source.Identifier) { case "esea": Debug.Log("ESEA demo events handler"); return(new EseaEventsHandler(parser)); case "faceit": Debug.Log("FACEIT demo events handler"); return(new FaceItEventsHandler(parser)); default: Debug.Log($"{source.Identifier} ({source.Name}) - default events handler"); return(new ValveDemoEventsHandler(parser)); } }