3 #include "UrlLoaders.h" 7 class CUrlProcessorUserData;
28 AssetFileType_default = 0,
29 AssetFileType_dds_file,
31 AssetFileType_ui_texture,
34 AssetFileType_big_file,
35 AssetFileType_web_file,
124 HRESULT
SyncFile_Async(
const SyncFile_Callback_t::slot_type& slot);
154 bool SaveToDisk(
const char* buffer,
int nSize,
bool bCheckMD5=
true);
182 CFileReplaceMap(
const string& filename,
bool bReplaceExistingOnes =
true);
191 void LoadReplaceFile(
const string& filename,
bool bReplaceExistingOnes =
true);
203 bool ReplaceFile(
string& inout);
205 typedef std::map<string, string> Asset_Replace_Map_Type;
210 Asset_Replace_Map_Type m_replace_map;
255 void PrepareCacheFolders();
258 void LoadManifestFile(
const string& filename);
282 AssetFileEntry* GetFile(
const string& filename,
bool bUseReplaceMap =
true,
bool bIgnoreLocalFile =
false);
287 void AddEntry(
const char* filename);
301 void EnableManifest(
bool bEnable=
true);
304 bool IsUseLocalFileFirst()
const;
305 void SetUseLocalFileFirst(
bool val);
308 bool ParseAssetEntryStr(
const string &sFilename,
string &fileKey,
string &md5,
string& filesize);
310 typedef std::map<string, AssetFileEntry*> Asset_Manifest_Map_Type;
315 Asset_Manifest_Map_Type m_files;
318 bool m_bEnableManifest;
320 bool m_bUseLocalFileFirst;
string GetAbsoluteUrl()
get the absolute url by prepending the default asset domain.
Definition: AssetManifest.cpp:124
void SetStatus(AssetFileStatus status)
set asset file status
Definition: AssetManifest.h:68
const std::string & GetLocalFileName()
get local file name.
Definition: AssetManifest.h:160
light-weighted file record header in memory.
Definition: AssetManifest.h:10
mapping a file to another file a replace file mapping.
Definition: AssetManifest.h:172
bool AddDownloadCount()
add the download count and return !HasReachedMaxRetryCount()
Definition: AssetManifest.cpp:142
boost::signals2::signal< void(int, AssetFileEntry *)> SyncFile_Callback_t
sync file call back function or class.
Definition: AssetManifest.h:14
one should derive from this class with virtual destructor.
Definition: UrlLoaders.h:62
different physics engine has different winding order.
Definition: EventBinding.h:32
AssetFileTypeEnum GetFileType()
the asset file type is usually set according to the file extension.
Definition: AssetManifest.h:71
bool HasReachedMaxRetryCount()
whether we have downloaded the file so many times, but still can not get it right.
Definition: AssetManifest.cpp:137
bool CheckSyncFile()
this is similar to SyncFile, except that it will only sync file if the file is not up to date...
Definition: AssetManifest.cpp:148
bool SaveToDisk(const char *buffer, int nSize, bool bCheckMD5=true)
save a give buffer to local file.
Definition: AssetManifest.cpp:477
bool IsEnabled()
if false, manifest will be temporarily disabled and all GetFile() and DoesFileExist() functions will ...
Definition: AssetManifest.h:296
bool DoesFileExist()
whether an up to date file exist locally.
Definition: AssetManifest.cpp:61
HRESULT SyncFile_Async(URL_LOADER_CALLBACK pFuncCallback=NULL, CUrlProcessorUserData *pUserData=NULL, bool bDeleteUserData=false)
similar to SyncFile(), except that this function will return immediately and does not redownload or c...
Definition: AssetManifest.cpp:305
std::string GetFullFilePath()
get the full disk file path.
Definition: AssetManifest.cpp:467
AssetFileTypeEnum SetFileType(const std::string &file_extension)
set the asset file type according to file extension.
Definition: AssetManifest.cpp:543
bool CheckMD5AndSize(const char *buffer, int nSize)
check whether the MD5 of the input buffer matches.
Definition: AssetManifest.cpp:437
bool IsDownloading()
whether this asset is currently being downloaded.
Definition: AssetManifest.cpp:365
int m_nDownloadCount
how many times we have tried to download this file since start.
Definition: AssetManifest.h:44
bool IsUrlFileCompressed()
return true if url file is compressed.
Definition: AssetManifest.cpp:236
Unable to download the file, after trying a number of times.
Definition: AssetManifest.h:24
Asset manifest manager.
Definition: AssetManifest.h:243
bool SyncFile()
download the file even it is up to date.
Definition: AssetManifest.cpp:160
AssetFileTypeEnum
the asset file type is usually set according to the file extension.
Definition: AssetManifest.h:27
Asset is being downloaded but is not finished yet.
Definition: AssetManifest.h:22
AssetFileStatus
Definition: AssetManifest.h:16
In local computer and ready for use.
Definition: AssetManifest.h:20
int m_nFileSize
the compressed file size
Definition: AssetManifest.h:46
const string & GetUrl()
get relative url
Definition: AssetManifest.h:142
ResourceRequestID GetRequestQueueID()
get the proper request queue.
Definition: AssetManifest.cpp:283
ResourceRequestID
predefined resource request id.
Definition: IDataLoader.h:114
string m_localFileName
this is concatenation of hex md5 with file size
Definition: AssetManifest.h:39
undetermined.
Definition: AssetManifest.h:18
AssetFileStatus GetStatus()
get asset file status
Definition: AssetManifest.h:65
void SignalComplete(int nResult=0)
fire the complete signal, causing all callback to be invoked and then delete all callbacks.
Definition: AssetManifest.cpp:427
AssetFileStatus m_nStatus
asset file status.
Definition: AssetManifest.h:56
SyncFile_Callback_t * m_sync_callback
the sync call back.
Definition: AssetManifest.h:53
AssetFileTypeEnum m_file_type
the asset file type
Definition: AssetManifest.h:48
int GetFileSize()
get the compressed file size of the asset entry.
Definition: AssetManifest.h:157