マスタエディタ:ミドルウェアのリストを出力する機能を追加。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2569 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
nishikawa_takeshi 2008-10-02 06:42:57 +00:00
parent cc8b38b781
commit e4d159581a
10 changed files with 483 additions and 9 deletions

View File

@ -579,6 +579,8 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colErrorEnd;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ colErrorCause;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibPublisher;
private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
private: System::Windows::Forms::ToolStripMenuItem^ stripItemMiddlewareXml;
private: System::Windows::Forms::ToolStripMenuItem^ stripItemMiddlewareHtml;
@ -930,6 +932,8 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
this->stripMaster = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemSheet = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemMasterRom = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemMiddlewareXml = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemMiddlewareHtml = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripLang = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemEnglish = (gcnew System::Windows::Forms::ToolStripMenuItem());
this->stripItemJapanese = (gcnew System::Windows::Forms::ToolStripMenuItem());
@ -2791,8 +2795,8 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
//
// stripMaster
//
this->stripMaster->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->stripItemSheet,
this->stripItemMasterRom});
this->stripMaster->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(4) {this->stripItemSheet,
this->stripItemMasterRom, this->stripItemMiddlewareXml, this->stripItemMiddlewareHtml});
this->stripMaster->Name = L"stripMaster";
this->stripMaster->Size = System::Drawing::Size(53, 20);
this->stripMaster->Text = L"マスター";
@ -2800,17 +2804,31 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
// stripItemSheet
//
this->stripItemSheet->Name = L"stripItemSheet";
this->stripItemSheet->Size = System::Drawing::Size(232, 22);
this->stripItemSheet->Text = L"提出確認書とマスターROMを作成";
this->stripItemSheet->Size = System::Drawing::Size(259, 22);
this->stripItemSheet->Text = L"提出確認書とマスターROMを作成する";
this->stripItemSheet->Click += gcnew System::EventHandler(this, &Form1::stripItemSheet_Click);
//
// stripItemMasterRom
//
this->stripItemMasterRom->Name = L"stripItemMasterRom";
this->stripItemMasterRom->Size = System::Drawing::Size(232, 22);
this->stripItemMasterRom->Text = L"マスターROMのみを作成";
this->stripItemMasterRom->Size = System::Drawing::Size(259, 22);
this->stripItemMasterRom->Text = L"マスターROMのみを作成する";
this->stripItemMasterRom->Click += gcnew System::EventHandler(this, &Form1::stripItemMasterRom_Click);
//
// stripItemMiddlewareXml
//
this->stripItemMiddlewareXml->Name = L"stripItemMiddlewareXml";
this->stripItemMiddlewareXml->Size = System::Drawing::Size(259, 22);
this->stripItemMiddlewareXml->Text = L"ミドルウェアリストを作成する(XML形式)";
this->stripItemMiddlewareXml->Click += gcnew System::EventHandler(this, &Form1::stripItemMiddlewareXml_Click);
//
// stripItemMiddlewareHtml
//
this->stripItemMiddlewareHtml->Name = L"stripItemMiddlewareHtml";
this->stripItemMiddlewareHtml->Size = System::Drawing::Size(259, 22);
this->stripItemMiddlewareHtml->Text = L"ミドルウェアリストを作成する(HTML形式)";
this->stripItemMiddlewareHtml->Click += gcnew System::EventHandler(this, &Form1::stripItemMiddlewareHtml_Click);
//
// stripLang
//
this->stripLang->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->stripItemEnglish,
@ -3482,6 +3500,18 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
// SRLの保存のみ @ret 成否
System::Boolean saveSrlCore( System::String ^filename );
// ミドルウェアリストの作成(XML形式)
System::Void makeMiddlewareListXml(System::Xml::XmlDocument^ doc);
// ミドルウェアリストの保存
System::Boolean saveMiddlewareListXml( System::String ^filename );
// ミドルウェアリストの保存(XML->HTML変換)
System::Boolean saveMiddlewareListHtml( System::String ^filename );
// ミドルウェアリストの保存(XSL埋め込み)
System::Boolean saveMiddlewareListXmlEmbeddedXsl( System::String ^filename );
private:
// ----------------------------------------------
// 一時ファイルの取り扱い
@ -4019,6 +4049,79 @@ private: System::Windows::Forms::DataGridViewTextBoxColumn^ colLibName;
this->loadTmp( filename );
} //stripItemLoadTemp_Click()
private:
System::Void stripItemMiddlewareXml_Click(System::Object^ sender, System::EventArgs^ e)
{
System::String ^filename = gcnew System::String("");
if( System::String::IsNullOrEmpty(this->tboxFile->Text) )
{
this->errMsg( "ROMデータファイルがオープンされていません。", "ROM file has not opened yet." );
return;
}
// ダイアログでファイルパスを決定
{
System::Windows::Forms::SaveFileDialog ^dlg = gcnew (SaveFileDialog);
dlg->InitialDirectory = "c:\\";
dlg->Filter = "xml形式 (*.xml)|*.xml";
dlg->FilterIndex = 1;
dlg->RestoreDirectory = true;
if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK )
{
return;
}
filename = dlg->FileName;
if( !(dlg->FileName->EndsWith( ".xml" )) )
{
filename += ".xml";
}
}
if( !this->saveMiddlewareListXmlEmbeddedXsl(filename) )
{
this->errMsg( "ミドルウェアリストの作成に失敗しました。","Making a middleware list failed." );
}
} //stripItemMiddlewareXml_Click()
private:
System::Void stripItemMiddlewareHtml_Click(System::Object^ sender, System::EventArgs^ e)
{
System::String ^filename = gcnew System::String("");
if( System::String::IsNullOrEmpty(this->tboxFile->Text) )
{
this->errMsg( "ROMデータファイルがオープンされていません。", "ROM file has not opened yet." );
return;
}
// ダイアログでファイルパスを決定
{
System::Windows::Forms::SaveFileDialog ^dlg = gcnew (SaveFileDialog);
dlg->InitialDirectory = "c:\\";
dlg->Filter = "html形式 (*.html)|*.html";
dlg->FilterIndex = 1;
dlg->RestoreDirectory = true;
if( dlg->ShowDialog() != System::Windows::Forms::DialogResult::OK )
{
return;
}
filename = dlg->FileName;
if( !(dlg->FileName->EndsWith( ".html" )) )
{
filename += ".html";
}
}
if( !this->saveMiddlewareListHtml(filename) )
{
this->errMsg( "ミドルウェアリストの作成に失敗しました。","Making a middleware list failed." );
}
} //stripItemMiddlewareHtml_Click
/////////////////////////////////////////////
// フォーム操作メソッド
/////////////////////////////////////////////

