2024-08-14 12:13:00 +00:00
|
|
|
|
using CodexPlugin.OverwatchSupport;
|
|
|
|
|
using Logging;
|
2024-08-06 13:56:42 +00:00
|
|
|
|
using OverwatchTranscript;
|
|
|
|
|
using TranscriptAnalysis;
|
|
|
|
|
|
|
|
|
|
public static class Program
|
|
|
|
|
{
|
2024-08-07 09:18:40 +00:00
|
|
|
|
private static readonly ILog log = new ConsoleLog();
|
2024-08-06 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
public static void Main(string[] args)
|
|
|
|
|
{
|
2024-08-08 07:39:20 +00:00
|
|
|
|
//args = new[] { "D:\\Projects\\cs-codex-dist-tests\\Tests\\CodexTests\\bin\\Debug\\net7.0\\CodexTestLogs\\2024-08\\06\\08-24-45Z_ThreeClientTest\\SwarmTest_SwarmTest.owts" };
|
2024-08-06 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
Log("Transcript Analysis");
|
|
|
|
|
if (!args.Any())
|
|
|
|
|
{
|
|
|
|
|
Log("Please pass a .owts file");
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(args[0]))
|
|
|
|
|
{
|
|
|
|
|
Log("File doesn't exist: " + args[0]);
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var reader = OpenReader(args[0]);
|
|
|
|
|
AppDomain.CurrentDomain.ProcessExit += (e, s) =>
|
|
|
|
|
{
|
|
|
|
|
CloseReader(reader);
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-14 12:13:00 +00:00
|
|
|
|
var header = reader.GetHeader<OverwatchCodexHeader>("cdx_h");
|
|
|
|
|
var receivers = new ReceiverSet(log, reader, header);
|
2024-08-07 09:18:40 +00:00
|
|
|
|
receivers.InitAll();
|
2024-08-06 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
var processor = new Processor(log, reader);
|
|
|
|
|
processor.RunAll();
|
|
|
|
|
|
2024-08-07 09:18:40 +00:00
|
|
|
|
receivers.FinishAll();
|
2024-08-06 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
CloseReader(reader);
|
|
|
|
|
Log("Done.");
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static ITranscriptReader OpenReader(string filepath)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Log($"Opening: '{filepath}'");
|
|
|
|
|
return Transcript.NewReader(filepath);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Log("Failed to open file for reading: " + ex);
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
Environment.Exit(1);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void CloseReader(ITranscriptReader reader)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Log("Closing...");
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Log("Failed to close reader: " + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Log(string msg)
|
|
|
|
|
{
|
|
|
|
|
log.Log(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|