エラー情報の表示を用途によって分岐するしくみを作成。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@423 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-10-28 07:44:27 +00:00
parent 1486894918
commit 6566da27d9
10 changed files with 109 additions and 21 deletions

View File

@ -5038,6 +5038,9 @@ private: System::Windows::Forms::TextBox^ tboxPurposeInError;
RCMrcError^ makeErrorMsg( RCMrcError^ makeErrorMsg(
System::Boolean isAffectRom, System::String ^labeltag, System::String ^msgtag, ... cli::array<System::String^> ^args ); System::Boolean isAffectRom, System::String ^labeltag, System::String ^msgtag, ... cli::array<System::String^> ^args );
// 用途のラジオボタンの状態によって表示するかどうかを振り分ける
bool isDisplayOneGridErrorForPurpose( RCMrcError ^err );
// 読み込み時エラーの登録 // 読み込み時エラーの登録
void setGridError( void ); void setGridError( void );
void setGridWarn( void ); void setGridWarn( void );

View File

@ -46,6 +46,11 @@ void Form1::changeFormInput( System::String ^langname )
this->tboxNTSC1->Enabled = true; this->tboxNTSC1->Enabled = true;
this->tboxFurigana2->Enabled = true; this->tboxFurigana2->Enabled = true;
this->tboxNTSC2->Enabled = true; this->tboxNTSC2->Enabled = true;
this->tboxFurigana1->Visible = true;
this->tboxNTSC1->Visible = true;
this->tboxFurigana2->Visible = true;
this->tboxNTSC2->Visible = true;
this->labFurigana1->Visible = true; this->labFurigana1->Visible = true;
this->labNTSC1Pre->Visible = true; this->labNTSC1Pre->Visible = true;
this->labNTSC1Sur->Visible = true; this->labNTSC1Sur->Visible = true;
@ -70,6 +75,15 @@ void Form1::changeFormInput( System::String ^langname )
this->tboxNTSC1->Enabled = false; this->tboxNTSC1->Enabled = false;
this->tboxFurigana2->Enabled = false; this->tboxFurigana2->Enabled = false;
this->tboxNTSC2->Enabled = false; this->tboxNTSC2->Enabled = false;
this->tboxFurigana1->Visible = false;
this->tboxNTSC1->Visible = false;
this->tboxFurigana2->Visible = false;
this->tboxNTSC2->Visible = false;
this->tboxFurigana1->Clear();
this->tboxNTSC1->Clear();
this->tboxFurigana2->Clear();
this->tboxNTSC2->Clear();
this->labFurigana1->Visible = false; this->labFurigana1->Visible = false;
this->labNTSC1Pre->Visible = false; this->labNTSC1Pre->Visible = false;
this->labNTSC1Sur->Visible = false; this->labNTSC1Sur->Visible = false;

View File

