マスタエディタ:外部メッセージ管理クラスを追加。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@192 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-03-02 07:52:11 +00:00
parent e45c6971e8
commit e4de0ba762
9 changed files with 1007 additions and 667 deletions

View File

@ -9,6 +9,7 @@
#include "lang.h"
#include "FormError.h"
#include "Form1_const.h"
#include "message_bank.h"
namespace MasterEditorTWL {
@ -791,6 +792,7 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
private: System::Windows::Forms::TextBox^ tboxPlatform;
@ -841,11 +843,11 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle21 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle22 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle23 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle24 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle25 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle6 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle7 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle8 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle9 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
System::Windows::Forms::DataGridViewCellStyle^ dataGridViewCellStyle10 = (gcnew System::Windows::Forms::DataGridViewCellStyle());
this->tboxFile = (gcnew System::Windows::Forms::TextBox());
this->gboxSrl = (gcnew System::Windows::Forms::GroupBox());
this->tboxRemasterVer = (gcnew System::Windows::Forms::TextBox());
@ -2394,15 +2396,15 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
this->gridSDK->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->gridSDK->ColumnHeadersVisible = false;
this->gridSDK->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(1) {this->dataSDKVer});
dataGridViewCellStyle21->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle21->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle21->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
dataGridViewCellStyle6->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle6->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle6->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(128)));
dataGridViewCellStyle21->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle21->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle21->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle21->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridSDK->DefaultCellStyle = dataGridViewCellStyle21;
dataGridViewCellStyle6->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle6->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle6->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle6->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridSDK->DefaultCellStyle = dataGridViewCellStyle6;
resources->ApplyResources(this->gridSDK, L"gridSDK");
this->gridSDK->Name = L"gridSDK";
this->gridSDK->ReadOnly = true;
@ -2424,15 +2426,15 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
this->gridLibrary->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->gridLibrary->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(2) {this->colLibPublisher,
this->colLibName});
dataGridViewCellStyle22->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle22->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle22->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
dataGridViewCellStyle7->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle7->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle7->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(128)));
dataGridViewCellStyle22->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle22->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle22->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle22->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridLibrary->DefaultCellStyle = dataGridViewCellStyle22;
dataGridViewCellStyle7->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle7->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle7->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle7->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridLibrary->DefaultCellStyle = dataGridViewCellStyle7;
resources->ApplyResources(this->gridLibrary, L"gridLibrary");
this->gridLibrary->Name = L"gridLibrary";
this->gridLibrary->ReadOnly = true;
@ -2949,15 +2951,15 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
this->gridWarn->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->gridWarn->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {this->colWarnName,
this->colWarnBegin, this->colWarnEnd, this->colWarnCause});
dataGridViewCellStyle23->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle23->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle23->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
dataGridViewCellStyle8->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle8->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle8->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(128)));
dataGridViewCellStyle23->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle23->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle23->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle23->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridWarn->DefaultCellStyle = dataGridViewCellStyle23;
dataGridViewCellStyle8->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle8->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle8->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle8->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridWarn->DefaultCellStyle = dataGridViewCellStyle8;
this->gridWarn->GridColor = System::Drawing::SystemColors::Control;
resources->ApplyResources(this->gridWarn, L"gridWarn");
this->gridWarn->Name = L"gridWarn";
@ -2992,22 +2994,22 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
//
// gridError
//
dataGridViewCellStyle24->BackColor = System::Drawing::Color::White;
this->gridError->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle24;
dataGridViewCellStyle9->BackColor = System::Drawing::Color::White;
this->gridError->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
this->gridError->AutoSizeRowsMode = System::Windows::Forms::DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders;
this->gridError->BackgroundColor = System::Drawing::SystemColors::Control;
this->gridError->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
this->gridError->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {this->colErrorName,
this->colErrorBegin, this->colErrorEnd, this->colErrorCause});
dataGridViewCellStyle25->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle25->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle25->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
dataGridViewCellStyle10->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
dataGridViewCellStyle10->BackColor = System::Drawing::SystemColors::Window;
dataGridViewCellStyle10->Font = (gcnew System::Drawing::Font(L"MS UI Gothic", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(128)));
dataGridViewCellStyle25->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle25->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle25->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle25->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridError->DefaultCellStyle = dataGridViewCellStyle25;
dataGridViewCellStyle10->ForeColor = System::Drawing::SystemColors::ControlText;
dataGridViewCellStyle10->SelectionBackColor = System::Drawing::SystemColors::Highlight;
dataGridViewCellStyle10->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
dataGridViewCellStyle10->WrapMode = System::Windows::Forms::DataGridViewTriState::True;
this->gridError->DefaultCellStyle = dataGridViewCellStyle10;
this->gridError->GridColor = System::Drawing::SystemColors::Control;
resources->ApplyResources(this->gridError, L"gridError");
this->gridError->Name = L"gridError";
@ -4239,7 +4241,6 @@ private: System::Windows::Forms::Label^ labCountryCodeL;
this->updateGrid();
}
}
}; // enf of ref class Form1
} // end of namespace MasterEditorTWL

