-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetOrg_DLG_FileIO.cpp
62 lines (62 loc) · 1.55 KB
/
GetOrg_DLG_FileIO.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
#include "GetOrg_DLG.h"
void GetOrg_DLG::dLoadOrg( void )
{
isModified = false;
bool atKey = false;
long i = 0;
ORG* org;
xStr text, path, file, name;
gGetOrgFile( path, file );
s8 index = dOrgName_LB->GetCount();
for ( --index; index >= 0; --index )
{
org = dGetOrg( index );
if ( !org->isDefault ) dOrgName_LB->Delete( index );
}
org = new ORG;
org->isDefault = false;
wxFileConfig cfgIni( gGetTitle(), gGetVendor(), file );
cfgIni.SetPath( orgIni );
for
(
atKey = cfgIni.GetFirstEntry( name, i );
atKey;
atKey = cfgIni.GetNextEntry( name, i )
)
{
org->oldName = name;
org->nowName = name;
text = cfgIni.Read( name, name );
org->oldFile = text;
org->nowFile = text;
dNewOrg( org );
}
delete org;
dOrgName_LB->Select( 0 );
dShowOrg();
}
void GetOrg_DLG::dSaveOrg( void )
{
ORG* org;
isModified = false;
xStr text, path, file, name;
gGetOrgFile( path, file );
s8 i = 1;
s8 iCount = dOrgName_LB->GetCount();
wxFileConfig cfgIni( gGetTitle(), gGetVendor(), file );
cfgIni.DeleteGroup( orgIni );
cfgIni.SetPath( orgIni );
gGetPFMFile( path, file );
for ( ; i < iCount; ++i )
{
org = dGetOrg( i );
if ( org->isDefault ) continue;
cfgIni.Write( org->nowName, org->nowFile );
// Change old data
file = path + org->oldFile + wxT( ".hexp" );
if ( wxFileExists( file ) )
wxRenameFile( file, path + org->nowFile + wxT( ".hexp" ) );
org->oldName = org->nowName;
org->oldFile = org->nowFile;
}
}