@ -31,7 +31,7 @@ System::Boolean Form1::checkTextForm( System::String ^formtext, System::String ^
System::String ^labelE = this->hMsg->getMessage(tag,"E"); System::String ^labelE = this->hMsg->getMessage(tag,"E");
System::String ^msgJ = this->hMsg->getMessage("TextBoxInput", "J"); System::String ^msgJ = this->hMsg->getMessage("TextBoxInput", "J");
System::String ^msgE = this->hMsg->getMessage("TextBoxInput", "E"); System::String ^msgE = this->hMsg->getMessage("TextBoxInput", "E");
this->hErrorList->Add( gcnew RCMrcError( labelJ, 0, 0, msgJ, labelE, msgE, true, false ) ); this->hErrorList->Add( gcnew RCMrcError( labelJ, 0, 0, msgJ, labelE, msgE, true, false, RCMrcError::PurposeType::Common ) );
return false; return false;
} }
return true; return true;
@ -45,7 +45,7 @@ System::Boolean Form1::checkNumRange( System::Int32 val, System::Int32 min, Syst
System::String ^labelE = this->hMsg->getMessage(tag,"E"); System::String ^labelE = this->hMsg->getMessage(tag,"E");
System::String ^msgJ = this->hMsg->getMessage("NumRangeInput", "J"); System::String ^msgJ = this->hMsg->getMessage("NumRangeInput", "J");
System::String ^msgE = this->hMsg->getMessage("NumRangeInput", "E"); System::String ^msgE = this->hMsg->getMessage("NumRangeInput", "E");
this->hErrorList->Add( gcnew RCMrcError( labelJ, 0, 0, msgJ, labelE, msgE, true, false ) ); this->hErrorList->Add( gcnew RCMrcError( labelJ, 0, 0, msgJ, labelE, msgE, true, false, RCMrcError::PurposeType::Common ) );
return false; return false;
} }
return true; return true;
@ -73,7 +73,7 @@ System::Boolean Form1::checkComboBoxIndex( System::Windows::Forms::ComboBox ^box
System::String ^msgJ = this->hMsg->getMessage("ComboBoxInput", "J"); System::String ^msgJ = this->hMsg->getMessage("ComboBoxInput", "J");
System::String ^msgE = this->hMsg->getMessage("ComboBoxInput", "E"); System::String ^msgE = this->hMsg->getMessage("ComboBoxInput", "E");
this->hErrorList->Add( gcnew RCMrcError( this->hErrorList->Add( gcnew RCMrcError(
labelJ, 0, 0, msgJ, labelE, msgE, true, isAffectRom ) ); labelJ, 0, 0, msgJ, labelE, msgE, true, isAffectRom, RCMrcError::PurposeType::Common ) );
} }
return true; return true;
} }
@ -95,9 +95,42 @@ RCMrcError^ Form1::makeErrorMsg( System::Boolean isAffectRom, System::String ^la
System::String ^fmtE = this->hMsg->getMessage( msgtag, "E" ); System::String ^fmtE = this->hMsg->getMessage( msgtag, "E" );
System::String ^msgE = System::String::Format( fmtE, args ); System::String ^msgE = System::String::Format( fmtE, args );
return (gcnew RCMrcError( nameJ, 0, 0, msgJ, nameE, msgE, true, isAffectRom )); return (gcnew RCMrcError( nameJ, 0, 0, msgJ, nameE, msgE, true, isAffectRom, RCMrcError::PurposeType::Common )); // 修正可能なエラーとして作成
} }
// 用途のラジオボタンの状態によって表示するかどうかを振り分ける
bool Form1::isDisplayOneGridErrorForPurpose( RCMrcError ^err )
{
bool is_display = false;
if( ((err->Purpose & RCMrcError::PurposeType::Production) != (RCMrcError::PurposeType)0) &&
(this->rPurposeCardProduction->Checked || this->rPurposeDSiWare->Checked || this->rPurposeOther->Checked) )
{
is_display = true;
}
if( ((err->Purpose & RCMrcError::PurposeType::CardDistribution) != (RCMrcError::PurposeType)0) &&
this->rPurposeCardDistribution->Checked )
{
is_display = true;
}
if( ((err->Purpose & RCMrcError::PurposeType::CardKiosk) != (RCMrcError::PurposeType)0) &&
this->rPurposeCardKiosk->Checked )
{
is_display = true;
}
if( ((err->Purpose & RCMrcError::PurposeType::DSStation) != (RCMrcError::PurposeType)0) &&
this->rPurposeDSStation->Checked )
{
is_display = true;
}
if( ((err->Purpose & RCMrcError::PurposeType::Zone) != (RCMrcError::PurposeType)0) &&
this->rPurposeZone->Checked )
{
is_display = true;
}
return is_display;
} //isDisplayOneGridErrorForPurpose()
// 読み込み時エラーの登録 // 読み込み時エラーの登録
void Form1::setGridError( void ) void Form1::setGridError( void )
{ {
@ -105,11 +138,14 @@ void Form1::setGridError( void )
if( this->hSrl->hErrorList != nullptr ) // ROM読み込み時に発見されたエラー if( this->hSrl->hErrorList != nullptr ) // ROM読み込み時に発見されたエラー
{ {
for each( RCMrcError ^err in this->hSrl->hErrorList ) for each( RCMrcError ^err in this->hSrl->hErrorList )
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridError->Rows->Add( err->getAll(this->isJapanese()) ); this->gridError->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridError( err ); this->colorGridError( err );
} }
} }
}
} }
void Form1::setGridWarn( void ) void Form1::setGridWarn( void )
@ -118,11 +154,14 @@ void Form1::setGridWarn( void )
if( this->hSrl->hWarnList != nullptr ) if( this->hSrl->hWarnList != nullptr )
{ {
for each( RCMrcError ^err in this->hSrl->hWarnList ) for each( RCMrcError ^err in this->hSrl->hWarnList )
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) ); this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridWarn( err ); this->colorGridWarn( err );
} }
} }
}
} }
// 読み込み時に検出した修正可能エラーに現在の入力を反映 // 読み込み時に検出した修正可能エラーに現在の入力を反映
@ -134,20 +173,26 @@ void Form1::overloadGridError( void )
for each( RCMrcError ^err in this->hSrl->hErrorList ) for each( RCMrcError ^err in this->hSrl->hErrorList )
{ {
if( !err->IsEnableModify ) // 修正可能な情報は表示しない if( !err->IsEnableModify ) // 修正可能な情報は表示しない
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridError->Rows->Add( err->getAll(this->isJapanese()) ); this->gridError->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridError( err ); this->colorGridError( err );
} }
} }
} }
}
if( this->hErrorList != nullptr ) // 現在のフォーム入力から発見されたエラー if( this->hErrorList != nullptr ) // 現在のフォーム入力から発見されたエラー
{ {
for each( RCMrcError ^err in this->hErrorList ) for each( RCMrcError ^err in this->hErrorList )
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridError->Rows->Add( err->getAll(this->isJapanese()) ); this->gridError->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridError( err ); this->colorGridError( err );
} }
} }
}
} }
void Form1::overloadGridWarn( void ) void Form1::overloadGridWarn( void )
{ {
@ -157,20 +202,26 @@ void Form1::overloadGridWarn( void )
for each( RCMrcError ^err in this->hSrl->hWarnList ) for each( RCMrcError ^err in this->hSrl->hWarnList )
{ {
if( !err->IsEnableModify ) if( !err->IsEnableModify )
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) ); this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridWarn( err ); this->colorGridWarn( err );
} }
} }
} }
}
if( this->hWarnList != nullptr ) if( this->hWarnList != nullptr )
{ {
for each( RCMrcError ^err in this->hWarnList ) for each( RCMrcError ^err in this->hWarnList )
{
if( this->isDisplayOneGridErrorForPurpose( err ) )
{ {
this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) ); this->gridWarn->Rows->Add( err->getAll(this->isJapanese()) );
this->colorGridWarn( err ); this->colorGridWarn( err );
} }
} }
}
} }
// セルの色を変える // セルの色を変える

