</pre> 工具功能;</p><p> 把琐碎的图片合并到一个文件中,减小文件的体积,同时在使用文件的时候减少io操作,并使用zlib进行压缩</p><p> 实现原理</p><p> 索引文件夹下面的所有资源,按规则依次写入一个文件中,并压缩</p><p> 文件格式:</p><p> 文件格式分为3块:</p><p><pre name="code" class="cpp">第一块为头文件信息,只写一次
typedef struct _ccpFileInfo
{
uint32_t version;
uint32_t fileCount;//所有文件数量
}ccpFileInfo;
第二块为索引文件信息,数量为fileCount
typedef struct _ccpDataInfo
{
char name[KFILENAME_LEN];//文件的名字 ui/aa/bb
uint64_t offset;//在文件中的开始位置
uint64_t size;
char md5[KMD5_LEN];//md5码
_ccpDataInfo(){}
_ccpDataInfo(const char *name,uint64_t offset,uint64_t size,const char*md5){
strcpy(this->name, name);
this->offset = offset;
this->size = size;
strcpy(this->md5, md5);
}
}ccp