フィンガープリントプログラム:すでにフィンガープリントされているときは別ウインドウで注意書きを出すようにした。Copyrightのウインドウも追加。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@260 7061adef-622a-194b-ae81-725974e89856
This commit is contained in:
nishikawa_takeshi 2009-04-16 13:01:11 +00:00
parent a796e33f0f
commit 5bba671855
7 changed files with 135 additions and 42 deletions

View File

@ -215,6 +215,14 @@
RelativePath=".\Form1.cpp"
>
</File>
<File
RelativePath=".\FormAbout.cpp"
>
</File>
<File
RelativePath=".\FormCheck.cpp"
>
</File>
<File
RelativePath="..\..\MasterEditorTWL\MasterEditorTWL\keys.cpp"
>
@ -267,6 +275,26 @@
>
</File>
</File>
<File
RelativePath=".\FormAbout.h"
FileType="3"
>
<File
RelativePath=".\FormAbout.resx"
SubType="Designer"
>
</File>
</File>
<File
RelativePath=".\FormCheck.h"
FileType="3"
>
<File
RelativePath=".\FormCheck.resx"
SubType="Designer"
>
</File>
</File>
<File
RelativePath=".\resource.h"
>

View File

@ -1,6 +1,8 @@
#include "stdafx.h"
#include "Form1.h"
#include "FormCheck.h"
#include "FormAbout.h"
#include <twl/types.h>
#include <twl/os/common/format_rom.h>
#include <cstring>
@ -103,6 +105,14 @@ void Form1::commonOpenRom( System::String ^srcpath )
}
memset( this->rh, 0, sizeof(ROM_Header) );
ExtractRomHeader( this->srlbin, this->rh );
// すでにフィンガープリントされている場合には注意書きを表示
if( this->isFingerprint() )
{
FormCheck ^form = gcnew FormCheck;
form->displayFingerprint( this->rh->s.reserved_C );
form->Show();
}
}
void Form1::commonSaveRom( System::String ^dstpath )
@ -211,6 +221,18 @@ void Form1::procSaveRomButton()
}
}
void Form1::procAboutButton()
{
try
{
FormAbout ^form = gcnew FormAbout;
form->Show();
}
catch( System::Exception ^ex )
{
this->errMsg( ex->Message );
}
}
// ------------------------------------------------------------------
// エラーメッセージ

View File