View File

@ -1033,15 +1033,16 @@ void RCSrl::calcNandUsedSize(FILE *fp)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
RCMrcError^ RCSrl::makeMrcError( System::String ^tag, ... cli::array<System::String^> ^args ) RCMrcError^ RCSrl::makeMrcError( System::String ^tag, ... cli::array<System::String^> ^args )
{ {
// パラメータも取得(日本語版から) // パラメータも取得(パラメータは英語版にも日本語版にも登録されておりどちらでもよいが日本語版のものにしておく)
System::UInt32 beg = System::UInt32::Parse( this->hMrcMsg->getMessage( tag+"/begin", "J" ), System::Globalization::NumberStyles::HexNumber ); System::UInt32 beg = System::UInt32::Parse( this->hMrcMsg->getMessage( tag+"/begin", "J" ), System::Globalization::NumberStyles::HexNumber );
System::UInt32 end = System::UInt32::Parse( this->hMrcMsg->getMessage( tag+"/end", "J" ), System::Globalization::NumberStyles::HexNumber ); System::UInt32 end = System::UInt32::Parse( this->hMrcMsg->getMessage( tag+"/end", "J" ), System::Globalization::NumberStyles::HexNumber );
System::Boolean isEnableModify = System::Boolean::Parse( this->hMrcMsg->getMessage( tag+"/modify", "J" ) ); System::Boolean isEnableModify = System::Boolean::Parse( this->hMrcMsg->getMessage( tag+"/modify", "J" ) );
System::Boolean isAffectRom = System::Boolean::Parse( this->hMrcMsg->getMessage( tag+"/affect", "J" ) ); System::Boolean isAffectRom = System::Boolean::Parse( this->hMrcMsg->getMessage( tag+"/affect", "J" ) );
return (this->makeMrcError( beg, end, isEnableModify, isAffectRom, tag, args )); return (this->makeMrcError( beg, end, isEnableModify, isAffectRom, RCMrcError::PurposeType::Common, tag, args )); // 共通エラー
} }
RCMrcError^ RCSrl::makeMrcError( System::UInt32 beg, System::UInt32 end, System::Boolean isEnableModify, System::Boolean isAffectRom, RCMrcError^ RCSrl::makeMrcError( System::UInt32 beg, System::UInt32 end, System::Boolean isEnableModify, System::Boolean isAffectRom,
RCMrcError::PurposeType purpose,
System::String ^tag, ... cli::array<System::String^> ^args ) System::String ^tag, ... cli::array<System::String^> ^args )
{ {
// 外部ファイルから項目名を取得 // 外部ファイルから項目名を取得
@ -1053,5 +1054,5 @@ RCMrcError^ RCSrl::makeMrcError( System::UInt32 beg, System::UInt32 end, System:
System::String ^fmtE = this->hMrcMsg->getMessage( tag+"/sentence", "E" ); System::String ^fmtE = this->hMrcMsg->getMessage( tag+"/sentence", "E" );
System::String ^msgE = System::String::Format( fmtE, args ); System::String ^msgE = System::String::Format( fmtE, args );
return (gcnew RCMrcError( nameJ, beg, end, msgJ, nameE, msgE, isEnableModify, isAffectRom )); return (gcnew RCMrcError( nameJ, beg, end, msgJ, nameE, msgE, isEnableModify, isAffectRom, purpose ));
} }

View File

@ -191,6 +191,7 @@ namespace MasterEditorTWL
// MRCメッセージを追加 // MRCメッセージを追加
RCMrcError^ makeMrcError( System::String ^tag, ... cli::array<System::String^> ^args ); RCMrcError^ makeMrcError( System::String ^tag, ... cli::array<System::String^> ^args );
RCMrcError^ makeMrcError( System::UInt32 beg, System::UInt32 end, System::Boolean isEnableModify, System::Boolean isAffectRom, RCMrcError^ makeMrcError( System::UInt32 beg, System::UInt32 end, System::Boolean isEnableModify, System::Boolean isAffectRom,
RCMrcError::PurposeType purpose,
System::String ^tag, ... cli::array<System::String^> ^args ); System::String ^tag, ... cli::array<System::String^> ^args );
}; // end of ref class RCSrl }; // end of ref class RCSrl

