diff --git a/Program.cs b/Program.cs index 6cb7331..9ffaae2 100644 --- a/Program.cs +++ b/Program.cs @@ -42,8 +42,9 @@ namespace V2GProtocol if (showHeader) { - Console.WriteLine("=== V2G Transfer Protocol Decoder/Encoder ==="); - Console.WriteLine("ISO 15118-2 / DIN SPEC 70121 / SAP Protocol"); + Console.WriteLine("=== V2G Transfer Protocol Decoder/Encoder"); + Console.WriteLine("=== ISO 15118-2 / DIN SPEC 70121 / SAP Protocol"); + Console.WriteLine("=== made by [tindevil82@gmail.com]"); Console.WriteLine(); } @@ -136,7 +137,7 @@ namespace V2GProtocol else { Console.WriteLine($"Error: Unknown option or file not found: {args[0]}"); - ShowUsage(); + //ShowUsage(); } } catch (Exception ex) @@ -166,16 +167,9 @@ namespace V2GProtocol Console.WriteLine("Pipe Usage:"); Console.WriteLine(" type file.xml | V2GDecoder.exe --encode # Pipe XML file to encode"); Console.WriteLine(" echo \"hex_string\" | V2GDecoder.exe --decode # Pipe hex string to decode"); + Console.WriteLine("Example:"); + Console.WriteLine("V2GDecoder.exe 01FE80010000001E809802104142423030303831908C0C0C0E0C51E020256968C0C0C0C0C080 --decode"); Console.WriteLine(); - Console.WriteLine("Examples:"); - Console.WriteLine(" V2GDecoder.exe data/dump2.dump # Full analysis of hex dump"); - Console.WriteLine(" V2GDecoder.exe data/test.hex # Auto-decode hex to XML"); - Console.WriteLine(" V2GDecoder.exe data/encode0.xml # Auto-encode XML to EXI"); - Console.WriteLine(" V2GDecoder.exe -d \"8098021050908C0C0C0E0C5211003200\" # Decode hex string"); - Console.WriteLine(" V2GDecoder.exe data/test.dat --decode # Decode unknown file type"); - Console.WriteLine(" V2GDecoder.exe data/data0.xml -out data0.hex # Encode to binary file"); - Console.WriteLine(" V2GDecoder.exe --decode data.hex -out out.xml # Decode to XML file"); - Console.WriteLine(" type data\\encode0.xml | V2GDecoder.exe -e # Pipe XML to encode"); } static string? GetOutputFilename(string[] args) @@ -245,10 +239,8 @@ namespace V2GProtocol } else if (extension == ".hex") { - // Plain hex file (pure hex string) - string fileContent = File.ReadAllText(input).Trim(); - fileContent = fileContent.Replace(" ", "").Replace("-", "").Replace("0x", "").Replace("\n", "").Replace("\r", ""); - exiBytes = Convert.FromHexString(fileContent); + // Binary hex file + exiBytes = File.ReadAllBytes(input); } else if (extension == ".txt") {