View File

@ -259,6 +259,10 @@
RelativePath=".\MasterEditorTWL.cpp"
>
</File>
<File
RelativePath=".\message_bank.cpp"
>
</File>
<File
RelativePath=".\split_tad.cpp"
>
@ -363,6 +367,10 @@
RelativePath=".\lang.h"
>
</File>
<File
RelativePath=".\message_bank.h"
>
</File>
<File
RelativePath=".\resource.h"
>

View File

@ -0,0 +1,63 @@
#include "stdafx.h"
// RCMessageBankクラスの実装
#include <cstring>
#include <cstdio>
#include "message_bank.h"
#include "utility.h"
using namespace MasterEditorTWL;
// ****************************************************************
// RCMessageBank クラス
// ****************************************************************
// -------------------------------------------------------------------
// constructor
// -------------------------------------------------------------------
RCMessageBank::RCMessageBank( System::String ^fileJ, System::String ^fileE )
{
this->loadMessage( fileJ, "J" );
this->loadMessage( fileE, "E" );
}
// -------------------------------------------------------------------
// 外部ファイルからメッセージを読み出す
// -------------------------------------------------------------------
void RCMessageBank::loadMessage( System::String ^filepath, System::String ^lang )
{
System::Xml::XmlDocument ^doc = gcnew System::Xml::XmlDocument();
doc->Load( filepath );
System::Xml::XmlElement ^root = doc->DocumentElement;
// 言語によってXMLルートの格納先を変更
if( lang == "J" )
{
this->rootJ = root;
}
else
{
this->rootE = root;
}
}
// -------------------------------------------------------------------
// 特定のメッセージを返す
// -------------------------------------------------------------------
System::String^ RCMessageBank::getMessage( System::String ^tag, System::String ^lang )
{
System::Xml::XmlElement ^root;
if( lang == "J" )
{
root = this->rootJ;
}
else
{
root = this->rootE;
}
// どのファイルも同じタグがつけられていることが前提
System::String ^msg = MasterEditorTWL::getXPathText( root, "/message/" + tag );
return msg;
}

View File