View File

@ -266,6 +266,17 @@ namespace MasterEditorTWL
// ------------------------------------------------------------------- // -------------------------------------------------------------------
public ref class RCMrcError public ref class RCMrcError
{ {
public:
enum class PurposeType : System::UInt32 // 型指定
{
Production = 1 << 0, // 一般販売用(カード/NAND)
CardDistribution = 1 << 1, // データ配信用カード
CardKiosk = 1 << 2, // 店頭試遊台(単独型)
DSStation = 1 << 3, // DS Station
Zone = 1 << 4, // Nintendo Zone
Common = 0xFFFFFFFF, // すべての用途で共通のエラー
};
private: private:
System::String ^hName; // 項目名 System::String ^hName; // 項目名
System::UInt32 begin; // 開始アドレス System::UInt32 begin; // 開始アドレス
@ -275,12 +286,13 @@ namespace MasterEditorTWL
System::String ^hMsgE; System::String ^hMsgE;
System::Boolean isEnableModify; // マスタエディタで修正可能かどうか System::Boolean isEnableModify; // マスタエディタで修正可能かどうか
System::Boolean isAffectRom; // 変更するとSRL(ROMバイナリ)が変更されるか System::Boolean isAffectRom; // 変更するとSRL(ROMバイナリ)が変更されるか
PurposeType purpose;
private: private:
RCMrcError(){} // 封じる RCMrcError(){} // 封じる
public: public:
RCMrcError( // この形式でしかインスタンスを作成できない RCMrcError( // この形式でしかインスタンスを作成できない
System::String ^name, System::UInt32 beg, System::UInt32 end, System::String ^msg, System::String ^name, System::UInt32 beg, System::UInt32 end, System::String ^msg,
System::String ^nameE, System::String ^msgE, System::Boolean isEnableModify, System::Boolean isAffectRom ) System::String ^nameE, System::String ^msgE, System::Boolean isEnableModify, System::Boolean isAffectRom, PurposeType purpose )
{ {
if( name == nullptr ) if( name == nullptr )
this->hName = gcnew System::String(""); this->hName = gcnew System::String("");
@ -307,6 +319,8 @@ namespace MasterEditorTWL
this->isEnableModify = isEnableModify; this->isEnableModify = isEnableModify;
this->isAffectRom = isAffectRom; this->isAffectRom = isAffectRom;
this->purpose = purpose;
} }
public: public:
property System::Boolean IsEnableModify property System::Boolean IsEnableModify
@ -341,6 +355,10 @@ namespace MasterEditorTWL
{ {
System::UInt32 get(){ return this->end; } System::UInt32 get(){ return this->end; }
} }
property PurposeType Purpose
{
PurposeType get(){ return this->purpose; }
}
public: public:
// gridViewの表示形式にあわせる // gridViewの表示形式にあわせる
cli::array<System::Object^>^ getAll( System::Boolean isJapanese ) cli::array<System::Object^>^ getAll( System::Boolean isJapanese )

View File

@ -905,7 +905,7 @@ void RCSrl::mrcReservedArea(FILE *fp)
} }
if( !bReserved ) if( !bReserved )
{ {
this->hErrorList->Add( this->makeMrcError(begin, end, false, true, "ReservedArea") ); this->hErrorList->Add( this->makeMrcError(begin, end, false, true, RCMrcError::PurposeType::Common, "ReservedArea") );
} }
} //for each } //for each
} }