@ -94,6 +94,9 @@ namespace FingerPrinterTWL {
this->labFile = (gcnew System::Windows::Forms::Label());
this->butFile = (gcnew System::Windows::Forms::Button());
this->gboxFP = (gcnew System::Windows::Forms::GroupBox());
this->gboxFormat = (gcnew System::Windows::Forms::GroupBox());
this->rTad = (gcnew System::Windows::Forms::RadioButton());
this->rSrl = (gcnew System::Windows::Forms::RadioButton());
this->labFP = (gcnew System::Windows::Forms::Label());
this->labShorter = (gcnew System::Windows::Forms::Label());
this->butFP = (gcnew System::Windows::Forms::Button());
@ -104,12 +107,9 @@ namespace FingerPrinterTWL {
this->rString = (gcnew System::Windows::Forms::RadioButton());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->gboxFormat = (gcnew System::Windows::Forms::GroupBox());
this->rSrl = (gcnew System::Windows::Forms::RadioButton());
this->rTad = (gcnew System::Windows::Forms::RadioButton());
this->gboxFP->SuspendLayout();
this->gboxType->SuspendLayout();
this->gboxFormat->SuspendLayout();
this->gboxType->SuspendLayout();
this->SuspendLayout();
//
// tboxFile
@ -154,6 +154,40 @@ namespace FingerPrinterTWL {
this->gboxFP->TabIndex = 3;
this->gboxFP->TabStop = false;
//
// gboxFormat
//
this->gboxFormat->Controls->Add(this->rTad);
this->gboxFormat->Controls->Add(this->rSrl);
this->gboxFormat->Location = System::Drawing::Point(22, 101);
this->gboxFormat->Name = L"gboxFormat";
this->gboxFormat->Size = System::Drawing::Size(161, 76);
this->gboxFormat->TabIndex = 6;
this->gboxFormat->TabStop = false;
this->gboxFormat->Text = L"Output Format";
//
// rTad
//
this->rTad->AutoSize = true;
this->rTad->Location = System::Drawing::Point(12, 49);
this->rTad->Name = L"rTad";
this->rTad->Size = System::Drawing::Size(46, 16);
this->rTad->TabIndex = 1;
this->rTad->TabStop = true;
this->rTad->Text = L"TAD";
this->rTad->UseVisualStyleBackColor = true;
//
// rSrl
//
this->rSrl->AutoSize = true;
this->rSrl->Checked = true;
this->rSrl->Location = System::Drawing::Point(12, 24);
this->rSrl->Name = L"rSrl";
this->rSrl->Size = System::Drawing::Size(44, 16);
this->rSrl->TabIndex = 0;
this->rSrl->TabStop = true;
this->rSrl->Text = L"SRL";
this->rSrl->UseVisualStyleBackColor = true;
//
// labFP
//
this->labFP->AutoSize = true;
@ -242,6 +276,7 @@ namespace FingerPrinterTWL {
this->button1->TabIndex = 4;
this->button1->Text = L"About This Application";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// label1
//
@ -252,40 +287,6 @@ namespace FingerPrinterTWL {
this->label1->TabIndex = 5;
this->label1->Text = L"Supported ROM type: TWL application (SRL/TAD)";
//
// gboxFormat
//
this->gboxFormat->Controls->Add(this->rTad);
this->gboxFormat->Controls->Add(this->rSrl);
this->gboxFormat->Location = System::Drawing::Point(22, 101);
this->gboxFormat->Name = L"gboxFormat";
this->gboxFormat->Size = System::Drawing::Size(161, 76);
this->gboxFormat->TabIndex = 6;
this->gboxFormat->TabStop = false;
this->gboxFormat->Text = L"Output Format";
//
// rSrl
//
this->rSrl->AutoSize = true;
this->rSrl->Checked = true;
this->rSrl->Location = System::Drawing::Point(12, 24);
this->rSrl->Name = L"rSrl";
this->rSrl->Size = System::Drawing::Size(44, 16);
this->rSrl->TabIndex = 0;
this->rSrl->TabStop = true;
this->rSrl->Text = L"SRL";
this->rSrl->UseVisualStyleBackColor = true;
//
// rTad
//
this->rTad->AutoSize = true;
this->rTad->Location = System::Drawing::Point(12, 49);
this->rTad->Name = L"rTad";
this->rTad->Size = System::Drawing::Size(46, 16);
this->rTad->TabIndex = 1;
this->rTad->TabStop = true;
this->rTad->Text = L"TAD";
this->rTad->UseVisualStyleBackColor = true;
//
// Form1
//
this->AllowDrop = true;
@ -303,10 +304,10 @@ namespace FingerPrinterTWL {
this->DragEnter += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragEnter);
this->gboxFP->ResumeLayout(false);
this->gboxFP->PerformLayout();
this->gboxType->ResumeLayout(false);
this->gboxType->PerformLayout();
this->gboxFormat->ResumeLayout(false);
this->gboxFormat->PerformLayout();
this->gboxType->ResumeLayout(false);
this->gboxType->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
@ -339,6 +340,7 @@ namespace FingerPrinterTWL {
private:
void procOpenRomButton( System::String ^path );
void procSaveRomButton();
void procAboutButton();
// ダイアログ
private:
@ -376,6 +378,12 @@ namespace FingerPrinterTWL {
String ^path = files[0];
this->procOpenRomButton( path ); // ボタンが押されたときと同じ挙動
}
// <20>Äу{ƒ^ƒ“
private:
System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
this->procAboutButton();
}
};
}

View File

@ -45,9 +45,12 @@ cli::array<System::Byte>^ TransStringToBytes( System::String ^src, const int len
// 16進文字列をバイト配列に変換
cli::array<System::Byte>^ TransHexStringToBytes( System::String ^src, const int len );
// バイト配列を16進文字列に変換
// バイト配列を文字列に変換
System::String^ TransBytesToString( cli::array<System::Byte> ^bytes );
// バイト配列を16進文字列に変換
System::String^ TransBytesToHexString( cli::array<System::Byte> ^bytes );
// ----------------------------------------------------------------------
// GUI
// ----------------------------------------------------------------------

View File

@ -382,6 +382,31 @@ cli::array<System::Byte>^ TransHexStringToBytes( System::String ^src, const int
return bytes;
}
// バイト配列を文字列に変換
System::String^ TransBytesToString( cli::array<System::Byte> ^bytes )
{
System::String ^str = gcnew System::String("");
int i;
for( i=0; i < bytes->Length; i++ )
{
if( (0x20 <= bytes[i]) && (bytes[i] <= 0x7E) )
{
char c[2];
c[0] = bytes[i]; c[1] = 0;
str += gcnew System::String( c );
}
else
{
str += " ";
}
if( !((i+1) % 16) )
{
str += "\r\n";
}
}
return str;
}
// バイト配列を16進文字列に変換
System::String^ TransBytesToHexString( cli::array<System::Byte> ^bytes )
{
@ -392,7 +417,14 @@ System::String^ TransBytesToHexString( cli::array<System::Byte> ^bytes )
{
System::Byte b = bytes[i];
str += System::String::Format( "{0:X02}", (char)b );
str += " ";
if( (i+1) % 16 )
{
str += " ";
}
else
{
str += "\r\n";
}
}
return str;
}