资源打包的一些思路

来源:互联网 发布:大话设计模式php 编辑:程序博客网 时间:2024/04/29 20:28

我这可能要跟国际友人合作了。仍然是烂的不行的英文。你们别看英文,不然会瞎的。我把一些大体的思路写出来,暂时没有更多的想法了,和朋友沟通了一下,估计就按照这个需求做。接下来每一步我可能会把一些具体的技术细节形成博客再仔细写出来,哪里没有考虑充分的地方,还请各位大大多多指正。

追加的内容如下:

  1. 现在是完全不考虑删除功能,考虑发布文件极少需要删除,那可能需要升级程序重新排列文件包。这是一个耗时的任务。但是为了或许会有的重新占位的可能(就是在删除的文件上覆盖一个不大于原文件的新文件。
    after discussing, we decide to not to implement the DEL functions, (consider that most resources released will not need to be delete ) but for the further concern, we decide to make a mark on the discarded files.
  2. 根据在GL群里几个大大的说法,加密是无用的,因此参考盆友意见,只加密解密部分可能是只加密索引部分,具体内容不进行加密,但应该是会进行压缩,每个文件描述符内都会有一个压缩方法的ID
    according to some fellow's thought, encrpytion will affects the indexing only but content should be zip for saving space and the description of each file will contain an ID of compression method.

任务目标 object

资源文件打包系统
resource file package system.

最终效果 archivement

系统能够把多个文件打包成一个资源文件,并且能够以追加的方式把资源添入打包库里。资源包支持文件夹,即文件标识符可以存在路径。文件夹允许有描述符(当然也可能没有,举例:长度,宽度,色深完全一样的图片文件夹)。资源包需要加密,必须是对称加密,因为还要资源包需要反序列化作为资源使用。删除,覆盖功能没有思考清楚。但是可以标记一个文件夹,或者一个文件被废弃的字样。

system can packs multi files into one, have ability to add new resource into a released package. the package support directories, it means the file id can include dir token. directory has its own dir description( of course it can have no, a example for a dir that has a description: an image dir that contains all image with same  ext, width, height, and color depth). the package need to be encrpted, and it have ability of decryption, since the resource will be unserialized on run-time for using. functions of DELETE & MODIFY is considered, but have no idea how to deal with it. but a thought of that the dir & files in the package can be signed that they were discarded.

关键对象 Keyword object:

  • package
  • directory
  • file
  • dir_desciption
  • serializor(zipper encrypter)
  • unserializor(unzipper decrypter)

工具链 tool chain: 

  • PackageZipper
  • PackageViewer
  • PackageExtractor
  • FileFormatter(for zip into one given, which within description, dir. it produce two files : one description file and a token that only contains nesscery binary) 

工作顺序列表 TODO-list with ordered.

  1. 字符串对象和操作
    string and related functions
  2. 文件字符串哈希和其对应的容器
    file_path hashing and related container(map/vector/tree or anything they are.)
  3. 文件系统(已经完成部分)
    file system(finished a little part)
  4. 对称加/解密算法研究
    symmetrical  encryption/decryption algorithm
  5. 串行化和反串行化研究(资源包设计)
    serialization and unserialization (package binary layout design)
  6. 通过文件系统设计资源包应用
    making resource package application(using file system) 
  7. 工具链的制作 tool chain creation.