//--------------------------------------------------------------------------- UnicodeString TConfiguration::GetFileInfoString(const UnicodeString & Key, const UnicodeString & FileName) const { TGuard Guard(FCriticalSection); UnicodeString Result; void * Info = GetFileApplicationInfo(FileName); SCOPE_EXIT { if (!FileName.IsEmpty() && Info) { FreeFileInfo(Info); } }; { if ((Info != nullptr) && (GetTranslationCount(Info) > 0)) { TTranslation Translation = GetTranslation(Info, 0); try { Result = ::GetFileInfoString(Info, Translation, Key); } catch (const std::exception & e) { (void)e; DEBUG_PRINTF(L"Error: %s", MB2W(e.what()).c_str()); Result = L""; } } } return Result; }
//--------------------------------------------------------------------------- UnicodeString __fastcall TConfiguration::GetFileFileInfoString(const UnicodeString Key, const UnicodeString FileName) { TGuard Guard(FCriticalSection); UnicodeString Result; void * Info = GetFileApplicationInfo(FileName); try { if ((Info != NULL) && (GetTranslationCount(Info) > 0)) { TTranslation Translation; Translation = GetTranslation(Info, 0); Result = ::GetFileInfoString(Info, Translation, Key); } else { assert(!FileName.IsEmpty()); } } __finally { if (!FileName.IsEmpty()) { FreeFileInfo(Info); } } return Result; }
UnicodeString TConfiguration::GetFileFileInfoString(const UnicodeString & AKey, const UnicodeString & AFileName, bool AllowEmpty) const { TGuard Guard(FCriticalSection); UnicodeString Result; void * Info = GetFileApplicationInfo(AFileName); SCOPE_EXIT { if (!AFileName.IsEmpty() && Info) { FreeFileInfo(Info); } }; if ((Info != nullptr) && (GetTranslationCount(Info) > 0)) { TTranslation Translation = GetTranslation(Info, 0); try { Result = ::GetFileInfoString(Info, Translation, AKey, AllowEmpty); } catch (const std::exception & e) { (void)e; DEBUG_PRINTF("Error: %s", ::MB2W(e.what()).c_str()); Result.Clear(); } } else { assert(!AFileName.IsEmpty()); } return Result; }
void * TConfiguration::GetApplicationInfo() const { return GetFileApplicationInfo(L""); }
//--------------------------------------------------------------------------- void * __fastcall TConfiguration::GetApplicationInfo() { return GetFileApplicationInfo(""); }