TrafficAnalyzer: fix for empty payloads and file output

This commit is contained in:
xeon 2024-02-20 00:30:55 +03:00
parent 86ad11723b
commit 4a4fd0033d

View file

@ -10,7 +10,7 @@ internal static class Program
private const string ProtoNamespace = "Protocol"; private const string ProtoNamespace = "Protocol";
private const string MessageParserProperty = "Parser"; private const string MessageParserProperty = "Parser";
private static readonly DumpOptions s_objectDumperOpts = new() { DumpStyle = DumpStyle.CSharp, IndentSize = 4, IndentChar = ' ' }; private static readonly DumpOptions s_objectDumperOpts = new() { DumpStyle = DumpStyle.CSharp, IndentSize = 4, IndentChar = ' ', IgnoreDefaultValues = true };
private static void Main(string[] args) private static void Main(string[] args)
{ {
@ -21,7 +21,7 @@ internal static class Program
string? idInput; string? idInput;
string? payloadInput; string? payloadInput;
while (!string.IsNullOrEmpty(idInput = Console.ReadLine()) && !string.IsNullOrEmpty(payloadInput = Console.ReadLine())) while (!string.IsNullOrEmpty(idInput = Console.ReadLine()) && (payloadInput = Console.ReadLine()) != null)
{ {
int messageId = int.Parse(idInput); int messageId = int.Parse(idInput);
byte[] payload = Convert.FromHexString(payloadInput); byte[] payload = Convert.FromHexString(payloadInput);
@ -29,8 +29,6 @@ internal static class Program
inList.Add(Tuple.Create(messageId, payload)); inList.Add(Tuple.Create(messageId, payload));
} }
Console.Clear();
foreach ((int messageId, byte[] payload) in inList) foreach ((int messageId, byte[] payload) in inList)
{ {
string messageName = ((MessageId)messageId).ToString(); string messageName = ((MessageId)messageId).ToString();