Add -out option for file output and fix stdin detection logic

- Add -out/-o option to save decode/encode output to files
- Encoded files are saved as binary, console still shows hex strings
- Decoded XML files are saved as text
- Fix stdin detection logic to prioritize command line arguments
- Add missing System.Collections.Generic import for List<string> usage
- File extension auto-processing now supports -out option
- Clean up data folder with renamed files (data0-3.dump/xml)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Arin(asus)
2025-09-07 15:45:04 +09:00
parent f9b17dd7e7
commit fdfab0c666
18 changed files with 237 additions and 121 deletions

View File

@@ -619,13 +619,7 @@ namespace V2GProtocol
{
// 메시지 타입 식별
var messageType = IdentifyV2GMessageType(exiPayload);
sb.AppendLine($"Identified Message Type: {messageType.Type}");
sb.AppendLine($"Message Category: {messageType.Category}");
sb.AppendLine($"Message Description: {messageType.Description}");
sb.AppendLine();
sb.AppendLine("Reconstructed XML from EXI binary:");
sb.AppendLine();
sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
sb.AppendLine("<ns1:V2G_Message xmlns:ns1=\"urn:iso:15118:2:2013:MsgDef\" xmlns:ns2=\"urn:iso:15118:2:2013:MsgHeader\" xmlns:ns3=\"urn:iso:15118:2:2013:MsgBody\" xmlns:ns4=\"urn:iso:15118:2:2013:MsgDataTypes\">");
@@ -653,17 +647,11 @@ namespace V2GProtocol
sb.AppendLine(" </ns1:Body>");
sb.AppendLine("</ns1:V2G_Message>");
sb.AppendLine();
sb.AppendLine("=== Message Analysis ===");
sb.AppendLine($"Message Type: {messageType.Type}");
sb.AppendLine($"Session ID: {sessionID}");
sb.AppendLine($"Category: {messageType.Category}");
sb.AppendLine($"Purpose: {messageType.Description}");
}
catch (Exception ex)
{
sb.AppendLine($"Error decoding EXI: {ex.Message}");
// In case of error, return error message
return $"Error decoding EXI: {ex.Message}";
}
return sb.ToString();