//--------------------------------------------------------------------------- void __fastcall TPrefsForm::FormClose(TObject* Sender, TCloseAction& Action) { CheckPrefsInterOpt(); CheckReadonlyOpt(PrefFileOpt); TIniFile* Ini = new TIniFile(PrefFileOpt); try { if (HotKeyComb->HotKey != 0) Ini->WriteBool("Options", "HotKeyEn", 1); else Ini->WriteBool("Options", "HotKeyEn", 0); } catch (...) { Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR); } delete Ini; if (NeedOnClose) { AnsiString StyleTx = StyleBox->Items->Strings[StyleIs]; SNotesXMForm->TBXSwitcher1->Theme = StyleTx; SNotesXMForm->TBXSwitcher1->EnableXPStyles = WasXPEffects; SNotesXMForm->AllTabs->MultiLine = WasMultiLine; SNotesXMForm->CoolTray->IconVisible = WasTrayIcon; SNotesXMForm->AlphaBlend = WasTrans; SNotesXMForm->AlphaBlendValue = TransIs; if (WasTop) SNotesXMForm->AllTabs->TabPosition = tpTop; else SNotesXMForm->AllTabs->TabPosition = tpBottom; } }
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(); }
//--------------------------------------------------------------------------- // Сохраняю установки измерения в файл bool SaveSettings(MeasurInfo& measurInfo) { if (access(lpIniFileName.c_str(), 0) == 0) { // TIniFile *Ini = new TIniFile(lpIniFileName); // try { if (Ini->SectionExists("History")) { Ini->WriteInteger("History", "type_check_watt", measurInfo.type_check_watt); Ini->WriteFloat("History", "begin_lw", measurInfo.begin_lw); Ini->WriteFloat("History", "end_lw", measurInfo.end_lw); Ini->WriteFloat("History", "step_lw", measurInfo.step_lw); Ini->WriteFloat("History", "calc_lw", measurInfo.calc_lw); Ini->WriteFloat("History", "time_accumulation", measurInfo.time_accumulation); Ini->WriteBool("History", "makeKorK_bw", measurInfo.makeKorK_bw); Ini->WriteBool("History", "makeKorK_cw", measurInfo.makeKorK_cw); Ini->WriteBool("History", "makeSetZero", measurInfo.makeSetZero); return true; } } __finally { delete Ini; Ini = NULL; } }
//--------------------------------------------------------------------------- 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 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 TPrefsForm::ApplyButtonClick(TObject* Sender) { CheckPrefsInterOpt(); CheckReadonlyOpt(PrefFileOpt); TRegistry* Reg = new TRegistry; TIniFile* Ini = new TIniFile(PrefFileOpt); try { Ini->WriteBool("Options", "FadeShow", FadeShow->Checked); Ini->WriteBool("Options", "URLDetect", URLDetect->Checked); Ini->WriteBool("Options", "MinOnClose", MinOnClose->Checked); Ini->WriteBool("Options", "StartWithWindows", StartWithWindows->Checked); Ini->WriteBool("Options", "TopPages", TopPages->Checked); Ini->WriteBool("Options", "Transparency", Transparency->Checked); Ini->WriteInteger("Options", "TransValue", TransValue->Position); Ini->WriteBool("Options", "MultiLines", MultiLines->Checked); Ini->WriteBool("Options", "WorkMode", NormalMode->Checked); Ini->WriteInteger("Options", "FadeSpeed", StrToInt(FadeSpeed->Text)); Ini->WriteString("Options", "DefaultFont", FontComboBox1->FontName); Ini->WriteInteger("Options", "DefaultFontSize", StrToInt(DefaultSize->Text)); Ini->WriteBool("Options", "FadeHide", FadeHide->Checked); Ini->WriteBool("Options", "XPEffects", XPEffects->Checked); Ini->WriteInteger("Options", "Style", StyleBox->ItemIndex); Ini->WriteBool("Options", "TaskbarIcon", TaskbarCheck->Checked); Ini->WriteBool("Options", "TrayIcon", IconInTray->Checked); Ini->WriteBool("Options", "HideWindow", HideWind->Checked); Ini->WriteInteger("Options", "HideTimeout", HideTimePosition->Position); Ini->WriteBool("Options", "AskOnFormatChange", AskFormat->Checked); if (FormatPageBox->ItemIndex == 0) Ini->WriteString("Options", "DefaultPageFormat", "RTF"); else Ini->WriteString("Options", "DefaultPageFormat", "TXT"); Reg->RootKey = HKEY_CURRENT_USER; Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", true); if (StartWithWindows->Checked) { AnsiString Path = Application->ExeName; Reg->WriteString("SimpleNotes", Path ); } else { if (Reg->ValueExists("SimpleNotes") && (Reg->ReadString("SimpleNotes") == Application->ExeName)) Reg->DeleteValue("SimpleNotes"); } if (TopPages->Checked) SNotesXMForm->AllTabs->TabPosition = tpTop; else SNotesXMForm->AllTabs->TabPosition = tpBottom; SNotesXMForm->AllTabs->MultiLine = MultiLines->Checked; SNotesXMForm->RichEdit1->AutoURLDetect = URLDetect->Checked; if ((OSopt == "Win2K") || (OSopt == "WinXP") || (OSopt == "Win2003")) { SNotesXMForm->AlphaBlend = Transparency->Checked; SNotesXMForm->AlphaBlendValue = TransValue->Position; } else SNotesXMForm->AlphaBlend = false; switch (StyleBox->ItemIndex) { case 0: SNotesXMForm->TBXSwitcher1->Theme = "Default"; break; case 1: SNotesXMForm->TBXSwitcher1->Theme = "OfficeXP"; break; default: SNotesXMForm->TBXSwitcher1->Theme = "OfficeXP"; break; } SNotesXMForm->TBXSwitcher1->EnableXPStyles = XPEffects->Checked; Ini->WriteString("Options", "BackUpPath", BackupPath->Text); WasTop = TopPages->Checked; WasXPEffects = SNotesXMForm->TBXSwitcher1->EnableXPStyles; WasMultiLine = SNotesXMForm->AllTabs->MultiLine; WasTrayIcon = SNotesXMForm->CoolTray->IconVisible; WasTrans = SNotesXMForm->AlphaBlend; TransIs = SNotesXMForm->AlphaBlendValue; StyleIs = StyleBox->ItemIndex; ApplyButton->Enabled = false; } catch (...) { Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR); } delete Ini; delete Reg; }
//--------------------------------------------------------------------------- void __fastcall TPrefsForm::SetHotkeyButtonClick(TObject* Sender) { CheckPrefsInterOpt(); CheckReadonlyOpt(PrefFileOpt); TIniFile* Ini = new TIniFile(PrefFileOpt); long int HotKey = HotKeyComb->HotKey; int Mods = 0; int Key = 0; if (HotKeyComb->Modifiers.Contains(hkShift)) HotKey -= 8192; if (HotKeyComb->Modifiers.Contains(hkAlt)) HotKey -= 32768; if (HotKeyComb->Modifiers.Contains(hkCtrl)) HotKey -= 16384; try { if (HotKeyComb->Modifiers.Contains(hkShift)) Ini->WriteBool("Options", "Mod_Shift", 1); else Ini->WriteBool("Options", "Mod_Shift", 0); if (HotKeyComb->Modifiers.Contains(hkAlt)) Ini->WriteBool("Options", "Mod_Alt", 1); else Ini->WriteBool("Options", "Mod_Alt", 0); if (HotKeyComb->Modifiers.Contains(hkCtrl)) Ini->WriteBool("Options", "Mod_Ctrl", 1); else Ini->WriteBool("Options", "Mod_Ctrl", 0); Ini->WriteInteger("Options", "HotKey", HotKey); } catch (...) { Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR); } try { if (Ini->ReadBool("Options", "Mod_Shift", 0)) Mods += MOD_SHIFT; if (Ini->ReadBool("Options", "Mod_Alt", 0)) Mods += MOD_ALT; if (Ini->ReadBool("Options", "Mod_Ctrl", 0)) Mods += MOD_CONTROL; Key = Ini->ReadInteger("Options", "HotKey", 165); } catch (...) { Application->MessageBoxA(LMessagesOpt.ReadPrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR); } try { Ini->WriteInteger("Options", "Hot2", HotKeyComb->HotKey); } catch (...) { Application->MessageBoxA(LMessagesOpt.WritePrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR); } if (HotKeyComb->HotKey != 0) { UnregisterHotKey(Application->Handle, 1); bool HotKey2 = RegisterHotKey(Application->Handle, 1, Mods, Key); if (!HotKey2) Application->MessageBoxA(LMessagesOpt.HotExists, LMessagesOpt.Error, MB_OK + MB_ICONWARNING); } delete Ini; SetHotkeyButton->Enabled = false; }
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 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); }