View File

@ -34,7 +34,13 @@ void Form1::loadInit(void)
catch( System::IO::FileNotFoundException ^s )
{
(void)s;
this->sucMsg( "設定ファイルを開くことができませんでした。", "Setting file can't be opened." );
this->errMsg( "設定ファイルが見つかりません。", "Setting file is not found." );
return;
}
catch( System::Exception ^s )
{
(void)s;
this->errMsg( "設定ファイルを開くことができませんでした。", "Setting file can't be opened." );
return;
}
@ -221,4 +227,129 @@ System::Boolean Form1::saveSrlCore( System::String ^filename )
return false;
}
return true;
}
}
// ミドルウェアリストの作成
System::Void Form1::makeMiddlewareListXml(System::Xml::XmlDocument^ doc)
{
System::Xml::XmlElement ^root = doc->CreateElement( "twl-master-editor" );
System::Reflection::Assembly ^ass = System::Reflection::Assembly::GetEntryAssembly();
root->SetAttribute( "version", ass->GetName()->Version->ToString() );
doc->AppendChild( root );
// ゲーム情報
System::Xml::XmlElement ^game = doc->CreateElement( "game" );
root->AppendChild( game );
if( System::String::IsNullOrEmpty( this->tboxProductName->Text ) )
{
MasterEditorTWL::appendXmlTag( doc, game, "product-name", this->tboxTitleName->Text ); // 製品名が未入力のときはソフトタイトルで代用
}
else
{
MasterEditorTWL::appendXmlTag( doc, game, "product-name", this->tboxProductName->Text );
}
MasterEditorTWL::appendXmlTag( doc, game, "title-name", this->tboxTitleName->Text );
MasterEditorTWL::appendXmlTag( doc, game, "game-code", this->tboxGameCode->Text );
MasterEditorTWL::appendXmlTag( doc, game, "rom-version", this->tboxRemasterVer->Text );
MasterEditorTWL::appendXmlTag( doc, game, "submit-version", this->numSubmitVersion->Value.ToString() );
// ミドルウェアリスト
System::Xml::XmlElement ^midlist = doc->CreateElement( "middleware-list" );
root->AppendChild( midlist );
if( this->hSrl->hLicenseList != nullptr )
{
for each( RCLicense ^lic in this->hSrl->hLicenseList )
{
System::Xml::XmlElement ^mid = doc->CreateElement( "middleware" );
MasterEditorTWL::appendXmlTag( doc, mid, "publisher", lic->Publisher );
MasterEditorTWL::appendXmlTag( doc, mid, "name", lic->Name );
midlist->AppendChild( mid );
}
}
}
// ミドルウェアリストの保存
System::Boolean Form1::saveMiddlewareListXml( System::String ^filename )
{
System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument();
doc->AppendChild( doc->CreateXmlDeclaration("1.0","UTF-8",nullptr) );
this->makeMiddlewareListXml( doc );
try
{
doc->Save( filename );
}
catch ( System::Exception ^ex )
{
(void)ex;
return false;
}
return true;
}
// ミドルウェアリストの保存
System::Boolean Form1::saveMiddlewareListXmlEmbeddedXsl( System::String ^filename )
{
System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument();
doc->AppendChild( doc->CreateXmlDeclaration("1.0","UTF-8",nullptr) );
// XSLを埋め込むための宣言たち
System::Xml::XmlProcessingInstruction ^proc = doc->CreateProcessingInstruction( "xml-stylesheet", "type='text/xml' href='#stylesheet'" );
doc->AppendChild( proc );
System::Xml::XmlDocumentType ^doctype = doc->CreateDocumentType( "twl-master-editor", nullptr, nullptr, "<!ATTLIST xsl:stylesheet id ID #REQUIRED>" );
doc->AppendChild( doctype );
this->makeMiddlewareListXml( doc );
// 埋め込みスタイルシート
System::Xml::XmlDocument ^xsl = gcnew System::Xml::XmlDocument();
System::Xml::XmlElement ^root = doc->DocumentElement;
try
{
xsl->Load("../resource/middleware_e.xsl");
root->AppendChild( doc->ImportNode(xsl->DocumentElement, true) );
}
catch ( System::Exception ^ex )
{
(void)ex;
return false;
}
try
{
doc->Save( filename );
}
catch ( System::Exception ^ex )
{
(void)ex;
return false;
}
return true;
}
// ミドルウェアリストの保存(XML->HTML変換)
System::Boolean Form1::saveMiddlewareListHtml( System::String ^filename )
{
System::Xml::Xsl::XslCompiledTransform ^xslt = gcnew System::Xml::Xsl::XslCompiledTransform;
System::String ^tmpxml = gcnew System::String( "middleware-tmp.xml" );
if( !saveMiddlewareListXml(tmpxml) )
{
return false;
}
try
{
xslt->Load("../resource/middleware.xsl");
xslt->Transform( tmpxml, filename );
}
catch (System::Exception ^s)
{
(void)s;
System::IO::File::Delete( tmpxml );
return false;
}
System::IO::File::Delete( tmpxml );
return true;
}

