From 4a4fd0033d3f2a0181130f4c4bda32896cf8f4b7 Mon Sep 17 00:00:00 2001 From: xeon Date: Tue, 20 Feb 2024 00:30:55 +0300 Subject: [PATCH] TrafficAnalyzer: fix for empty payloads and file output --- TrafficAnalyzer/Program.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/TrafficAnalyzer/Program.cs b/TrafficAnalyzer/Program.cs index aa4705d..0496a0e 100644 --- a/TrafficAnalyzer/Program.cs +++ b/TrafficAnalyzer/Program.cs @@ -10,7 +10,7 @@ internal static class Program private const string ProtoNamespace = "Protocol"; 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) { @@ -21,7 +21,7 @@ internal static class Program string? idInput; 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); byte[] payload = Convert.FromHexString(payloadInput); @@ -29,8 +29,6 @@ internal static class Program inList.Add(Tuple.Create(messageId, payload)); } - Console.Clear(); - foreach ((int messageId, byte[] payload) in inList) { string messageName = ((MessageId)messageId).ToString();