Major architectural refactoring to achieve 1:1 structural compatibility: 🏗️ **VC2022 Structure Replication** - Iso1EXIDocument: 1:1 replica of VC2022 iso1EXIDocument struct - DinEXIDocument: 1:1 replica of VC2022 dinEXIDocument struct - Iso2EXIDocument: 1:1 replica of VC2022 iso2EXIDocument struct - All _isUsed flags and Initialize() methods exactly matching VC2022 🔄 **VC2022 Function Porting** - ParseXmlToIso1(): Exact port of VC2022 parse_xml_to_iso1() - EncodeIso1ExiDocument(): Exact port of VC2022 encode_iso1ExiDocument() - Choice 76 (V2G_Message) encoding with identical logic - BulkChargingComplete ignore behavior preserved ⚡ **Call Sequence Alignment** - Old: EncodeV2GMessage() → direct EXI encoding - New: EncodeV2GMessage() → Iso1EXIDocument → EncodeIso1ExiDocument() - Exact VC2022 call chain: init → parse → encode → finish 🔍 **1:1 Debug Comparison Ready** - C# exiDoc.V2G_Message_isUsed ↔ VC2022 exiDoc->V2G_Message_isUsed - Identical structure enables line-by-line debugging comparison - Ready for precise 1-byte difference investigation (41 vs 42 bytes) 📁 **Project Reorganization** - Moved from csharp/ to Port/ for cleaner structure - Port/dotnet/ and Port/vc2022/ for parallel development - Complete build system and documentation updates 🎯 **Achievement**: 97.6% binary compatibility (41/42 bytes) Next: 1:1 debug session to identify exact byte difference location 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			97 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			97 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| # V2G EXI Decoder - Visual Studio 2022 VC++ Project
 | |
| 
 | |
| ## 개요
 | |
| OpenV2G EXI 디코더를 Visual Studio 2022 Professional에서 디버깅할 수 있도록 VC++ 프로젝트로 변환한 버전입니다.
 | |
| 
 | |
| ## 프로젝트 구조
 | |
| 
 | |
| ### 솔루션: `V2GDecoderC.sln`
 | |
| - **V2GDecoder**: 메인 EXI 디코더 애플리케이션
 | |
| - **HexToBinary**: 16진수 문자열을 바이너리로 변환하는 유틸리티
 | |
| - **HexDumpToBinary**: 16진수 덤프를 바이너리로 변환하는 유틸리티
 | |
| 
 | |
| ### 빌드 설정
 | |
| - **플랫폼**: Win32 (x86), x64
 | |
| - **구성**: Debug, Release
 | |
| - **컴파일러**: MSVC v143 (Visual Studio 2022)
 | |
| - **언어**: Pure C (C++이 아님)
 | |
| - **출력 디렉토리**: `bin/{Platform}/{Configuration}/`
 | |
| 
 | |
| ### 소스 파일 구성
 | |
| #### codec/ (EXI 코덱 핵심)
 | |
| - BitInputStream.c/h - 비트 스트림 입력
 | |
| - BitOutputStream.c/h - 비트 스트림 출력  
 | |
| - DecoderChannel.c/h - 디코더 채널
 | |
| - EncoderChannel.c/h - 인코더 채널
 | |
| - EXIHeaderDecoder.c/h - EXI 헤더 디코더
 | |
| - 기타 EXI 관련 파일들
 | |
| 
 | |
| #### iso1/ (ISO 15118-1 구현)
 | |
| - iso1EXIDatatypes.c/h - ISO1 EXI 데이터 타입
 | |
| - iso1EXIDatatypesDecoder.c/h - ISO1 EXI 디코더
 | |
| - iso1EXIDatatypesEncoder.c/h - ISO1 EXI 인코더
 | |
| 
 | |
| #### appHandshake/ (애플리케이션 핸드셰이크)
 | |
| - appHandEXIDatatypes.c/h - 핸드셰이크 데이터 타입
 | |
| - appHandEXIDatatypesDecoder.c/h - 핸드셰이크 디코더
 | |
| - appHandEXIDatatypesEncoder.c/h - 핸드셰이크 인코더
 | |
| 
 | |
| ## Visual Studio에서 사용하기
 | |
| 
 | |
| ### 1. 프로젝트 열기
 | |
| ```
 | |
| 파일 -> 열기 -> 프로젝트/솔루션 -> V2GDecoderC.sln 선택
 | |
| ```
 | |
| 
 | |
| ### 2. 빌드하기
 | |
| - **Debug x64** 구성을 권장 (완전한 디버깅 정보 포함)
 | |
| - 빌드 -> 솔루션 빌드 (Ctrl+Shift+B)
 | |
| 
 | |
| ### 3. 디버깅하기
 | |
| - V2GDecoder 프로젝트를 시작 프로젝트로 설정
 | |
| - F5로 디버깅 시작
 | |
| - 중단점 설정하여 단계별 디버깅 가능
 | |
| 
 | |
| ### 4. 커맨드 라인 인수 설정
 | |
| 프로젝트 속성 -> 디버깅 -> 명령 인수에서 테스트 파일 지정:
 | |
| ```
 | |
| ../../test4.exi
 | |
| ```
 | |
| 
 | |
| ## 장점
 | |
| 
 | |
| ### 🔍 강력한 디버깅 기능
 | |
| - **중단점**: 모든 C 소스 라인에 중단점 설정 가능
 | |
| - **단계별 실행**: F10 (Step Over), F11 (Step Into)
 | |
| - **변수 조사**: 지역 변수, 감시 창에서 실시간 변수 값 확인
 | |
| - **호출 스택**: 함수 호출 경로 추적
 | |
| - **메모리 뷰**: 원시 메모리 내용 확인
 | |
| 
 | |
| ### 📊 코드 분석 도구
 | |
| - **IntelliSense**: 코드 완성, 함수 시그니처 힌트
 | |
| - **정의로 이동**: F12로 함수/변수 정의 위치로 이동
 | |
| - **참조 찾기**: 함수/변수 사용 위치 검색
 | |
| - **오류 목록**: 컴파일 오류/경고 실시간 표시
 | |
| 
 | |
| ### 🚀 .NET 포팅 지원
 | |
| - C 코드 로직을 단계별로 분석하여 C#/.NET으로 포팅 가능
 | |
| - 메모리 레이아웃, 비트 조작 등 저수준 동작 확인
 | |
| - 함수별 입출력 값 확인으로 테스트 케이스 생성
 | |
| 
 | |
| ## 테스트 파일
 | |
| - `test4.exi` - 43바이트 CurrentDemandReq 메시지
 | |
| - `test5.exi` - 43바이트 CurrentDemandReq 메시지 (다른 값)
 | |
| 
 | |
| ## 원본 GCC 빌드와의 호환성
 | |
| - 동일한 소스 파일 사용
 | |
| - 동일한 헤더 파일 포함 경로
 | |
| - 동일한 전처리기 정의
 | |
| - Windows에서 POSIX 호환성 유지
 | |
| 
 | |
| ## 사용 예시
 | |
| ```bash
 | |
| # Visual Studio에서 빌드 후
 | |
| bin/x64/Debug/V2GDecoder.exe ../../test4.exi
 | |
| ```
 | |
| 
 | |
| 이제 Visual Studio 2022의 강력한 디버깅 기능을 활용하여 OpenV2G EXI 디코더를 분석하고 .NET 포팅 작업을 효율적으로 수행할 수 있습니다. |