View File

@ -48,6 +48,8 @@ void Form1::changeJapanese(void)
this->stripMaster->Text = gcnew System::String( "マスター" );
this->stripItemSheet->Text = gcnew System::String( "提出確認書とマスターROMを作成する" );
this->stripItemMasterRom->Text = gcnew System::String( "マスターROMのみを作成する" );
this->stripItemMiddlewareXml->Text = gcnew System::String( "ミドルウェアリストを作成する(XML形式)" );
this->stripItemMiddlewareHtml->Text = gcnew System::String( "ミドルウェアリストを作成する(HTML形式)" );
// 入力ファイル
this->labFile->Text = gcnew System::String( "ROMデータファイル" );
@ -271,6 +273,8 @@ void Form1::changeEnglish(void)
this->stripMaster->Text = gcnew System::String( "Master" );
this->stripItemSheet->Text = gcnew System::String( "Make a submission sheet and a master ROM data file" );
this->stripItemMasterRom->Text = gcnew System::String( "Make a master ROM data file only" );
this->stripItemMiddlewareXml->Text = gcnew System::String( "Make a middleware list(XML format)" );
this->stripItemMiddlewareHtml->Text = gcnew System::String( "Make a middleware list(HTML format)" );
// 入力ファイル
this->labFile->Text = gcnew System::String( "ROM Data File" );

View File

