提出確認書チェックツール:XSLTファイルのパスを実行ファイルと同じディレクトリにあるとみなすように変更。バグ修正。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@47 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2008-11-11 01:01:50 +00:00
parent 2a832f393b
commit d363c0b967
5 changed files with 16 additions and 5 deletions

View File

@ -91,7 +91,7 @@ int main(array<System::String ^> ^args)
printf( "RemasterVersion: %02X %02X\n", rh.s.rom_version, hItem->RomVersion ); printf( "RemasterVersion: %02X %02X\n", rh.s.rom_version, hItem->RomVersion );
printf( "File CRC: %04X %04X\n", crc, hItem->FileCRC ); printf( "File CRC: %04X %04X\n", crc, hItem->FileCRC );
printf( "------------------------------------\n" ); printf( "------------------------------------\n" );
printf( "SubmitVersion: - %d\n", hItem->SubmitVersion ); printf( "SubmitVersion: - %d (%02X)\n", hItem->SubmitVersion, hItem->SubmitVersion );
printf( "------------------------------------\n" ); printf( "------------------------------------\n" );
printf( "Result: " ); printf( "Result: " );
if( hContext->ErrorCode == SheetCheckerError::NOERROR ) if( hContext->ErrorCode == SheetCheckerError::NOERROR )
@ -160,9 +160,12 @@ System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item )
// XSLによってXML変換 // XSLによってXML変換
System::String ^tmpfile = ".\\temp" + System::DateTime::Now.ToString("yyyyMMddHHmmss") + ".xml"; System::String ^tmpfile = ".\\temp" + System::DateTime::Now.ToString("yyyyMMddHHmmss") + ".xml";
System::Xml::Xsl::XslCompiledTransform ^xslt = gcnew System::Xml::Xsl::XslCompiledTransform; System::Xml::Xsl::XslCompiledTransform ^xslt = gcnew System::Xml::Xsl::XslCompiledTransform;
System::String ^xslpath = System::IO::Path::GetDirectoryName( System::Reflection::Assembly::GetEntryAssembly()->Location )
+ "\\extract_sheet.xsl";
try try
{ {
xslt->Load( ".\\extract_sheet.xsl" ); //Console::WriteLine( "xslpath: " + xslpath );
xslt->Load( xslpath );
xslt->Transform( sheetfile, tmpfile ); xslt->Transform( sheetfile, tmpfile );
} }
catch( System::Exception ^ex ) catch( System::Exception ^ex )
@ -180,12 +183,14 @@ System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item )
catch( System::Exception ^ex ) catch( System::Exception ^ex )
{ {
(void)ex; (void)ex;
//Console::WriteLine( "Load error" );
return false; return false;
} }
// XMLからデータを抽出 // XMLからデータを抽出
System::Xml::XmlElement ^root = doc->DocumentElement; System::Xml::XmlElement ^root = doc->DocumentElement;
System::String ^text; System::String ^text;
try
{ {
text = getXPathText( root, "/Sheet/GameCode" ); text = getXPathText( root, "/Sheet/GameCode" );
char code[4]; char code[4];
@ -201,6 +206,7 @@ System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item )
{ {
text = text->Remove( text->IndexOf("(") ); text = text->Remove( text->IndexOf("(") );
} }
text = text->Trim();
item->RomVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier ); item->RomVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier );
text = getXPathText( root, "/Sheet/CRC" ); text = getXPathText( root, "/Sheet/CRC" );
@ -212,19 +218,24 @@ System::Boolean readSheet( System::String ^sheetfile, SheetItem ^item )
text = getXPathText( root, "/Sheet/SubmitVersion" ); text = getXPathText( root, "/Sheet/SubmitVersion" );
char c = (char)text[0]; char c = (char)text[0];
if( ('G' <= c) && (c <= 'Z') ) // Fより上はG..Zで表現されていく if( ('G' <= c) && (c <= 'Z') ) // Fより上はG..Zで表現されていく(可能性あり)
{ {
item->SubmitVersion = c - 'F' + 16; item->SubmitVersion = c - 'G' + 16;
} }
else if( ('g' <= c) && (c <= 'z') ) else if( ('g' <= c) && (c <= 'z') )
{ {
item->SubmitVersion = c - 'f' + 16; item->SubmitVersion = c - 'g' + 16;
} }
else else
{ {
item->SubmitVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier ); item->SubmitVersion = System::Byte::Parse( text, System::Globalization::NumberStyles::AllowHexSpecifier );
} }
} }
catch( System::Exception ^ex )
{
(void)ex;
return false;
}
// 中間ファイルを削除 // 中間ファイルを削除
if( System::IO::File::Exists( tmpfile ) ) if( System::IO::File::Exists( tmpfile ) )