//--------------------------------------------------------------------------- void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteInteger(SectionWindow, KeyTop, Top); IniFile->WriteInteger(SectionWindow, KeyLeft, Left); IniFile->WriteInteger(SectionWindow, KeyWidth, Width); IniFile->WriteInteger(SectionWindow, KeyHeight, Height); IniFile->WriteString(SectionData, KeyUrl, URLEdit->Text); IniFile->WriteString(SectionData, KeySocksServer, SocksServerEdit->Text); IniFile->WriteString(SectionData, KeySocksPort, SocksPortEdit->Text); IniFile->WriteString(SectionData, KeyProxyHost, ProxyHostEdit->Text); IniFile->WriteString(SectionData, KeyProxyPort, ProxyPortEdit->Text); IniFile->WriteBool(SectionData, KeyVerifyPeer, VerifyPeerCheckBox->Checked); IniFile->WriteString(SectionData, KeyDoc, DocEdit->Text); IniFile->WriteString(SectionData, KeyCertFile, CertFileEdit->Text); IniFile->WriteString(SectionData, KeyPrivKeyFile, PrivKeyFileEdit->Text); IniFile->WriteString(SectionData, KeyPassPhrase, PassPhraseEdit->Text); IniFile->WriteString(SectionData, KeyCAFile, CAFileEdit->Text); IniFile->WriteString(SectionData, KeyCAPath, CAPathEdit->Text); IniFile->WriteString(SectionData, KeyAcceptableHosts, AcceptableHostsEdit->Text); IniFile->WriteInteger(SectionData, KeySocksLevel, SocksLevelComboBox->ItemIndex); IniFile->WriteInteger(SectionData, KeyHttpVer, HttpVersionComboBox->ItemIndex); IniFile->WriteBool(SectionData, KeySessCache, SessCacheCheckBox->Checked); IniFile->WriteBool(SectionData, KeyDebugEvent, DebugEventCheckBox->Checked); IniFile->WriteBool(SectionData, KeyDebugOutput, DebugOutputCheckBox->Checked); IniFile->WriteBool(SectionData, KeyDebugFile, DebugFileCheckBox->Checked); delete IniFile; }
//--------------------------------------------------------------------------- void __fastcall CIniFile::StoreHistory(int nYear,int nMonth,int nDate,AnsiString strMessage) { AnsiString strFileName; TIniFile *pIniFile; int nFileMonth,nIndex; strFileName.sprintf("%s\\Message History\\%4d_%02d_%02d.ini",IniFile_Dir,nYear,nMonth,nDate); pIniFile = new TIniFile(strFileName); nFileMonth=pIniFile->ReadInteger("Control","Month",1); nIndex=pIniFile->ReadInteger("Control","Index",1); if(nFileMonth!=nMonth) { nIndex=1; pIniFile->WriteInteger("Control","Month",nMonth); } AnsiString strID; strID.sprintf("No%08d",nIndex); pIniFile->WriteString("History",strID,strMessage); nIndex++; strID.sprintf("No%08d",nIndex); pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//"); pIniFile->WriteInteger("Control","Index",nIndex); delete pIniFile; }
void TSettings::SaveToFile() { TSettings *Settings = TSettings::Instance(); TIniFile *ini = new TIniFile(".\\settings.cfg"); ini->WriteBool("Global", "FullScreen", Settings->Fullscreen); ini->WriteInteger("Global", "Width", Settings->FormsWidth); ini->WriteInteger("Global", "Height", Settings->FormsHeight); ini->WriteInteger("Global", "Left", Settings->FormsLeft); ini->WriteInteger("Global", "Top", Settings->FormsTop); ini->WriteBool("Global", "Sound", Settings->SoundEnabled); ini->WriteInteger("Global", "SoundVolume", Settings->SoundVolume); ini->WriteBool("Global", "Music", Settings->MusicEnabled); ini->WriteInteger("Global", "MusicVolume", Settings->MusicVolume); ini->WriteBool("Global", "HostMode", Settings->HostMode); ini->WriteString("Global", "LastBase", Settings->LastBase); for (int i = 1; i <= 5; i++) { ini->WriteString("Players", "Player" + IntToStr(i), Settings->PlayerNames[i - 1]); ini->WriteInteger("Players", "PlayerType" + IntToStr(i), (int) Settings->PlayerType[i - 1]); } int i = 0; for (std::map <String, String> ::iterator it = BaseFiles.begin(); it != BaseFiles.end(); ++it) { ini->WriteString("Bases", "basename" + IntToStr(i), it->first); ini->WriteString("Bases", "base" + IntToStr(i), ExtractFileName(it->second)); ++i; } ini->Free(); }
void __fastcall TFormMain::SaveParam() { TIniFile *ini = new TIniFile(ExtractFilePath(Application->ExeName) + PARAM_FILE); ini->WriteString("ftp", "Host", this->Crypt(this->EditHost->Text)); ini->WriteString("ftp", "Login", this->Crypt(this->EditLogin->Text)); ini->WriteString("ftp", "Password", this->Crypt(this->EditPassword->Text)); ini->WriteString("ftp", "Port", this->Crypt(this->EditPort->Text)); ini->WriteString("ftp", "Pwd", this->Crypt(this->EditPwd->Text)); ini->Free(); }
//--------------------------------------------------------------------------- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *ini; ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI " ) ); ini->WriteInteger( "Form ", "Top ", Top ); ini->WriteInteger( "Form ", "Left ", Left ); ini->WriteString ( "Form ", "Caption ", Caption ); ini->WriteString ( "Form ", "DefaultDir ", Edit1->Text ); delete ini; }
//--------------------------------------------------------------------------- void __fastcall CIniFile::StoreHistoryNew() { AnsiString strFileName; TIniFile *pIniFile; int nFileMonth,nIndex; time_t timer; struct tm *tblock; int nSize=m_vecMsg.size(); if(nSize==0) return; AnsiString strMsg; strMsg.sprintf("訊息共有 %d 筆\n每筆花費時間約 10 ms\n是否要儲存訊息??",nSize); if(Application->MessageBoxA(strMsg.c_str(),"Confirm",MB_ICONQUESTION|MB_OKCANCEL)!=IDOK) return; /* gets time of day */ timer = time(NULL); /* converts date/time to a structure */ tblock = localtime(&timer); int nMonth=tblock->tm_mon; int nDate=tblock->tm_mday; strFileName.sprintf("%s\\Message History\\%d.ini",IniFile_Dir,nDate); pIniFile = new TIniFile(strFileName); nFileMonth=pIniFile->ReadInteger("Control","Month",1); nIndex=pIniFile->ReadInteger("Control","Index",1); if(nFileMonth!=nMonth) { DeleteFile(strFileName); nIndex=1; pIniFile->WriteInteger("Control","Month",nMonth); } AnsiString strID; for(int nSz=0;nSz<nSize;nSz++) { strID.sprintf("No%08d",nIndex); pIniFile->WriteString("History",strID,m_vecMsg[nSz]); nIndex++; } m_vecMsg.clear(); strID.sprintf("No%08d",nIndex); pIniFile->WriteString("History",strID,"//-------------以下做作廢--------------------//"); pIniFile->WriteInteger("Control","Index",nIndex); delete pIniFile; }
//--------------------------------------------------------------------------- void __fastcall TPOP3ExcercizerForm::FormCloseQuery( TObject *Sender, bool &CanClose) { TIniFile *IniFile; IniFile = new TIniFile(IniFileName); IniFile->WriteString("Data", "Host", HostEdit->Text); IniFile->WriteString("Data", "Port", PortEdit->Text); IniFile->WriteString("Data", "UserName", UserNameEdit->Text); IniFile->WriteString("Data", "Password", PassWordEdit->Text); delete IniFile; }
//--------------------------------------------------------------------------- void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteString("Data", "URL", URLEdit->Text); IniFile->WriteString("Data", "ProxyHost", ProxyHostEdit->Text); IniFile->WriteString("Data", "ProxyPort", ProxyPortEdit->Text); IniFile->WriteString("Data", "Data", DataEdit->Text); IniFile->WriteString("Data", "DateTime", DateTimeEdit->Text); delete IniFile; }
//--------------------------------------------------------------------------- void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteInteger(SectionWindow, KeyTop, Top); IniFile->WriteInteger(SectionWindow, KeyLeft, Left); IniFile->WriteInteger(SectionWindow, KeyWidth, Width); IniFile->WriteInteger(SectionWindow, KeyHeight, Height); IniFile->WriteString(SectionData, KeyPort, PortEdit->Text); IniFile->WriteString(SectionData, KeyServer, ServerEdit->Text); delete IniFile; }
void __fastcall TMainForm::FormDestroy(TObject *Sender) { if( !isCorrect ) // если выбраные файлы не открылись, не нужно их сохранять в .ini return; TIniFile *ini = new TIniFile(iniFile); try { ini->WriteString( "FileName", "file-copy", fcPanel->Caption ); ini->WriteString( "FileName", "cyclogram", cPanel->Caption ); } __finally { ini->Free(); clearAll(); } }
//--------------------------------------------------------------------------- void __fastcall THttpTestForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteString(SectionData, KeyUserID, UserIDEdit->Text); IniFile->WriteString(SectionData, KeyProxy, ProxyEdit->Text); IniFile->WriteString(SectionData, KeyMessage, MessageEdit->Text); IniFile->WriteString(SectionData, KeyEMail, EMailEdit->Text); IniFile->WriteInteger(SectionWindow, KeyTop, Top); IniFile->WriteInteger(SectionWindow, KeyLeft, Left); IniFile->WriteInteger(SectionWindow, KeyWidth, Width); IniFile->WriteInteger(SectionWindow, KeyHeight, Height); delete IniFile; }
//--------------------------------------------------------------------------- void __fastcall TClientForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(IniFileName); IniFile->WriteInteger("Window", "Top", Top); IniFile->WriteInteger("Window", "Left", Left); IniFile->WriteInteger("Window", "Width", Width); IniFile->WriteInteger("Window", "Height", Height); IniFile->WriteString("Data", "Server", ServerEdit->Text); IniFile->WriteString("Data", "Port", PortEdit->Text); IniFile->WriteString("Data", "Command", SendEdit->Text); delete IniFile; }
void __fastcall TFastConfigForm::test_and_go_butClick(TObject *Sender) { db_prop.host = db_host_edit->Text; db_prop.name = db_name_edit->Text; db_prop.user = db_user_edit->Text; db_prop.pass = db_pass_edit->Text; tables_prefix = db_prf_edit->Text; TIniFile *inifile = new TIniFile(config_ini_path); inifile->WriteString("DB Connection Properties", "HostName", db_prop.host); inifile->WriteString("DB Connection Properties", "Database", db_prop.name); inifile->WriteString("DB Connection Properties", "User_Name", db_prop.user); inifile->WriteString("DB Connection Properties", "Password", db_prop.pass); inifile->WriteString("DB Connection Properties", "Prefix", tables_prefix); delete inifile; }
//--------------------------------------------------------------------------- void __fastcall SaveFormPos(TForm *Form, const AnsiString IniFileName, const AnsiString SectionName, const AnsiString KeyName) { TIniFile *IniFile; TWindowState WindowState; char Buffer[256]; if (IniFileName.Length() == 0) return; // Create inifile object => Open ini file IniFile = new TIniFile(IniFileName); WindowState = Form->WindowState; // If window minimized or maximized, restore to normal state if (Form->WindowState != wsNormal) Form->WindowState = wsNormal; // Save the window's postion and size to the ini file IniFile->WriteString(SectionName, KeyName, WindowPosToStr(Buffer, Form)); // Destroy inifile object => close ini file IniFile->Free(); Form->WindowState = WindowState; }
//--------------------------------------------------------------------------- void __fastcall TForm1::CodeBtnClick(TObject *Sender) { TCode Work; String S = ""; // ask for code if (InputQuery("Usage Code Entry", "Enter the code", S)) { TIniFile* Ini = new TIniFile("ONGUARD.INI"); try { // store the usage code in the ini file if it looks OK if (HexToBuffer(S, &Work, sizeof(Work))) { // save the value Ini->WriteString("Codes", "UsageCode", S); CodeLbl->Caption = S; // tell the code component to test the new code, reporting the results OgUsageCode1->CheckCode(true); } } catch (...) { delete Ini; Ini = 0; } delete Ini; } }
//--------------------------------------------------------------------------- void __fastcall TfrmMain::SaveSetting() { TIniFile* ini = new TIniFile( String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Setting.ini"); ini->WriteInteger("AutoGuagi","X",AutoGuagi_X); ini->WriteInteger("AutoGuagi","Y",AutoGuagi_Y); ini->WriteInteger("AutoGuagi","MapId",AutoGuagi_MapId); ini->WriteBool("Setting","godmode",this->ck_func_godmode->IsChecked); ini->WriteBool("Setting","dingua",this->ck_func_dingua->IsChecked); ini->WriteBool("Setting","csx",this->ck_func_csx->IsChecked); ini->WriteBool("Setting","autolr",this->ck_func_autolr->IsChecked); ini->WriteBool("Setting","chardir",this->ck_func_chardir->IsChecked); ini->WriteBool("Setting","chardir_v",this->sw_func_chardir->IsChecked); ini->WriteBool("Setting","dingwei",this->ck_func_dingwei->IsChecked); ini->WriteBool("Setting","hidebk",this->ck_func_hidebk->IsChecked); ini->WriteBool("Setting","hidedmg",this->ck_func_hidedmg->IsChecked); ini->WriteBool("Setting","hideskill",this->ck_func_hideskill->IsChecked); ini->WriteBool("Setting","itemvac",this->ck_func_itemvac->IsChecked); ini->WriteBool("Setting","jmp",this->ck_func_jmp->IsChecked); ini->WriteBool("Setting","stupid",this->ck_func_stupid->IsChecked); ini->WriteBool("Protect","hp",this->ck_hp->IsChecked); ini->WriteBool("Protect","mp",this->ck_mp->IsChecked); ini->WriteBool("Protect","att",this->ck_att->IsChecked); ini->WriteBool("Protect","pick",this->ck_pick->IsChecked); ini->WriteBool("Protect","key1",this->ck_key1->IsChecked); ini->WriteBool("Protect","key2",this->ck_key2->IsChecked); ini->WriteBool("Protect","key3",this->ck_key3->IsChecked); ini->WriteBool("Protect","key4",this->ck_key4->IsChecked); ini->WriteString("Protect","hp_v",this->txt_hp->Text); ini->WriteString("Protect","mp_v",this->txt_mp->Text); ini->WriteString("Protect","att_v",this->txt_att->Text); ini->WriteString("Protect","pick_v",this->txt_pick->Text); ini->WriteString("Protect","key1_v",this->txt_key1->Text); ini->WriteString("Protect","key2_v",this->txt_key2->Text); ini->WriteString("Protect","key4_v",this->txt_key3->Text); ini->WriteString("Protect","key3_v",this->txt_key4->Text); ini->WriteInteger("Protect","att_k",this->cb_att->ItemIndex); ini->WriteInteger("Protect","pick_k",this->cb_pick->ItemIndex); ini->WriteInteger("Protect","key1_k",this->cb_key1->ItemIndex); ini->WriteInteger("Protect","key2_k",this->cb_key2->ItemIndex); ini->WriteInteger("Protect","key4_k",this->cb_key3->ItemIndex); ini->WriteInteger("Protect","key3_k",this->cb_key4->ItemIndex); }
void __fastcall TMailSndForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteString(SectionData, KeyHost, HostEdit->Text); IniFile->WriteString(SectionData, KeyPort, PortEdit->Text); IniFile->WriteString(SectionData, KeyFrom, FromEdit->Text); IniFile->WriteString(SectionData, KeyTo, ToEdit->Text); IniFile->WriteString(SectionData, KeySubject, SubjectEdit->Text); IniFile->WriteString(SectionData, KeySignOn, SignOnEdit->Text); IniFile->WriteInteger(SectionWindow, KeyTop, Top); IniFile->WriteInteger(SectionWindow, KeyLeft, Left); IniFile->WriteInteger(SectionWindow, KeyWidth, Width); IniFile->WriteInteger(SectionWindow, KeyHeight, Height); delete IniFile; }
//--------------------------------------------------------------------------- void __fastcall TFtpServerForm::SaveConfig(void) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteString(SectionData, KeyPort, FPort); IniFile->Free(); }
//--------------------------------------------------------------------------- void __fastcall TGetTrackThread::OpenDBDetecotr() { if(!ShowReportEXE("TForm_DBDetecter",NULL)) { TIniFile* ini = new TIniFile(ChangeFileExt( Application->ExeName, ".INI" )); //free in next 2 line ini->WriteString("DBCHECK","DCH","false"); delete ini; ShellExecute(CallCenter_Main_Form, "open","DBDetector.exe", NULL, NULL, NULL); } }
void __fastcall TRigCtlMain::RigSelectButtonClick( TObject *Sender ) { if ( my_rig ) { rig_cleanup( my_rig ); my_rig = 0; } int rig_model = ( int ) RigCombo->Items->Objects[ RigCombo->ItemIndex ]; std::string port = PortCombo->Text.t_str(); // my_rig = rig_init(RIG_MODEL_FT1000MP); my_rig = rig_init( rig_model ); if ( !my_rig ) { Label1->Caption = "rig_init failed"; return ; } strncpy( my_rig->state.rigport.pathname, port.c_str(), FILPATHLEN ); int retcode = rig_open( my_rig ); char buff[ 1024 ]; if ( retcode != RIG_OK ) { sprintf( buff, "rig_open: error = %s \n", rigerror( retcode ) ); Label1->Caption = buff; my_rig = 0; } else { sprintf( buff, "Opened rig model %d, '%s'\n", my_rig->caps->rig_model, my_rig->caps->model_name ); TIniFile *t = new TIniFile( ".\\Configuration\\RigSelect.ini" ); t->WriteString( "RigControl", "Manufacturer", my_rig->caps->mfg_name ); t->WriteString( "RigControl", "Model", my_rig->caps->model_name ); delete t; Label1->Caption = buff; trace( std::string( "Rig selected: " ) + buff ); ChangeButtonClick( Sender ); } }
//--------------------------------------------------------------------------- void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose){ CTrayIcon->Minimize(); if (MessageDlg("请确认要退出系统吗?或是取消可转到后台运行。", mtConfirmation ,mbOKCancel ,0) ==1){ controller->fileDataDealer->Stop(); //if (MessageDlg("要将所有彩票机全部自动关机吗?", mtConfirmation ,mbOKCancel ,0) ==1) ShutDown(true); try{// 保存一些设置到本地配置文件,如窗口大小等 TIniFile *ini = new TIniFile(GetCurrentDir() + "\\app.ini"); ini->WriteTime("Center", "ShutdownTime", DateTimePicker->Time); ini->WriteString("FormSize", "Width", MainForm->Width); ini->WriteString("FormSize", "Height", MainForm->Height); for (int i = 0; i <controller->terminalGroup->Count; i++) { CTerminal *terminal =(CTerminal *)controller->terminalGroup->Objects[i]; ini->WriteInteger(terminal->xmlConfig->TerminalID , "KeyboardInterval", terminal->panel->TrackBarKey->Position); } delete ini; }catch(...){} //关闭窗口 CanClose =true; }else CanClose =false; }
void __fastcall TFastConfigForm::end_butClick(TObject *Sender) { bot_prop.name = bot_nick_edit->Text; if (bot_prop.pass != bot_pass_edit->Text) bot_prop.pass = GetMD5(bot_pass_edit->Text); bot_prop.ip = bot_ip_edit->Text; bot_prop.is_female = bot_sex_choose->ItemIndex; TIniFile *inifile = new TIniFile(config_ini_path); inifile->WriteString ("Bot Properties", "Nick", bot_prop.name); inifile->WriteString ("Bot Properties", "Password", bot_prop.pass); inifile->WriteBool ("Bot Properties", "IsFemale", bot_prop.is_female); inifile->WriteString ("Bot Properties", "IP Address", bot_prop.ip); inifile->WriteBool ("Additional Properties", "FirstPlugRun", false); delete inifile; if (ShowMsg(Handle, "Поздравляем! Настройка плагина успешно завершена. Вы хотите выйти из настройки" " (Нажмите \"Нет\", чтобы не закрывать окно Быстрой настройки и ещё внести какие-либо изменения)?", 3) == IDYES) { Close(); } }
//--------------------------------------------------------------------------- void __fastcall TSocksTestForm::FormClose(TObject *Sender, TCloseAction &Action) { TIniFile *IniFile; IniFile = new TIniFile(FIniFileName); IniFile->WriteInteger(SectionWindow, KeyTop, Top); IniFile->WriteInteger(SectionWindow, KeyLeft, Left); IniFile->WriteInteger(SectionWindow, KeyWidth, Width); IniFile->WriteInteger(SectionWindow, KeyHeight, Height); IniFile->WriteString(SectionData, KeyTargetHost, Trim(TargetHostEdit->Text)); IniFile->WriteString(SectionData, KeyTargetPort, Trim(TargetPortEdit->Text)); IniFile->WriteString(SectionData, KeySocksServer, Trim(SocksServerEdit->Text)); IniFile->WriteString(SectionData, KeySocksPort, Trim(SocksPortEdit->Text)); IniFile->WriteString(SectionData, KeySocksUsercode, Trim(SocksUsercodeEdit->Text)); IniFile->WriteString(SectionData, KeySocksPassword, Trim(SocksPasswordEdit->Text)); IniFile->WriteInteger(SectionData, KeySocksAuth, SocksAuthCheckBox->Checked); IniFile->WriteInteger(SectionData, KeySocks5, Socks5RadioButton->Checked); IniFile->WriteInteger(SectionData, KeySocks4, Socks4RadioButton->Checked); delete IniFile; }
void __fastcall TTestRigMain::RigSelectButtonClick( TObject */*Sender*/ ) { if ( my_rig ) { rig_cleanup( my_rig ); my_rig = 0; } int rig_model = ( int ) RigCombo->Items->Objects[ RigCombo->ItemIndex ]; String port = PortCombo->Text; my_rig = rig_init( rig_model ); if ( !my_rig ) { Label1->Caption = "rig_init failed"; return ; } strncpy( my_rig->state.rigport.pathname, port.t_str(), FILPATHLEN ); int retcode = rig_open( my_rig ); char buff[ 1024 ]; if ( retcode != RIG_OK ) { sprintf( buff, "rig_open: error = %s \n", rigerror( retcode ) ); Label1->Caption = buff; my_rig = 0; } else { sprintf( buff, "Opened rig model %d, %s '%s'\n", my_rig->caps->rig_model, my_rig->caps->mfg_name, my_rig->caps->model_name ); TIniFile *t = new TIniFile( ".\\Configuration\\RigSelect.ini" ); t->WriteString( "TestRig", "Manufacturer", my_rig->caps->mfg_name ); t->WriteString( "TestRig", "Model", my_rig->caps->model_name ); delete t; Label1->Caption = buff; } }
void __fastcall TFrmMain::N1Click(TObject *Sender) { AnsiString iniSetFile=ExtractFilePath(Application->ExeName)+"BcdEditer.ini"; AnsiString SectionName=ExtractFileName(CurrentOpenFile); int ColType; FrmTitle->edTitle->Text=sgEdit->Cells[sgEdit->Col][0]; if(FrmTitle->ShowModal()==mrOk){ TIniFile *ini; ini = new TIniFile( iniSetFile ); ini->WriteString(SectionName,"ColTitle"+IntToStr(sgEdit->Col),FrmTitle->edTitle->Text); delete ini; sgEdit->Cells[sgEdit->Col][0]=FrmTitle->edTitle->Text; } }
void TDataManager::saveSettings(vector <TKHR*> vKHRList, int mask) { AnsiString IniName = ExtractFilePath(Application->ExeName)+AnsiString("setting.ini"); // AnsiString path = ExtractFilePath(Application->ExeName)+AnsiString(INI_FILE); if (FileExists(IniName)) { TIniFile *ini = new TIniFile(IniName); // ini->CleanupInstance(); ini->EraseSection("LoadedFiles"); for(int i = 1; i <= vKHRList.size(); i++) { AnsiString tempfile = "file"+IntToStr(i); ini->WriteString("LoadedFiles",tempfile, vKHRList[i-1]->path.c_str()); } AnsiString tempfile = "mask"; ini->WriteString("RowSettings",tempfile, mask); ini->UpdateFile(); delete ini; } }
//--------------------------------------------------------------------------- void __fastcall CIniFile::AddNewID(int nLevel,char *strID,char *strPassword) { AnsiString strFile; TIniFile *pIniFile; char *Level[]={"Operator","Engineer","Supervisor"}; if(nLevel<0 || nLevel>2) nLevel=0; strFile.sprintf("%s%s",IniFile_Dir,UserName); pIniFile = new TIniFile(strFile); pIniFile->WriteString(Level[nLevel],strID,strPassword); delete pIniFile; }
void TForm1::SaveIniSettings() { TIniFile* ini = new TIniFile(ChangeFileExt(Application->ExeName, ".INI")); try { // view menu ini->WriteBool("General", "Exists", true); ini->WriteBool("View", "CSize", AbZipOutline1->Attributes.Contains(zaCompressedSize)); ini->WriteBool("View", "CMethod", AbZipOutline1->Attributes.Contains(zaCompressionMethod)); ini->WriteBool("View", "CRatio", AbZipOutline1->Attributes.Contains(zaCompressionRatio)); ini->WriteBool("View", "CRC", AbZipOutline1->Attributes.Contains(zaCRC)); ini->WriteBool("View", "EFA", AbZipOutline1->Attributes.Contains(zaExternalFileAttributes)); ini->WriteBool("View", "IFA", AbZipOutline1->Attributes.Contains(zaInternalFileAttributes)); ini->WriteBool("View", "Encryption", AbZipOutline1->Attributes.Contains(zaEncryption)); ini->WriteBool("View", "TimeStamp", AbZipOutline1->Attributes.Contains(zaTimeStamp)); ini->WriteBool("View", "USize", AbZipOutline1->Attributes.Contains(zaUncompressedSize)); ini->WriteBool("View", "MadeBy", AbZipOutline1->Attributes.Contains(zaVersionMade)); ini->WriteBool("View", "Needed", AbZipOutline1->Attributes.Contains(zaVersionNeeded)); ini->WriteBool("View", "Comment", AbZipOutline1->Attributes.Contains(zaComment)); ini->WriteBool("View", "Hierarchy", AbZipOutline1->Hierarchy); // ini->WriteInteger("View", "OutlineStyle", AbZipOutline1->OutlineStyle); // preferences menu ini->WriteString("Preferences", "BaseDirectory", AbZipOutline1->BaseDirectory); ini->WriteBool("Preferences", "Confirmations", Confirmations1->Checked); ini->WriteInteger("Preferences", "CompressionMethodToUse", AbZipOutline1->CompressionMethodToUse); ini->WriteInteger("Preferences", "DeflationOption", AbZipOutline1->DeflationOption); ini->WriteBool("Preferences", "CreateDirs", AbZipOutline1->ExtractOptions.Contains(eoCreateDirs)); ini->WriteBool("Preferences", "RestorePath", AbZipOutline1->ExtractOptions.Contains(eoRestorePath)); ini->WriteBool("Preferences", "StripPath", AbZipOutline1->StoreOptions.Contains(soStripPath)); ini->WriteBool("Preferences", "RemoveDots", AbZipOutline1->StoreOptions.Contains(soRemoveDots)); ini->WriteBool("Preferences", "Recurse", AbZipOutline1->StoreOptions.Contains(soRecurse)); } catch (...) { delete ini; return; } delete ini; }
//--------------------------------------------------------------------------- void __fastcall TForm1::OgDaysCode1ChangeCode(TObject *Sender, TCode &Code) { String S; TIniFile* Ini = new TIniFile("ONGUARD.INI"); try { // store the days code in the ini file S = BufferToHex(&Code, sizeof(Code)); Ini->WriteString("Codes", "DaysCode", S); CodeLbl->Caption = S; // tell the code component to test the new code, reporting the results OgDaysCode1->CheckCode(true); } catch (...) { delete Ini; Ini = 0; } delete Ini; }
//--------------------------------------------------------------------------- void __fastcall TForm1::OgUsageCode1ChangeCode(TObject *Sender, TCode &Code) { String S; // open Ini File TIniFile* IniFile = new TIniFile("ONGUARD.INI"); try { // convert code to string S = BufferToHex(&Code, sizeof(Code)); IniFile->WriteString("Codes", "UsageCode", S); CodeLbl->Caption = S; // tell the code component to test the new code, reporting the results OgUsageCode1->CheckCode(true); } catch (...) { delete IniFile; IniFile = 0; } delete IniFile; }