@ -0,0 +1,35 @@
#pragma once
// 多言語メッセージの管理クラス
namespace MasterEditorTWL
{
// -------------------------------------------------------------------
// Type : ref class
// Name : RCMessageBank
//
// Description : メッセージを内部に持ち要求があれば返す
//
// Role : 多言語メッセージの管理
// -------------------------------------------------------------------
ref class RCMessageBank
{
private:
System::Xml::XmlElement ^rootJ;
System::Xml::XmlElement ^rootE;
private:
RCMessageBank(){};
public:
// Caution: throwing Exception
RCMessageBank( System::String ^fileJ, System::String ^fileE );
private:
// 外部ファイルからメッセージを読み出す
// Caution: throwing Exception
void loadMessage( System::String ^filepath, System::String ^lang );
public:
// 特定のメッセージを返す
System::String^ getMessage( System::String ^tag, System::String ^lang );
}; //RCMessageBank
} //namespace MasterEditorTWL

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<message>
<!-- common -->
<OverWrite>{0}はすでに存在します。上書きしますか?</OverWrite>
<!-- Start Up -->
<E_Start_InitExist>設定ファイルが見つかりません。</E_Start_InitExist>
<E_Start_InitOpen>設定ファイルを開くことができませんでした。</E_Start_InitOpen>
<E_Start_TmpExist>本プログラムで作成する一時ファイルと同名のファイルが存在します。このファイルを削除します。</E_Start_TmpExist>
<E_Start_AppendExist>追加設定ファイルが見つかりません。</E_Start_AppendExist>
<E_Start_AppendOpen>追加設定ファイルを開くことができませんでした。</E_Start_AppendOpen>
<E_Start_SDK>設定ファイル中のSDKバージョンが読み込めませんでした。バージョンは0とみなされます。</E_Start_SDK>
<!-- Load Rom -->
<E_LoadRom_Platform>本ツールはTWL用です。NTR専用ROMなどのTWL非対応ROMを読み込むことはできません。</E_LoadRom_Platform>
<E_LoadRom_Sign>不正なROMデータです。TWL対応/専用ROMでないかROMデータが改ざんされている可能性があります。</E_LoadRom_Sign>
<E_LoadRom_Default>ROMデータファイルの読み込みに失敗しました。\n再度ROMデータを読み込ませてください。</E_LoadRom_Default>
<E_LoadRom_CRC>ROMデータのCRC計算に失敗しました。ROMデータの読み込みはキャンセルされました。</E_LoadRom_CRC>
<E_LoadRom_Exist>ファイルが存在しませんので読み込むことができません。</E_LoadRom_Exist>
<E_LoadRom_Tad>TADファイルの読み込みに失敗しました。</E_LoadRom_Tad>
<!-- Create Submission Set -->
<SaveSet_Name>以下の提出ファイルが一度に作成されます。
{0} (マスターROM)
{1} (マスターROM提出確認書)
{2} (ミドルウェア一覧)
{3} (ミドルウェア一覧 印刷用)
</SaveSet_Name>
<SaveSet_Folder>保存先フォルダを選択してください。</SaveSet_Folder>
<SaveSet_Success>提出データ一式の作成に成功しました。</SaveSet_Success>
<E_SaveSet_Empty>ROMデータファイルが読み込まれていません。</E_SaveSet_Empty>
<E_SaveSet_Setting>不正な設定があるため提出データを作成できません。</E_SaveSet_Setting>
<E_SaveSet_FolderCancel>フォルダの選択がキャンセルされましたので提出データ一式は作成されません。</E_SaveSet_FolderCancel>
<E_SaveSet_OWCancel>ファイルの上書きがキャンセルされましたので提出データ一式は作成されません。</E_SaveSet_OWCancel>
<E_SaveSet_FileNormal>マスターROMの作成に失敗しました。作成を中止するため一部のファイルは作成されません。</E_SaveSet_FileNormal>
<E_SaveSet_FileOpen>原因:出力ファイルのオープンに失敗しました。</E_SaveSet_FileOpen>
<E_SaveSet_FileRead>原因:ファイルの読み込みに失敗しました。</E_SaveSet_FileRead>
<E_SaveSet_FileWrite>原因:出力ファイルへの書き出しに失敗しました。</E_SaveSet_FileWrite>
<E_SaveSet_FileCopy>原因:入力ROMデータファイルのコピーに失敗しました。</E_SaveSet_FileCopy>
<E_SaveSet_FileExist>原因:入力ROMデータファイルが元のフォルダに存在しないとき出力ファイルを作成できません。</E_SaveSet_FileExist>
<E_SaveSet_FileSign>原因:出力ファイルのディジタル署名の計算に失敗しました。</E_SaveSet_FileSign>
<E_SaveSet_Exception>マスターROMの作成に失敗しました。作成を中止するため一部のファイルは作成されません。
例外:{0}
{1}</E_SaveSet_Exception>
<E_SaveSet_CRC>CRCの計算に失敗しました。作成を中止するため一部のファイルは作成されません。</E_SaveSet_CRC>
<E_SaveSet_MWList>ミドルウェアのリストが作成できませんでした。作成を中止するため一部のファイルは作成されません。</E_SaveSet_MWList>
<E_SaveSet_Sheet_Default>提出確認書の作成に失敗しました。</E_SaveSet_Sheet_Default>
<E_SaveSet_SheetTemplate>提出確認書のテンプレートが開けなかったため、提出確認書の作成に失敗しました。</E_SaveSet_SheetTemplate>
<E_SaveSet_SheetOpen>提出確認書にデータを書き込みできませんでした。同名ファイルがすでに開かれていないかご確認ください。</E_SaveSet_SheetOpen>
<!-- Create Master Rom -->
<SaveRom_Name>以下のファイルが作成されます。
{0} (マスターROM)</SaveRom_Name>
<SaveRom_Folder>保存先フォルダを選択してください。</SaveRom_Folder>
<SaveRom_Success>マスターROMの作成に失敗しました。</SaveRom_Success>
<E_SaveRom_Empty>ROMデータファイルが読み込まれていませんので、マスターROMの作成ができません。</E_SaveRom_Empty>
<E_SaveRom_Setting>不正な設定があるためマスターROMの作成ができません。</E_SaveRom_Setting>
<E_SaveRom_FolderCancel>フォルダの選択がキャンセルされましたのでマスターROMは作成されません。</E_SaveRom_FolderCancel>
<E_SaveRom_OWCancel>ファイルの上書きがキャンセルされましたのでマスターROMは作成されません。</E_SaveRom_OWCancel>
<E_SaveRom_FileNormal>マスターROMの作成に失敗しました。</E_SaveRom_FileNormal>
<E_SaveRom_Exception>マスターROMの作成に失敗しました。
例外:{0}
{1}</E_SaveRom_Exception>
<!-- Create MiddleWare List -->
<E_MWList_Empty>ROMデータファイルが読み込まれていません。</E_MWList_Empty>
<E_MWList_Default>ミドルウェアリストの作成に失敗しました。</E_MWList_Default>
<!-- Save Temp File -->
<E_SaveTemp>一時情報の保存に失敗しました。</E_SaveTemp>
<!-- Load Temp File -->
<E_LoadTemp>一時情報の読み込みに失敗しました。</E_LoadTemp>
</message>