Refactor helper functions to separate Helper class and translate comments to Korean

- Extract hex conversion functions to new Helper.cs file
- Remove duplicate helper functions from Program.cs and V2GDecoder.cs
- Update all references to use Helper class
- Translate all comments in Program.cs to Korean
- Improve code organization and reusability

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-07 20:08:45 +09:00
parent e09c63080e
commit 7ba42fe215
3 changed files with 83 additions and 74 deletions

View File

@@ -8,18 +8,6 @@ namespace V2GProtocol
{
public class V2GDecoder
{
static byte[] FromHexString(string hexString)
{
if (hexString.Length % 2 != 0)
throw new ArgumentException("Invalid hex string length");
byte[] bytes = new byte[hexString.Length / 2];
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
}
return bytes;
}
private const byte V2G_TP_VERSION = 0x01;
private const byte V2G_TP_INVERSE_VERSION = 0xFE;
@@ -1069,7 +1057,7 @@ namespace V2GProtocol
var sessionId = ExtractValueFromXML(xmlContent, "SessionID");
if (!string.IsNullOrEmpty(sessionId) && sessionId.Length == 16) // 8 bytes as hex
{
var sessionBytes = FromHexString(sessionId);
var sessionBytes = Helper.FromHexString(sessionId);
foreach (byte b in sessionBytes)
{
if (b >= 0x30 && b <= 0x5A) // ASCII range