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)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|