-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanPlatform.cpp
99 lines (99 loc) · 2.13 KB
/
cleanPlatform.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "G.h"
#include "GetPFM_DLG.h"
s32 G::mGetPFMEndian( void )
{
return pfmEndian_D->GetSelection();
}
PFM G::mGetPFM( void )
{
xStr text;
PFM pfm = gGetPFM();
pfm.endian = pfmEndian_D->GetSelection();
text = pfmName_TXT->GetValue();
pfm.nowName = !text.IsEmpty() ? text : pfm.oldName;
text = pfmFile_TXT->GetValue();
pfm.nowFile = !text.IsEmpty() ? text : pfm.oldFile;
return pfm;
}
void G::mShowPFM( void )
{
PFM pfm = gGetPFM();
pfmEndian_D->Select( pfm.endian );
pfmName_TXT->ChangeValue( pfm.nowName );
pfmFile_TXT->ChangeValue( pfm.nowFile );
}
void G::mSavePFM( void )
{
xStrT st;
wxTextFile file_TF;
ORG org = gGetOrg();
PFM pfm = gGetPFM();
xStr path, file;
gGetPFMFile( path, file );
xStr text = path + org.oldFile + gGetSlash();
if ( wxDirExists( text ) )
{
path = text;
text += pfm.oldFile + wxT( ".hexb" );
if ( wxFileExists( text ) )
{
wxRenameFile( text, path + pfm.nowFile + wxT( ".hexb" ) );
}
}
file_TF.Open( file );
for
(
text = file_TF.GetFirstLine();
!file_TF.Eof();
text = file_TF.GetNextLine()
)
{
st.SetString( text, wxT( "=" ) );
text = st.GetNextToken();
if ( text.CmpNoCase( pfm.oldName ) == 0 )
{
file_TF.RemoveLine( file_TF.GetCurrentLine() );
break;
}
}
switch ( pfm.endian )
{
case ENDIAN_BIG: text = wxT( ";1" ); break;
case ENDIAN_LB: text = wxT( ";2" ); break;
default: text = wxT( ";0" ); break;
}
file_TF.AddLine(
pfm.nowName + wxT( "=" ) +
pfm.nowFile + text,
wxTextFileType_Dos );
pfm.oldName = pfm.nowName;
pfm.oldFile = pfm.nowFile;
gSetPFM( pfm );
file_TF.Write( wxTextFileType_Dos );
file_TF.Close();
}
void G::mLoadPFM( void )
{
GetPFM_DLG d( this );
if ( d.ShowModal() == wxID_OK )
{
mShowPFM();
mLoadBin();
}
}
void G::mListPFM_OnClick( wxCommandEvent& event )
{
mLoadPFM();
}
void G::mLoadPFM_OnClick( wxCommandEvent& event )
{
mLoadPFM();
}
void G::mSavePFM_OnClick( wxCommandEvent& event )
{
mSavePFM();
}
void G::mSetPFM_OnClick( wxCommandEvent& event )
{
gSetPFM( mGetPFM() );
}