本文整理汇总了C++中TIniFile::ReadBool方法的典型用法代码示例。如果您正苦于以下问题:C++ TIniFile::ReadBool方法的具体用法?C++ TIniFile::ReadBool怎么用?C++ TIniFile::ReadBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TIniFile
的用法示例。
在下文中一共展示了TIniFile::ReadBool方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FormShow
//---------------------------------------------------------------------------
void __fastcall THttpTestForm::FormShow(TObject *Sender)
{
TIniFile *IniFile;
if (!Initialized) {
Initialized = TRUE;
IniFile = new TIniFile(FIniFileName);
Width = IniFile->ReadInteger(SectionWindow, KeyWidth, Width);
Height = IniFile->ReadInteger(SectionWindow, KeyHeight, Height);
Top = IniFile->ReadInteger(SectionWindow, KeyTop,
(Screen->Height - Height) / 2);
Left = IniFile->ReadInteger(SectionWindow, KeyLeft,
(Screen->Width - Width) / 2);
URLEdit->Text = IniFile->ReadString(SectionData, KeyUrl,
"https://localhost");
DateTimeEdit->Text = IniFile->ReadString("Data", "DateTime", "");
SocksServerEdit->Text = IniFile->ReadString(SectionData, KeySocksServer,
"");
SocksPortEdit->Text = IniFile->ReadString(SectionData, KeySocksPort,
"1080");
ProxyHostEdit->Text = IniFile->ReadString(SectionData, KeyProxyHost,
"");
ProxyPortEdit->Text = IniFile->ReadString(SectionData, KeyProxyPort,
"8080");
DocEdit->Text = IniFile->ReadString(SectionData, KeyDoc,
"/index.html");
CertFileEdit->Text = IniFile->ReadString(SectionData, KeyCertFile,
"01cert.pem");
PrivKeyFileEdit->Text = IniFile->ReadString(SectionData, KeyPrivKeyFile,
"01key.pem");
PassPhraseEdit->Text = IniFile->ReadString(SectionData, KeyPassPhrase,
"password");
CAFileEdit->Text = IniFile->ReadString(SectionData, KeyCAFile,
"cacert.pem");
CAPathEdit->Text = IniFile->ReadString(SectionData, KeyCAPath,
"");
SocksLevelComboBox->ItemIndex = IniFile->ReadInteger(SectionData, KeySocksLevel,
0);
AcceptableHostsEdit->Text = IniFile->ReadString(SectionData, KeyAcceptableHosts,
"www.overbyte.be;www.borland.com");
VerifyPeerCheckBox->Checked = IniFile->ReadBool(SectionData,
KeyVerifyPeer,
0);
HttpVersionComboBox->ItemIndex = IniFile->ReadInteger(SectionData,
KeyHttpVer, 0);
SessCacheCheckBox->Checked = IniFile->ReadBool(SectionData,
KeySessCache, False);
DebugEventCheckBox->Checked = IniFile->ReadBool(SectionData, KeyDebugEvent, False);
DebugOutputCheckBox->Checked = IniFile->ReadBool(SectionData, KeyDebugOutput, False);
DebugFileCheckBox->Checked = IniFile->ReadBool(SectionData, KeyDebugFile, False);
delete IniFile;
DisplayMemo->Clear();
}
}
示例2: LoadFromFile
void TSettings::LoadFromFile(String filename) {
TIniFile *ini = new TIniFile(filename);
Fullscreen = ini->ReadBool("Global", "FullScreen", false);
FormsWidth = ini->ReadInteger("Global", "Width", 1024);
FormsHeight = ini->ReadInteger("Global", "Height", 1024);
FormsLeft = ini->ReadInteger("Global", "Left", 0);
FormsTop = ini->ReadInteger("Global", "Top", 0);
SoundEnabled = ini->ReadBool("Global", "Sound", false);
SoundVolume = ini->ReadInteger("Global", "SoundVolume", 100);
SetVolumeSFX(SoundVolume/100.);
MusicEnabled = ini->ReadBool("Global", "Music", false);
MusicVolume = ini->ReadInteger("Global", "MusicVolume", 100);
SetVolumeMusic(MusicVolume/100.);
HostMode = ini->ReadBool("Global", "HostMode", false);
MinWidth = 1024;
MinHeight = 768;
for (int i = 1; i <= 5; i++) {
PlayerNames[i - 1] = ini->ReadString("Players", "Player" + IntToStr(i), "PlayerName");
PlayerType[i - 1] = (TBotType)ini->ReadInteger("Players", "PlayerType" + IntToStr(i), 0);
}
LastBase = ini->ReadString("Global", "LastBase", "");
if (LastBase == "") {
if (FileExists("base\\main.dat")) {
LastBase = "main.dat";
} else {
MessageBox(Application->Handle,
"Ошибка загрузки последней базы вопросов\n" "Попытка загрузить base\\main.dat также провалилась - файла не существует.",
"Критическая ошибка", MB_OK | MB_ICONSTOP);
Application->Terminate();
}
}
int i = 0;
BaseFiles.clear();
BaseNames = new TStringList;
while (1) {
String name = ini->ReadString("Bases", "basename" + IntToStr(i), "");
String file = ini->ReadString("Bases", "base" + IntToStr(i), "");
if ((name != "") && (file != "")) {
BaseFiles[name] = file;
BaseNames->Add(name);
} else {
break;
}
i++ ;
}
ini->Free();
}
示例3: SetHotkeyButtonClick
//---------------------------------------------------------------------------
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;
}
示例4: FormShow
//---------------------------------------------------------------------------
void __fastcall TPrefsForm::FormShow(TObject* Sender) {
CheckPrefsInterOpt();
try {
OSdetectOpt();
TRegistry* Reg = new TRegistry;
TIniFile* Ini = new TIniFile(PrefFileOpt);
MinOnClose->Checked = Ini->ReadBool("Options", "MinOnClose", 1);
if (Ini->ReadBool("Options", "TopPages", 1))
TopPages->Checked = true;
else
BottomPages->Checked = true;
if (Ini->ReadBool("Options", "WorkMode", 1))
NormalMode->Checked = true;
else
HighMode->Checked = true;
FontComboBox1->FontName = Ini->ReadString("Options", "DefaultFont", "MS Sans Serif");
DefaultFontSizePosition->Position = Ini->ReadInteger("Options", "DefaultFontSize", 10);
FadeShow->Checked = Ini->ReadBool("Options", "FadeShow", 1);
URLDetect->Checked = Ini->ReadBool("Options", "URLDetect", 1);
Transparency->Checked = Ini->ReadBool("Options", "Transparency", 0);
TransValue->Position = Ini->ReadInteger("Options", "TransValue", 255);
MultiLines->Checked = Ini->ReadBool("Options", "MultiLines", 0);
FadeSpeedPosition->Position = Ini->ReadInteger("Options", "FadeSpeed", 2);
FadeHide->Checked = Ini->ReadBool("Options", "FadeHide", 1);
IconInTray->Checked = Ini->ReadBool("Options", "TrayIcon", 1);
TaskbarCheck->Checked = Ini->ReadBool("Options", "TaskbarIcon", 1);
XPEffects->Checked = Ini->ReadBool("Options", "XPEffects", 1);
StyleBox->ItemIndex = Ini->ReadInteger("Options", "Style", 1);
HideWind->Checked = Ini->ReadBool("Options", "HideWindow", 0);
HideTimePosition->Position = Ini->ReadInteger("Options", "HideTimeout", 30);
AskFormat->Checked = Ini->ReadBool("Options", "AskOnFormatChange", 1);
if (Ini->ReadString("Options", "DefaultPageFormat", "RTF") == "RTF")
FormatPageBox->ItemIndex = 0;
else
FormatPageBox->ItemIndex = 1;
StyleIs = StyleBox->ItemIndex;
FadeShowClick(Sender);
TransparencyClick(Sender);
HideWindClick(Sender);
if ((OSopt != "WinXP") && (OSopt != "Win2K") && (OSopt != "Win2003")) {
Transparency->Checked = false;
Transparency->Enabled = false;
TransValue->Position = 255;
TransValue->Enabled = false;
FadeShow->Checked = false;
FadeShow->Enabled = false;
FadeSpeed->Enabled = false;
FadeSpeedPosition->Enabled = false;
FadeHide->Enabled = false;
}
StyleBoxChange(Sender);
Reg->RootKey = HKEY_CURRENT_USER;
Reg->OpenKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (Reg->ValueExists("SimpleNotes") && (Reg->ReadString("SimpleNotes") == Application->ExeName))
StartWithWindows->Checked = true;
else
StartWithWindows->Checked = false;
HotKeyComb->Modifiers.Clear();
int Key = Ini->ReadInteger("Options", "Hot2", 145);
HotKeyComb->HotKey = Key;
if (Ini->ReadBool("Options", "Mod_Shift", 0))
HotKeyComb->Modifiers << hkShift;
if (Ini->ReadBool("Options", "Mod_Alt", 0))
HotKeyComb->Modifiers << hkAlt;
if (Ini->ReadBool("Options", "Mod_Ctrl", 0))
HotKeyComb->Modifiers << hkCtrl;
BackupPath->Text = Ini->ReadString("Options", "BackUpPath", "");
WasTop = TopPages->Checked;
WasXPEffects = SNotesXMForm->TBXSwitcher1->EnableXPStyles;
WasMultiLine = SNotesXMForm->AllTabs->MultiLine;
WasTrayIcon = SNotesXMForm->CoolTray->IconVisible;
WasTrans = SNotesXMForm->AlphaBlend;
TransIs = SNotesXMForm->AlphaBlendValue;
ApplyButton->Enabled = false;
SetHotkeyButton->Enabled = false;
PagesTree->Items->operator [](0)->Selected = true;
PagesTree->SetFocus();
delete Ini;
delete Reg;
} catch (...) {
Application->MessageBoxA(LMessagesOpt.ReadPrefsError, LMessagesOpt.Error, MB_OK + MB_ICONERROR);
}
}
示例5: TIniFile
//---------------------------------------------------------------------------
void TForm1::ReadIniSettings()
{
// This example is derived from the corresponding Delphi example.
// To be compatible with Delphi 1 the Delphi example uses INI files
// rather than using the registry to store configuration data.
// This program uses INI files as well since it has been converted
// from the Delphi example. Normally you would use the registry
// to store configuration data in a 32-bit program.
//
int Value;
bool Exists;
TIniFile* ini = new TIniFile(ChangeFileExt(Application->ExeName, ".INI"));
try {
// view menu
Exists = ini->ReadBool("General", "Exists", false);
if (Exists) {
AbZipOutline1->Attributes.Clear();
if (ini->ReadBool("View", "CSize", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaCompressedSize;
if (ini->ReadBool("View", "CMethod", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaCompressionMethod;
if (ini->ReadBool("View", "CRatio", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaCompressionRatio;
if (ini->ReadBool("View", "CRC", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaCRC;
if (ini->ReadBool("View", "EFA", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaExternalFileAttributes;
if (ini->ReadBool("View", "IFA", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaInternalFileAttributes;
if (ini->ReadBool("View", "Encryption", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaEncryption;
if (ini->ReadBool("View", "TimeStamp", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaTimeStamp;
if (ini->ReadBool("View", "USize", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaUncompressedSize;
if (ini->ReadBool("View", "MadeBy", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaVersionMade;
if (ini->ReadBool("View", "Needed", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaVersionNeeded;
if (ini->ReadBool("View", "Comment", false))
AbZipOutline1->Attributes =
AbZipOutline1->Attributes << zaComment;
AbZipOutline1->Hierarchy =
ini->ReadBool("View", "Hierarchy", true);
Value = ini->ReadInteger("View", "OutlineStyle", -1);
// if (Value != -1)
// AbZipOutline1->OutlineStyle = TOutlineStyle(Value);
// preferences menu
AbZipOutline1->BaseDirectory = ini->ReadString(
"Preferences", "BaseDirectory", ExtractFilePath(Application->ExeName));
if (!AbDirectoryExists(AbZipOutline1->BaseDirectory))
AbZipOutline1->BaseDirectory = ExtractFilePath(Application->ExeName);
Confirmations1->Checked =
ini->ReadBool("Preferences", "Confirmations", false);
SpeedButton7->Down = Confirmations1->Checked;
Value = ini->ReadInteger(
"Preferences", "CompressionMethodToUse", (int)smBestMethod);
AbZipOutline1->CompressionMethodToUse = TAbZipSupportedMethod(Value);
Value = ini->ReadInteger("Preferences", "DeflationOption", doNormal);
AbZipOutline1->DeflationOption = TAbZipDeflationOption(Value);
AbZipOutline1->ExtractOptions.Clear();
if (ini->ReadBool("Preferences", "CreateDirs", false))
AbZipOutline1->ExtractOptions =
AbZipOutline1->ExtractOptions << eoCreateDirs;
if (ini->ReadBool("Preferences", "RestorePath", false))
AbZipOutline1->ExtractOptions =
AbZipOutline1->ExtractOptions << eoRestorePath;
AbZipOutline1->StoreOptions.Clear();
if (ini->ReadBool("Preferences", "StripPath", false))
AbZipOutline1->StoreOptions =
AbZipOutline1->StoreOptions << soStripPath;
if (ini->ReadBool("Preferences", "RemoveDots", false))
AbZipOutline1->StoreOptions =
AbZipOutline1->StoreOptions << soRemoveDots;
if (ini->ReadBool("Preferences", "Recurse", false))
AbZipOutline1->StoreOptions =
AbZipOutline1->StoreOptions << soRecurse;
StubName = ini->ReadString("Self Extracting", "StubName", "selfex.exe");
FilterComboBox1->Filter =
ini->ReadString("Navigator", "Filter",
"All files (*.*)|*.*|Zip Files (*.ZIP)|*.ZIP|"
"Executable Files (*.EXE)|*.EXE|Text files (*.TXT)|*.TXT|");
}
} // try
catch (...) {
delete ini;
//.........这里部分代码省略.........
示例6: LoadSetting
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TfrmMain::LoadSetting()
{
if (strcmp(LoginerPath,"")!=0) {
if( FileExists( String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Setting.ini" ))
{
TIniFile* ini = new TIniFile( String(LoginerPath) +"\\Data\\"+ GameAccount + "\\Setting.ini");
AutoGuagi_X = ini->ReadInteger("AutoGuagi","X",0);
AutoGuagi_Y = ini->ReadInteger("AutoGuagi","Y",0);
AutoGuagi_MapId = ini->ReadInteger("AutoGuagi","MapId",0);
this->ck_func_godmode->IsChecked = ini->ReadBool("Setting","godmode",true);
this->ck_func_dingua->IsChecked=ini->ReadBool("Setting","dingua",this->ck_func_dingua->IsChecked);
ck_func_csx->IsChecked =ini->ReadBool("Setting","csx",this->ck_func_csx->IsChecked);
//ck_func_autolr->IsChecked =ini->ReadBool("Setting","autolr",this->ck_func_autolr->IsChecked);
this->ck_func_chardir->IsChecked =ini->ReadBool("Setting","chardir",this->ck_func_chardir->IsChecked);
this->sw_func_chardir->IsChecked =ini->ReadBool("Setting","chardir_v",this->sw_func_chardir->IsChecked);
this->ck_func_dingwei->IsChecked =ini->ReadBool("Setting","dingwei",this->ck_func_dingwei->IsChecked);
this->ck_func_hidebk->IsChecked =ini->ReadBool("Setting","hidebk",this->ck_func_hidebk->IsChecked);
this->ck_func_hidedmg->IsChecked =ini->ReadBool("Setting","hidedmg",this->ck_func_hidedmg->IsChecked);
this->ck_func_hideskill->IsChecked =ini->ReadBool("Setting","hideskill",this->ck_func_hideskill->IsChecked);
this->ck_func_itemvac->IsChecked =ini->ReadBool("Setting","itemvac",this->ck_func_itemvac->IsChecked);
this->ck_func_jmp->IsChecked =ini->ReadBool("Setting","jmp",this->ck_func_jmp->IsChecked);
this->ck_func_stupid->IsChecked =ini->ReadBool("Setting","stupid",this->ck_func_stupid->IsChecked);
this->ck_hp->IsChecked =ini->ReadBool("Protect","hp",this->ck_hp->IsChecked);
this->ck_mp->IsChecked =ini->ReadBool("Protect","mp",this->ck_mp->IsChecked);
this->ck_att->IsChecked =ini->ReadBool("Protect","att",this->ck_att->IsChecked);
this->ck_pick->IsChecked =ini->ReadBool("Protect","pick",this->ck_pick->IsChecked);
this->ck_key1->IsChecked =ini->ReadBool("Protect","key1",this->ck_key1->IsChecked);
this->ck_key2->IsChecked =ini->ReadBool("Protect","key2",this->ck_key2->IsChecked);
this->ck_key3->IsChecked =ini->ReadBool("Protect","key3",this->ck_key3->IsChecked);
this->ck_key4->IsChecked =ini->ReadBool("Protect","key4",this->ck_key4->IsChecked);
this->txt_hp->Text =ini->ReadString("Protect","hp_v",this->txt_hp->Text);
this->txt_mp->Text =ini->ReadString("Protect","mp_v",this->txt_mp->Text);
this->txt_att->Text =ini->ReadString("Protect","att_v",this->txt_att->Text);
this->txt_pick->Text =ini->ReadString("Protect","pick_v",this->txt_pick->Text);
this->txt_key1->Text =ini->ReadString("Protect","key1_v",this->txt_key1->Text);
this->txt_key2->Text =ini->ReadString("Protect","key2_v",this->txt_key2->Text);
this->txt_key3->Text =ini->ReadString("Protect","key4_v",this->txt_key3->Text);
this->txt_key4->Text =ini->ReadString("Protect","key3_v",this->txt_key4->Text);
this->cb_att->Selected->Text =ini->ReadString("Protect","att_k",this->cb_att->Selected->Text);
this->cb_att->ItemIndex = ini->ReadInteger("Protect","att_k",this->cb_att->ItemIndex);
this->cb_pick->ItemIndex = ini->ReadInteger("Protect","pick_k",this->cb_pick->ItemIndex);
this->cb_key1->ItemIndex=ini->ReadInteger("Protect","key1_k",this->cb_key1->ItemIndex);
this->cb_key2->ItemIndex= ini->ReadInteger("Protect","key2_k",this->cb_key2->ItemIndex);
this->cb_key3->ItemIndex=ini->ReadInteger("Protect","key4_k",this->cb_key3->ItemIndex);
this->cb_key4->ItemIndex=ini->ReadInteger("Protect","key3_k",this->cb_key4->ItemIndex);
AutoKey_HP_Value = StrToInt(txt_hp->Text);
AutoKey_MP_Value = StrToInt(txt_mp->Text);
AutoKey_Att_Time = StrToInt(txt_att->Text);
AutoKey_Pick_Time = StrToInt(txt_pick->Text);
AutoKey_Skill_Time[0] = StrToInt(txt_key1->Text);
AutoKey_Skill_Time[1] = StrToInt(txt_key2->Text);
AutoKey_Skill_Time[2] = StrToInt(txt_key3->Text);
AutoKey_Skill_Time[3] = StrToInt(txt_key4->Text);
AutoKey_Att_Key = GetVirtualKeyCodeByName(AnsiString(cb_att->Selected->Text).c_str());
AutoKey_Pick_Key = GetVirtualKeyCodeByName(AnsiString(cb_pick->Selected->Text).c_str());
AutoKey_Skill_Key[0] = GetVirtualKeyCodeByName(AnsiString(cb_key1->Selected->Text).c_str());
AutoKey_Skill_Key[1] = GetVirtualKeyCodeByName(AnsiString(cb_key2->Selected->Text).c_str());
AutoKey_Skill_Key[2] = GetVirtualKeyCodeByName(AnsiString(cb_key3->Selected->Text).c_str());
AutoKey_Skill_Key[3] = GetVirtualKeyCodeByName(AnsiString(cb_key4->Selected->Text).c_str());
}
}
}