//--------------------------------------------------------------------------- #include #pragma hdrstop #include "cipherfrm.h" #include #include #include #include #include "MainFrm.h" #include using namespace std; using namespace sword; //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TCipherForm *CipherForm; class SWDLLEXPORT MyMgr : public SWMgr { public: MyMgr() : SWMgr(0, 0, false) { load(); } protected: virtual void createAllModules(bool multiMod = false) { SWBuf extraConf = MainForm->getDataRootPath()+"/BibleCS/userprefs.conf"; bool exists = FileMgr::existsFile(extraConf); if (exists) { SWConfig addConfig(extraConf); this->config->augment(addConfig); } SWMgr::createAllModules(multiMod); } }; //--------------------------------------------------------------------------- __fastcall TCipherForm::TCipherForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TCipherForm::Button2Click(TObject *Sender) { SectionMap::iterator section; ConfigEntMap::iterator entry; SWBuf tmpBuf; section = config->Sections.find(modName); if (section != config->Sections.end()) { entry = section->second.find("CipherKey"); if (entry != section->second.end()) { SWConfig userPrefs(MainForm->getDataRootPath()+"/BibleCS/userprefs.conf"); userPrefs[modName]["CipherKey"] = CipherForm->cipherEdit->Text.c_str(); userPrefs.save(); SWMgr *mgr = new MyMgr(); SWModule *mod = mgr->getModule(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; } } } //--------------------------------------------------------------------------- void __fastcall TCipherForm::FormShow(TObject *Sender) { SWBuf tmpCaption; tmpCaption = "Cipher Key: ["; tmpCaption += modName; tmpCaption += "]"; Caption = tmpCaption.c_str(); } //--------------------------------------------------------------------------- void __fastcall TCipherForm::FormClose(TObject *Sender, TCloseAction &Action) { Memo1->Text = ""; } //---------------------------------------------------------------------------