示例#1
0
//---------------------------------------------------------------------------
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;
}
示例#2
0
//---------------------------------------------------------------------------
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;
}
示例#3
0
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;
}
示例#4
0
void * TConfiguration::GetApplicationInfo() const
{
  return GetFileApplicationInfo(L"");
}
示例#5
0
//---------------------------------------------------------------------------
void * __fastcall TConfiguration::GetApplicationInfo()
{
  return GetFileApplicationInfo("");
}