I would like to create a file format for my app like Quake, OO, and MS Office 07 have.
我想为我的应用程序创建一个文件格式,如Quake,OO和MS Office 07。
Basically a uncompressed zip folder, or tar file.
基本上是一个未压缩的zip文件夹或tar文件。
I need this to be cross platform (mac and windows).
我需要这是跨平台(mac和windows)。
Can I do something via command prompt and bash?
我可以通过命令提示符和bash做一些事情吗?
6 个解决方案
#1
2
Have a look at the open source 7Zip compression format. For your specific needs, you can use it in an "Archive" mode, zero compression but very fast.
看看开源7Zip压缩格式。根据您的特定需求,您可以在“归档”模式下使用它,零压缩但速度非常快。
It provides a powerful SDK, LZMA, from the site:
它从站点提供了一个功能强大的SDK,LZMA:
"LZMA is the default and general compression method of 7z format in the 7-Zip program. LZMA provides a high compression ratio and very fast decompression, so it is very suitable for embedded applications. For example, it can be used for ROM (firmware) compressing.
“LZMA是7-Zip程序中7z格式的默认和通用压缩方法.LZMA提供高压缩比和非常快速的解压缩,因此非常适合嵌入式应用。例如,它可用于ROM(固件)压缩。
The LZMA SDK provides the documentation, samples, header files, libraries, and tools you need to develop applications that use LZMA compression."
LZMA SDK提供了开发使用LZMA压缩的应用程序所需的文档,示例,头文件,库和工具。“
#2
4
If you want a single file that is portable to all platforms and which contain structured data, consider using sqlite. You'll get a full featured ACID compliant database that exists on disk as a single file.
如果您想要一个可移植到所有平台并包含结构化数据的单个文件,请考虑使用sqlite。您将获得一个功能齐全的ACID兼容数据库,该数据库作为单个文件存在于磁盘上。
There are libraries you can link against to directly access the file, and there is a command line tool you can use as well. No matter what language you are using, most likely there is support for it.
您可以链接的库可以直接访问该文件,您也可以使用命令行工具。无论您使用何种语言,最有可能都支持它。
#3
2
Zip is supported everywhere. If a container is all you need, than those are surely good options.
Zip随处可见。如果你需要一个容器,那么这些肯定是不错的选择。
#4
1
SQLite is great.
SQLite很棒。
A single file, crossplatform, a tiny library, SQL access to data, transactions, the whole enchilada.
单个文件,跨平台,小型库,SQL访问数据,事务,整个辣酱玉米饼馅。
you can use transactions to guarantee consistent return points in case of crashing. check uses for sqlite, they specifically advocate using it as a data model layer for desktop applications.
如果崩溃,您可以使用事务来保证一致的返回点。 check用于sqlite,他们特别提倡将其用作桌面应用程序的数据模型层。
also, there's a command-line tool to manually access the data.
此外,还有一个手动访问数据的命令行工具。
#5
0
First thing you should ask yourself is, "Do I really need to make my own?"
你要问自己的第一件事是,“我真的需要自己创作吗?”
Depending on what you want to use it for, you are probably better off using a common format and some pre-made libraries which already handle one of those formats very well.
根据您想要使用的内容,您可能最好使用通用格式和一些已经很好地处理其中一种格式的预制库。
Good places to start: http://www.destructor.de/libtar/index.htm (tar -- a the 'container' format) http://www.zlib.net/ (zlib -- a method of compressing data before or after you put it in the container)
好的开始:http://www.destructor.de/libtar/index.htm(tar - 一种'容器'格式)http://www.zlib.net/(zlib - 一种压缩数据的方法在将其放入容器之前或之后)
If you still really think you need to make your own, I would suggest studying something very simple first, like tar's format:
如果您仍然认为自己需要自己制作,我建议先学习一些非常简单的东西,比如tar的格式:
http://en.wikipedia.org/wiki/Tar_(file_format) or http://schmidt.devlib.org/file-formats/tar-archive-file-format.html
http://en.wikipedia.org/wiki/Tar_(file_format)或http://schmidt.devlib.org/file-formats/tar-archive-file-format.html
#6
0
Instead of making a format, I'd just decide on a convention. One or more named files within the container have the metadata you need to access the rest of the files, and know what to do with them. The container itself, though, should just be some ubiquitous format, such as zip. No need to reinvent the wheel, here.
我只决定一个约定,而不是制作一种格式。容器中的一个或多个命名文件具有访问其余文件所需的元数据,并知道如何处理它们。然而,容器本身应该是一些普遍存在的格式,例如zip。这里不需要重新发明*。
#1
2
Have a look at the open source 7Zip compression format. For your specific needs, you can use it in an "Archive" mode, zero compression but very fast.
看看开源7Zip压缩格式。根据您的特定需求,您可以在“归档”模式下使用它,零压缩但速度非常快。
It provides a powerful SDK, LZMA, from the site:
它从站点提供了一个功能强大的SDK,LZMA:
"LZMA is the default and general compression method of 7z format in the 7-Zip program. LZMA provides a high compression ratio and very fast decompression, so it is very suitable for embedded applications. For example, it can be used for ROM (firmware) compressing.
“LZMA是7-Zip程序中7z格式的默认和通用压缩方法.LZMA提供高压缩比和非常快速的解压缩,因此非常适合嵌入式应用。例如,它可用于ROM(固件)压缩。
The LZMA SDK provides the documentation, samples, header files, libraries, and tools you need to develop applications that use LZMA compression."
LZMA SDK提供了开发使用LZMA压缩的应用程序所需的文档,示例,头文件,库和工具。“
#2
4
If you want a single file that is portable to all platforms and which contain structured data, consider using sqlite. You'll get a full featured ACID compliant database that exists on disk as a single file.
如果您想要一个可移植到所有平台并包含结构化数据的单个文件,请考虑使用sqlite。您将获得一个功能齐全的ACID兼容数据库,该数据库作为单个文件存在于磁盘上。
There are libraries you can link against to directly access the file, and there is a command line tool you can use as well. No matter what language you are using, most likely there is support for it.
您可以链接的库可以直接访问该文件,您也可以使用命令行工具。无论您使用何种语言,最有可能都支持它。
#3
2
Zip is supported everywhere. If a container is all you need, than those are surely good options.
Zip随处可见。如果你需要一个容器,那么这些肯定是不错的选择。
#4
1
SQLite is great.
SQLite很棒。
A single file, crossplatform, a tiny library, SQL access to data, transactions, the whole enchilada.
单个文件,跨平台,小型库,SQL访问数据,事务,整个辣酱玉米饼馅。
you can use transactions to guarantee consistent return points in case of crashing. check uses for sqlite, they specifically advocate using it as a data model layer for desktop applications.
如果崩溃,您可以使用事务来保证一致的返回点。 check用于sqlite,他们特别提倡将其用作桌面应用程序的数据模型层。
also, there's a command-line tool to manually access the data.
此外,还有一个手动访问数据的命令行工具。
#5
0
First thing you should ask yourself is, "Do I really need to make my own?"
你要问自己的第一件事是,“我真的需要自己创作吗?”
Depending on what you want to use it for, you are probably better off using a common format and some pre-made libraries which already handle one of those formats very well.
根据您想要使用的内容,您可能最好使用通用格式和一些已经很好地处理其中一种格式的预制库。
Good places to start: http://www.destructor.de/libtar/index.htm (tar -- a the 'container' format) http://www.zlib.net/ (zlib -- a method of compressing data before or after you put it in the container)
好的开始:http://www.destructor.de/libtar/index.htm(tar - 一种'容器'格式)http://www.zlib.net/(zlib - 一种压缩数据的方法在将其放入容器之前或之后)
If you still really think you need to make your own, I would suggest studying something very simple first, like tar's format:
如果您仍然认为自己需要自己制作,我建议先学习一些非常简单的东西,比如tar的格式:
http://en.wikipedia.org/wiki/Tar_(file_format) or http://schmidt.devlib.org/file-formats/tar-archive-file-format.html
http://en.wikipedia.org/wiki/Tar_(file_format)或http://schmidt.devlib.org/file-formats/tar-archive-file-format.html
#6
0
Instead of making a format, I'd just decide on a convention. One or more named files within the container have the metadata you need to access the rest of the files, and know what to do with them. The container itself, though, should just be some ubiquitous format, such as zip. No need to reinvent the wheel, here.
我只决定一个约定,而不是制作一种格式。容器中的一个或多个命名文件具有访问其余文件所需的元数据,并知道如何处理它们。然而,容器本身应该是一些普遍存在的格式,例如zip。这里不需要重新发明*。