//--------------------------------------------------------------------------- void __fastcall TGUIConfiguration::LoadData(THierarchicalStorage * Storage) { TConfiguration::LoadData(Storage); // duplicated from core\configuration.cpp #define KEYEX(TYPE, VAR, NAME) VAR = Storage->Read ## TYPE(NAME, VAR) #pragma warn -eas REGCONFIG(false); #pragma warn +eas #undef KEYEX if (Storage->OpenSubKey(L"Interface\\CopyParam", false, true)) try { // must be loaded before eventual setting defaults for CopyParamList FDefaultCopyParam.Load(Storage); int CopyParamListCount = Storage->ReadInteger(L"CopyParamList", -1); FCopyParamListDefaults = (CopyParamListCount < 0); if (!FCopyParamListDefaults) { FCopyParamList->Clear(); FCopyParamList->Load(Storage, CopyParamListCount); } else if (FCopyParamList->Modified) { FCopyParamList->Clear(); FCopyParamListDefaults = false; } FCopyParamList->Reset(); } __finally { Storage->CloseSubKey(); } // Make it compatible with versions prior to 3.7.1 that have not saved PuttyPath // with quotes. First check for absence of quotes. // Add quotes either if the path is set to default putty path (even if it does // not exists) or when the path points to existing file (so there are no parameters // yet in the string). Note that FileExists may display error dialog, but as // it should be called only for custom users path, let's expect that the user // can take care of it. if ((FPuttyPath.SubString(1, 1) != L"\"") && (CompareFileName(ExpandEnvironmentVariables(FPuttyPath), FDefaultPuttyPathOnly) || FileExists(ExpandEnvironmentVariables(FPuttyPath)))) { FPuttyPath = FormatCommand(FPuttyPath, L""); } if (Storage->OpenSubKey(L"Interface\\NewDirectory2", false, true)) try { FNewDirectoryProperties.Load(Storage); } __finally { Storage->CloseSubKey(); } }
void TConfiguration::SaveData(THierarchicalStorage * Storage, bool /*All*/) { #define KEYEX(TYPE, NAME, VAR) Storage->Write ## TYPE(LASTELEM(UnicodeString(MB_TEXT(#NAME))), Get ## VAR()) REGCONFIG(true); #undef KEYEX if (Storage->OpenSubKey("Usage", true)) { // FUsage->Save(Storage); Storage->CloseSubKey(); } }
//--------------------------------------------------------------------------- void __fastcall TConfiguration::SaveData(THierarchicalStorage * Storage, bool /*All*/) { #define KEYEX(TYPE, VAR, NAME) Storage->Write ## TYPE(NAME, VAR) REGCONFIG(true); #undef KEYEX if (Storage->OpenSubKey(L"Usage", true)) { FUsage->Save(Storage); Storage->CloseSubKey(); } }
void TFarConfiguration::LoadData(THierarchicalStorage * Storage) { TGUIConfiguration::LoadData(Storage); // duplicated from core\configuration.cpp #define KEY(TYPE, VAR) Set##VAR(Storage->Read ## TYPE(LASTELEM(MB2W(#VAR)), Get##VAR())) REGCONFIG(false); #undef KEY if (Storage->OpenSubKey(L"Bookmarks", false)) { FBookmarks->Load(Storage); Storage->CloseSubKey(); } }
void TFarConfiguration::SaveData(THierarchicalStorage * Storage, bool All) { TGUIConfiguration::SaveData(Storage, All); // duplicated from core\configuration.cpp #define KEY(TYPE, VAR) Storage->Write ## TYPE(LASTELEM(MB2W(#VAR)), Get##VAR()) REGCONFIG(true); #undef KEY if (Storage->OpenSubKey(L"Bookmarks", /*CanCreate=*/true)) { FBookmarks->Save(Storage, All); Storage->CloseSubKey(); } }
void TConfiguration::LoadData(THierarchicalStorage * Storage) { #define KEYEX(TYPE, NAME, VAR) Set ## VAR(Storage->Read ## TYPE(LASTELEM(UnicodeString(MB_TEXT(#NAME))), Get ## VAR())) REGCONFIG(false); #undef KEYEX if (Storage->OpenSubKey("Usage", false)) { // FUsage->Load(Storage); Storage->CloseSubKey(); } if (FPermanentLogActions && FPermanentActionsLogFileName.IsEmpty() && FPermanentLogging && !FPermanentLogFileName.IsEmpty()) { FPermanentActionsLogFileName = FPermanentLogFileName; FPermanentLogging = false; FPermanentLogFileName.Clear(); } }
//--------------------------------------------------------------------------- void __fastcall TGUIConfiguration::SaveData(THierarchicalStorage * Storage, bool All) { TConfiguration::SaveData(Storage, All); // duplicated from core\configuration.cpp #define KEYEX(TYPE, VAR, NAME) Storage->Write ## TYPE(NAME, VAR) REGCONFIG(true); #undef KEYEX if (Storage->OpenSubKey(L"Interface\\CopyParam", true, true)) try { FDefaultCopyParam.Save(Storage); if (FCopyParamListDefaults) { assert(!FCopyParamList->Modified); Storage->WriteInteger(L"CopyParamList", -1); } else if (All || FCopyParamList->Modified) { Storage->WriteInteger(L"CopyParamList", FCopyParamList->Count); FCopyParamList->Save(Storage); } } __finally { Storage->CloseSubKey(); } if (Storage->OpenSubKey(L"Interface\\NewDirectory2", true, true)) try { FNewDirectoryProperties.Save(Storage); } __finally { Storage->CloseSubKey(); } }
//--------------------------------------------------------------------------- void __fastcall TConfiguration::LoadData(THierarchicalStorage * Storage) { #define KEYEX(TYPE, VAR, NAME) VAR = Storage->Read ## TYPE(NAME, VAR) #pragma warn -eas REGCONFIG(false); #pragma warn +eas #undef KEYEX if (Storage->OpenSubKey(L"Usage", false)) { FUsage->Load(Storage); Storage->CloseSubKey(); } if (FPermanentLogActions && FPermanentActionsLogFileName.IsEmpty() && FPermanentLogging && !FPermanentLogFileName.IsEmpty()) { FPermanentActionsLogFileName = FPermanentLogFileName; FPermanentLogging = false; FPermanentLogFileName = L""; } }
//--------------------------------------------------------------------------- void __fastcall TCustomWinConfiguration::SaveData( THierarchicalStorage * Storage, bool All) { TGUIConfiguration::SaveData(Storage, All); // duplicated from core\configuration.cpp #define KEY(TYPE, VAR) Storage->Write ## TYPE(LASTELEM(UnicodeString(TEXT(#VAR))), VAR) REGCONFIG(true); #undef KEY if (FHistory->Count > 0) { if (Storage->OpenSubKey(L"History", true)) { try { THistoryStrings * HistoryStrings; for (int Index = 0; Index < FHistory->Count; Index++) { HistoryStrings = dynamic_cast<THistoryStrings *>(FHistory->Objects[Index]); DebugAssert(HistoryStrings != NULL); if (All || HistoryStrings->Modified) { if (Storage->OpenSubKey(FHistory->Strings[Index], true)) { try { Storage->WriteValues(HistoryStrings); } __finally { Storage->CloseSubKey(); } } } } } __finally { Storage->CloseSubKey(); } } if (Storage->OpenSubKey(L"HistoryParams", true)) { try { THistoryStrings * HistoryStrings; for (int Index = 0; Index < FHistory->Count; Index++) { HistoryStrings = dynamic_cast<THistoryStrings *>(FHistory->Objects[Index]); DebugAssert(HistoryStrings != NULL); if (All || HistoryStrings->Modified) { bool HasData = false; for (int VIndex = 0; !HasData && (VIndex < HistoryStrings->Count); VIndex++) { HasData = (HistoryStrings->Objects[VIndex] != NULL); } if (!HasData) { Storage->RecursiveDeleteSubKey(FHistory->Strings[Index]); } else if (Storage->OpenSubKey(FHistory->Strings[Index], true)) { try { Storage->ClearValues(); for (int VIndex = 0; VIndex < HistoryStrings->Count; VIndex++) { void * Data = HistoryStrings->Objects[VIndex]; Storage->WriteBinaryData(IntToStr(VIndex), &Data, sizeof(Data)); } } __finally { Storage->CloseSubKey(); } } } } } __finally { Storage->CloseSubKey(); } } }