0

I'm looking to make my own file format .

that format should contains pictures/pdf/and other files ...

also need to know how I can packer-unpacker for this format to unpack files from it/pack in it & reading the pictures from my own format to picture boxes on my WinForm for example.

I've searched but didn't really found what I'am looking for

I hope someone can help me , thank you

7
  • 1
    Why not use an existing archive format, such as ZIP or 7z? You could avail of open-source libraries for packing and unpacking such formats. Commented Oct 19, 2013 at 16:27
  • for security , I want to be the only one able to read that format . Commented Oct 19, 2013 at 16:29
  • but as I can see no one is answering , this means it's impossible ? Commented Oct 19, 2013 at 16:30
  • If you're writing your application in .NET, then it's trivial for a decent developer to reverse-engineer your assemblies and decode your file format. Even if you weren't, an experienced developer would still be able to infer your format if they have access to your binaries. It's not that it's impossible, but it involves more effort than it's worth. Commented Oct 19, 2013 at 16:32
  • 2
    If your concern is security, you should look at cryptography rather than obfuscation. In particular, you might want to look at public–private key cryptography. Commented Oct 19, 2013 at 16:34

3 Answers 3

1

Zip is an excellent choice. Because you can encrypt the file and of course reduce the file size in some cases (text and uncompressed things). But if you want to create your own file format you can easily decide rules for your storage and order inside the file. Then serialize the info into the file. For example by object serialization or by writing the binary date to file object by object .

Sign up to request clarification or add additional context in comments.

Comments

1

if you really want to write your own file format then I would suggest one of two things. One, you could do it entirely in binary at which point you would want to do a 'chunk' format. Chunk format is to basically have a header to each subsection. The header contains the size of both the header as well as the size of the payload. Create a serialization class for your header then add the bytes to the filestream from your payload. Actually pretty easy to do.

Second (and easier) way to do this would be to create an XML format. Create a master class for your format then add all of the data as collections of sub classes under that. Once you have that, use any of .net xml serialization classes to serialize it out to disk.

Comments

0

You can also use SQLite for your purposes. It provides dbms power without needing server. That is popular solution for your problem.

System.Data.SQLite is an ADO.NET adapter for SQLite.

1 Comment

User wants to store data like: pictures/pdf and other files in this file format, a SQLite database isn't the best way for storing those files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.