@ -21,6 +21,18 @@
}
"Entry"
{
"MsmKey" = "8:_491C89DAB2F34A939F356C47975E7BD0"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_6EC739CA561443E48045379A268C1657"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_7746D2D347F0423FB46FA2300F6158A4"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@ -156,6 +168,46 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_491C89DAB2F34A939F356C47975E7BD0"
{
"SourcePath" = "8:..\\resource\\middleware.xsl"
"TargetName" = "8:middleware.xsl"
"Tag" = "8:"
"Folder" = "8:_99EFE6B595C5432FB4712560C9D29AE5"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6EC739CA561443E48045379A268C1657"
{
"SourcePath" = "8:..\\resource\\middleware_e.xsl"
"TargetName" = "8:middleware_e.xsl"
"Tag" = "8:"
"Folder" = "8:_99EFE6B595C5432FB4712560C9D29AE5"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A3417E9C9F294832AE49B5BDAF95E373"
{
"SourcePath" = "8:..\\resource\\ini.xml"
@ -789,7 +841,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_7746D2D347F0423FB46FA2300F6158A4"
{
"SourcePath" = "8:..\\Release\\MasterEditorTWL.exe"
"SourcePath" = "8:..\\Debug\\MasterEditorTWL.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_1494B8B199184797B9C812877A4DFB7F"

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>TWL Middleware List</title>
<style type="text/css">
body {
font-family: "verdana";
font-size: 12px;
text-align: left;
}
div.game-title {
font-size: 16px;
font-weight: bold;
}
div.game-version {
font-size: 12px;
font-weight: bold;
}
hr {
width: 700px;
margin-left: 0;
}
tr {
text-align: left;
}
th {
font-size: 12px;
background-color: #D6D3CE;
color: black;
}
th.publisher {
width: 200px;
}
th.name {
width: 500px;
}
td {
font-weight: normal;
font-size: 12px;
}
</style>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="twl-master-editor">
<xsl:apply-templates select="game" />
<hr />
<xsl:apply-templates select="middleware-list" />
<hr />
<div class="footer">
generated by MasterEditorTWL ver. <xsl:value-of select="@version" />
</div>
</xsl:template>
<xsl:template match="game">
<div class="game-title">
<xsl:value-of select="product-name" />(<xsl:value-of select="game-code" />)
</div>
<div class="game-version">
version: <xsl:value-of select="rom-version" />-<xsl:value-of select="submit-version" />
</div>
</xsl:template>
<xsl:template match="middleware-list">
<table cellspacing="0">
<tr>
<th class="publisher">Publisher</th>
<th class="name">Middleware Name</th>
</tr>
<xsl:apply-templates />
</table>
</xsl:template>
<xsl:template match="middleware">
<tr>
<td class="publisher"><xsl:value-of select="publisher" /></td>
<td class="name"><xsl:value-of select="name" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet id="stylesheet" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>TWL Middleware List</title>
<style type="text/css">
body {
font-family: "verdana";
font-size: 12px;
text-align: left;
}
div.game-title {
font-size: 16px;
font-weight: bold;
}
div.game-version {
font-size: 12px;
font-weight: bold;
}
hr {
width: 700px;
margin-left: 0;
}
tr {
text-align: left;
}
th {
font-size: 12px;
background-color: #D6D3CE;
color: black;
}
th.publisher {
width: 200px;
}
th.name {
width: 500px;
}
td {
font-weight: normal;
font-size: 12px;
}
</style>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="twl-master-editor">
<xsl:apply-templates select="game" />
<hr />
<xsl:apply-templates select="middleware-list" />
<hr />
<div class="footer">
generated by MasterEditorTWL ver. <xsl:value-of select="@version" />
</div>
</xsl:template>
<xsl:template match="game">
<div class="game-title">
<xsl:value-of select="product-name" />(<xsl:value-of select="game-code" />)
</div>
<div class="game-version">
version: <xsl:value-of select="rom-version" />-<xsl:value-of select="submit-version" />
</div>
</xsl:template>
<xsl:template match="middleware-list">
<table cellspacing="0">
<tr>
<th class="publisher">Publisher</th>
<th class="name">Middleware Name</th>
</tr>
<xsl:apply-templates />
</table>
</xsl:template>
<xsl:template match="middleware">
<tr>
<td class="publisher"><xsl:value-of select="publisher" /></td>
<td class="name"><xsl:value-of select="name" /></td>
</tr>
</xsl:template>
</xsl:stylesheet>