Common01/Source/Common/FileSystem/FoundDynamicFile.cpp
void FoundDynamicFile::AsyncLoadBest(const TLoadCallback& loadCallback)
{
   std::shared_ptr< IFileSystemProvider > pProvider;
   for (const auto& iter: m_arrayProvider)
   {
      auto pPointer = iter.lock();
      if (nullptr != pPointer)
      {
         if (true == pPointer->QueryDynamicFile(m_path))
         {
            pProvider = pPointer;
         }
      }
   }
   auto pFileSystem = m_pFileSystem.lock();
   if ((nullptr != pProvider) && (nullptr != pFileSystem))
   {
      auto path(m_path);
      pFileSystem->AddAsyncTask([=](){
         pProvider->AsyncLoadDynamicFile(loadCallback, path);
      });
   } 
   else
   {
      if (nullptr != loadCallback)
      {
         loadCallback(false, nullptr);
      }
   }
}
// attempt to load the file from the best provider (providers latter in the provider array are "better")
//  what todo about the gap bettween Exist and Load, where provider may change
//  avoid usage of GetExist? but then how do do Best?
attempt to load the file from the best provider (providers latter in the provider array are "better")
what todo about the gap bettween Exist and Load, where provider may change
avoid usage of GetExist.
attempt to load the file from the best provider ( providers latter in the provider array are " better " ) what todo about the gap bettween Exist and Load where provider may change avoid usage of GetExist .
void FoundDynamicFile::AsyncLoadBest(const TLoadCallback& loadCallback)
{
   std::shared_ptr< IFileSystemProvider > pProvider;
   for (const auto& iter: m_arrayProvider)
   {
      auto pPointer = iter.lock();
      if (nullptr != pPointer)
      {
         if (true == pPointer->QueryDynamicFile(m_path))
         {
            pProvider = pPointer;
         }
      }
   }
   auto pFileSystem = m_pFileSystem.lock();
   if ((nullptr != pProvider) && (nullptr != pFileSystem))
   {
      auto path(m_path);
      pFileSystem->AddAsyncTask([=](){
         pProvider->AsyncLoadDynamicFile(loadCallback, path);
      });
   } 
   else
   {
      if (nullptr != loadCallback)
      {
         loadCallback(false, nullptr);
      }
   }
}
void FoundDynamicFile :: AsyncLoadBest ( const TLoadCallback & loadCallback ) { std :: shared_ptr < IFileSystemProvider > pProvider ; for ( const auto & iter : m_arrayProvider ) { auto pPointer = iter . lock ( ) ; if ( nullptr != pPointer ) { if ( true == pPointer -> QueryDynamicFile ( m_path ) ) { pProvider = pPointer ; } } } auto pFileSystem = m_pFileSystem . lock ( ) ; if ( ( nullptr != pProvider ) && ( nullptr != pFileSystem ) ) { auto path ( m_path ) ; pFileSystem -> AddAsyncTask ( [ = ] ( ) { pProvider -> AsyncLoadDynamicFile ( loadCallback , path ) ; } ) ; } else { if ( nullptr != loadCallback ) { loadCallback ( false , nullptr ) ; } } }
attempt to load the file from the best provider (providers latter in the provider array are "better")
what todo about the gap bettween Exist and Load, where provider may change
avoid usage of GetExist?
attempt to load the file from the best provider ( providers latter in the provider array are " better " ) what todo about the gap bettween Exist and Load where provider may change avoid usage of GetExist?