mirror of
https://github.com/rvtr/TwlToolsRED.git
synced 2025-10-31 06:41:18 -04:00
マスタエディタ:コマンドライン引数でSRL/TADを指定可能にした。コンストラクタから呼ばれる初期処理を別ファイルに分離。
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@103 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
parent
ffb5d834a5
commit
71b8b57b20
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -29,7 +29,9 @@ namespace MasterEditorTWL {
|
||||
/// </summary>
|
||||
public ref class Form1 : public System::Windows::Forms::Form
|
||||
{
|
||||
/////////////////////////////////////////////
|
||||
// 独自追加フィールド
|
||||
/////////////////////////////////////////////
|
||||
private:
|
||||
// SRL情報(ROMヘッダを含む)
|
||||
RCSrl ^hSrl;
|
||||
@ -54,7 +56,9 @@ namespace MasterEditorTWL {
|
||||
System::Boolean IsCheckedUGC; // 読み込み時にチェックされていたか
|
||||
System::Boolean IsCheckedPhotoEx;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// VC自動追加フィールド
|
||||
/////////////////////////////////////////////
|
||||
private: System::Windows::Forms::GroupBox^ gboxCRC;
|
||||
private: System::Windows::Forms::TextBox^ tboxWholeCRC;
|
||||
|
||||
@ -707,77 +711,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
|
||||
//
|
||||
//TODO: ここにコンストラクタ コードを追加します
|
||||
//
|
||||
this->hSrl = gcnew (RCSrl);
|
||||
this->hDeliv = gcnew (RCDeliverable);
|
||||
this->IsLoadTad = false;
|
||||
this->hErrorList = gcnew System::Collections::Generic::List<RCMrcError^>();
|
||||
this->hErrorList->Clear();
|
||||
this->hWarnList = gcnew System::Collections::Generic::List<RCMrcError^>();
|
||||
this->hWarnList->Clear();
|
||||
this->IsCheckedUGC = false;
|
||||
this->IsCheckedPhotoEx = false;
|
||||
|
||||
// バージョン情報を表示
|
||||
//this->labAssemblyVersion->Text = System::Windows::Forms::Application::ProductVersion;
|
||||
System::Reflection::Assembly ^ass = System::Reflection::Assembly::GetEntryAssembly();
|
||||
this->labAssemblyVersion->Text = "ver." + this->getVersion();
|
||||
|
||||
// TAD読み込みの際に作成される一時ファイルと同名ファイルがあった場合には削除してよいか確認
|
||||
System::Diagnostics::Debug::WriteLine( this->getSplitTadTmpFile() );
|
||||
if( System::IO::File::Exists( this->getSplitTadTmpFile() ) )
|
||||
{
|
||||
this->sucMsg( "本プログラムで作成する一時ファイルと同名のファイルが存在します。このファイルを削除します。",
|
||||
"There is the file which has same name as temporary file made by this program. That file is deleted." );
|
||||
System::IO::File::Delete( this->getSplitTadTmpFile() );
|
||||
}
|
||||
|
||||
// デフォルト値
|
||||
this->IsSpreadSheet = true;
|
||||
this->IsReadOnly = false;
|
||||
this->dateRelease->Value = System::DateTime::Now;
|
||||
this->dateSubmit->Value = System::DateTime::Now;
|
||||
#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
|
||||
this->combRegion->Items->Add( gcnew System::String( L"全リージョン" ) );
|
||||
#endif
|
||||
|
||||
// アプリ種別をつける
|
||||
System::String ^appstr = nullptr;
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
appstr += "Launcher/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
appstr += "Secure/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
appstr += "System/";
|
||||
#endif
|
||||
if( appstr != nullptr)
|
||||
{
|
||||
this->Text += " [ Supported App: " + appstr + "User ]";
|
||||
}
|
||||
|
||||
// 複数行表示の改行を挿入
|
||||
this->tboxGuideRomEditInfo->Text = this->tboxGuideRomEditInfo->Text->Replace( "<newline>", "\r\n" );
|
||||
this->tboxGuideErrorInfo->Text = this->tboxGuideErrorInfo->Text->Replace( "<newline>", "\r\n" );
|
||||
|
||||
// 言語バージョンにあわせてメニューにチェックを入れる
|
||||
if( System::Threading::Thread::CurrentThread->CurrentUICulture->Name->StartsWith( "ja" ) )
|
||||
{
|
||||
this->stripItemJapanese->Checked = true;
|
||||
this->stripItemEnglish->Checked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->stripItemJapanese->Checked = false;
|
||||
this->stripItemEnglish->Checked = true;
|
||||
}
|
||||
|
||||
// 非表示項目
|
||||
this->changeVisibleForms( false );
|
||||
|
||||
// 設定ファイルの読み込み
|
||||
this->loadInit();
|
||||
this->loadAppendInit(); // 追加設定ファイル
|
||||
this->construct();
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -786,12 +720,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
|
||||
/// </summary>
|
||||
~Form1()
|
||||
{
|
||||
// TAD読み出しの際に作成される一時SRLファイルを削除(書き出しをせずに終了したときに起こりうる)
|
||||
System::String ^srlfile = this->getSplitTadTmpFile();
|
||||
if( System::IO::File::Exists( srlfile ) )
|
||||
{
|
||||
System::IO::File::Delete( srlfile ); // すでに存在する場合は削除
|
||||
}
|
||||
this->destruct();
|
||||
|
||||
if (components)
|
||||
{
|
||||
@ -2826,6 +2755,15 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
|
||||
/////////////////////////////////////////////
|
||||
// 内部メソッド
|
||||
/////////////////////////////////////////////
|
||||
private:
|
||||
// ----------------------------------------------
|
||||
// 初期処理 / 終了処理
|
||||
// ----------------------------------------------
|
||||
|
||||
void construct(void);
|
||||
void destruct(void);
|
||||
void handleArgs(void); // コマンドライン引数処理
|
||||
|
||||
private:
|
||||
// ----------------------------------------------
|
||||
// 設定ファイルの読み込み
|
||||
@ -2910,7 +2848,7 @@ private: System::Windows::Forms::CheckBox^ cboxIsUnnecessaryRating;
|
||||
|
||||
private:
|
||||
// ----------------------------------------------
|
||||
// フォームの初期設定
|
||||
// フォームの設定変更
|
||||
// ----------------------------------------------
|
||||
|
||||
// 非表示項目の表示切替
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
// ----------------------------------------------
|
||||
// 初期処理 / 終了処理
|
||||
// ----------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <apptype.h>
|
||||
#include "common.h"
|
||||
#include "srl.h"
|
||||
#include "deliverable.h"
|
||||
#include "crc_whole.h"
|
||||
#include "utility.h"
|
||||
#include "lang.h"
|
||||
#include "FormError.h"
|
||||
#include "Form1.h"
|
||||
|
||||
using namespace System;
|
||||
using namespace System::ComponentModel;
|
||||
using namespace System::Collections;
|
||||
using namespace System::Windows::Forms;
|
||||
using namespace System::Data;
|
||||
using namespace System::Drawing;
|
||||
using namespace MasterEditorTWL;
|
||||
|
||||
|
||||
// ----------------------------------------------
|
||||
// コンストラクタから呼ばれる初期処理
|
||||
// ----------------------------------------------
|
||||
void Form1::construct(void)
|
||||
{
|
||||
// フィールド初期化
|
||||
this->hSrl = gcnew (RCSrl);
|
||||
this->hDeliv = gcnew (RCDeliverable);
|
||||
this->IsLoadTad = false;
|
||||
this->hErrorList = gcnew System::Collections::Generic::List<RCMrcError^>();
|
||||
this->hErrorList->Clear();
|
||||
this->hWarnList = gcnew System::Collections::Generic::List<RCMrcError^>();
|
||||
this->hWarnList->Clear();
|
||||
this->IsCheckedUGC = false;
|
||||
this->IsCheckedPhotoEx = false;
|
||||
this->IsSpreadSheet = true;
|
||||
this->IsReadOnly = false;
|
||||
|
||||
// バージョン情報を表示
|
||||
//this->labAssemblyVersion->Text = System::Windows::Forms::Application::ProductVersion;
|
||||
System::Reflection::Assembly ^ass = System::Reflection::Assembly::GetEntryAssembly();
|
||||
this->labAssemblyVersion->Text = "ver." + this->getVersion();
|
||||
|
||||
// TAD読み込みの際に作成される一時ファイルと同名ファイルがあった場合には削除してよいか確認
|
||||
//System::Diagnostics::Debug::WriteLine( this->getSplitTadTmpFile() );
|
||||
if( System::IO::File::Exists( this->getSplitTadTmpFile() ) )
|
||||
{
|
||||
this->sucMsg( "本プログラムで作成する一時ファイルと同名のファイルが存在します。このファイルを削除します。",
|
||||
"There is the file which has same name as temporary file made by this program. That file is deleted." );
|
||||
System::IO::File::Delete( this->getSplitTadTmpFile() );
|
||||
}
|
||||
|
||||
// 日付フォームの初期設定を現在の時刻にする
|
||||
this->dateRelease->Value = System::DateTime::Now;
|
||||
this->dateSubmit->Value = System::DateTime::Now;
|
||||
|
||||
// システム版のときにはリージョンに全リージョンの項目を追加
|
||||
#if defined(METWL_VER_APPTYPE_SYSTEM) || defined(METWL_VER_APPTYPE_SECURE) || defined(METWL_VER_APPTYPE_LAUNCHER)
|
||||
this->combRegion->Items->Add( gcnew System::String( L"全リージョン" ) );
|
||||
#endif
|
||||
|
||||
// アプリ種別をつける
|
||||
System::String ^appstr = nullptr;
|
||||
#ifdef METWL_VER_APPTYPE_LAUNCHER
|
||||
appstr += "Launcher/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SECURE
|
||||
appstr += "Secure/";
|
||||
#endif
|
||||
#ifdef METWL_VER_APPTYPE_SYSTEM
|
||||
appstr += "System/";
|
||||
#endif
|
||||
if( appstr != nullptr)
|
||||
{
|
||||
this->Text += " [ Supported App: " + appstr + "User ]";
|
||||
}
|
||||
|
||||
// 複数行表示の改行を挿入
|
||||
this->tboxGuideRomEditInfo->Text = this->tboxGuideRomEditInfo->Text->Replace( "<newline>", "\r\n" );
|
||||
this->tboxGuideErrorInfo->Text = this->tboxGuideErrorInfo->Text->Replace( "<newline>", "\r\n" );
|
||||
|
||||
// 言語バージョンにあわせてメニューにチェックを入れる
|
||||
if( System::Threading::Thread::CurrentThread->CurrentUICulture->Name->StartsWith( "ja" ) )
|
||||
{
|
||||
this->stripItemJapanese->Checked = true;
|
||||
this->stripItemEnglish->Checked = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->stripItemJapanese->Checked = false;
|
||||
this->stripItemEnglish->Checked = true;
|
||||
}
|
||||
|
||||
// 非表示項目
|
||||
this->changeVisibleForms( false );
|
||||
|
||||
// 設定ファイルの読み込み
|
||||
this->loadInit();
|
||||
this->loadAppendInit(); // 追加設定ファイル
|
||||
|
||||
// 引数処理
|
||||
this->handleArgs();
|
||||
//System::Diagnostics::Debug::WriteLine( "constructed" );
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------
|
||||
// デストラクタから呼ばれる終了処理
|
||||
// ----------------------------------------------
|
||||
void Form1::destruct(void)
|
||||
{
|
||||
// TAD読み出しの際に作成される一時SRLファイルを削除(書き出しをせずに終了したときに起こりうる)
|
||||
System::String ^srlfile = this->getSplitTadTmpFile();
|
||||
if( System::IO::File::Exists( srlfile ) )
|
||||
{
|
||||
System::IO::File::Delete( srlfile ); // すでに存在する場合は削除
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------
|
||||
// コマンドライン引数処理
|
||||
// ----------------------------------------------
|
||||
void Form1::handleArgs(void)
|
||||
{
|
||||
cli::array<System::String^> ^args = System::Environment::GetCommandLineArgs();
|
||||
if( args->Length < 2 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 引数でsrlが指定されているときは読み込む
|
||||
System::String ^romfile = args[1];
|
||||
if( !this->loadRom( romfile ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
System::String ^rompath;
|
||||
{
|
||||
// 表示のために絶対パスに変換
|
||||
System::String ^currdir = System::Environment::CurrentDirectory;
|
||||
if( !currdir->EndsWith( "\\" ) )
|
||||
{
|
||||
currdir = currdir + "\\";
|
||||
}
|
||||
rompath = romfile->Replace( '/', '\\' );
|
||||
rompath = currdir + rompath;
|
||||
}
|
||||
this->tboxFile->Text = rompath;
|
||||
this->clearOtherForms();
|
||||
}
|
||||
@ -135,6 +135,7 @@ void Form1::loadTmp( System::String ^filename )
|
||||
{
|
||||
this->loadRom(text); // tad/srl—¼‘Ήž
|
||||
this->tboxFile->Text = text;
|
||||
this->clearOtherForms();
|
||||
}
|
||||
|
||||
// Œ¾Œê
|
||||
|
||||
@ -211,6 +211,10 @@
|
||||
RelativePath=".\deliverable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Form_constructor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Form_deliv.cpp"
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user