blob: 203f2036f3fc2b5efdab2dd2cb4506350280b363 (
plain) (
blame)
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
|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "cipherfrm.h"
#include <swmgr.h>
#include <swconfig.h>
using namespace std;
using namespace sword;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCipherForm *CipherForm;
//---------------------------------------------------------------------------
__fastcall TCipherForm::TCipherForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TCipherForm::Button2Click(TObject *Sender)
{
SectionMap::iterator section;
ConfigEntMap::iterator entry;
SWConfig *modconf = new SWConfig(confFile.c_str());
string tmpBuf;
section = modconf->Sections.find(modName);
if (section != modconf->Sections.end()) {
entry = section->second.find("CipherKey");
if (entry != section->second.end()) {
entry->second = CipherForm->cipherEdit->Text.c_str();
modconf->Save();
delete modconf; // close file
modconf = 0;
SWMgr *mgr = new SWMgr();
SWModule *mod = mgr->Modules[modName];
mod->setKey("Ipet 2:12");
tmpBuf = mod->StripText();
mod->setKey("gen 1:10");
tmpBuf += "\r\n\r\n";
tmpBuf += mod->StripText();
Memo1->Text = tmpBuf.c_str();
delete mgr;
}
}
if (modconf)
delete modconf;
}
//---------------------------------------------------------------------------
void __fastcall TCipherForm::FormShow(TObject *Sender)
{
string tmpCaption;
tmpCaption = "Cipher Key: [";
tmpCaption += modName;
tmpCaption += "]";
Caption = tmpCaption.c_str();
}
//---------------------------------------------------------------------------
void __fastcall TCipherForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
Memo1->Text = "";
}
//---------------------------------------------------------------------------
|