By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,356 Members | 2,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,356 IT Pros & Developers. It's quick & easy.

Storing multiple text files inone file.

P: n/a
Hey all, just wondering if anyone can point me in the right direction. I'm
developing a solution that allows a user to store multiple text-based
content (like code snippets, notes, documents etc.) in one master document.
I'm not exactly sure which is the most efficient method of going about
this. Should I:
a. Use a container file like a CAB file and read/write separate textfiles
to it?
b. Save all "documents" in a collection and serialize to a file?

the second option is the one I'm leaning towards, but then I run into
versioning problems (new builds of the application/class wont read the
serialized object). I'm at a loss here. I've looked at Treepad Lite and
it's method of storing files, but for the life of me I'm not sure how it's
done. A little help from you pros out there would be very much appreciated!
Thank you!

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Chris Murphy via DotNetMonster.com" <fo***@DotNetMonster.com> schrieb:
Hey all, just wondering if anyone can point me in the right direction. I'm
developing a solution that allows a user to store multiple text-based
content (like code snippets, notes, documents etc.) in one master
document.
I'm not exactly sure which is the most efficient method of going about
this. Should I:
a. Use a container file like a CAB file and read/write separate textfiles
to it?
b. Save all "documents" in a collection and serialize to a file?

If the purpose of the file is only to store a set of files, I'd prefer to
use CAB, ZIP or a similar file format. This will allow the user to use
other applications to open the file too.

Microsoft Cabinet Software Development Kit
<URL:http://support.microsoft.com/?scid=kb;EN-US;310618>

You can build CAB files using the "MAKECAB.EXE" utility that is IIRC
included in Windows. For extracting CAB files, you can use Microsoft's
"EXTRACT.EXE", which is available on the Windows XP CD or as part of the
Windows XP Support Tools:

<URL:http://groups.google.de/groups?selm=u%24EaZ074EHA.1296%40TK2MSFTNGP10.phx. gbl>

Alternative you can use p/invoke on 'SetupIterateCabinet'. A VB6 sample can
be found here:

View and Extract CAB File Contents Programmatically
<URL:http://www.thescarms.com/vbasic/CabExplorer.asp>

The Zip, GZip, BZip2 and Tar Implementation For .NET
<URL:http://www.icsharpcode.net/OpenSource/SharpZipLib/>

The VB.NET Resource Kit contains zipping functionality too (note that the
Resource Kit is not available any more, so the answer applies for the case
that you already
have a copy of the Resource Kit):

The Visual Basic .NET Resource Kit
<URL:http://msdn.microsoft.com/vbasic/vbrkit/>

It contains ComponentOne Zip for .NET:

ComponentOne Zipô for .NET
<URL:http://www.componentone.com/products.aspx?TabTypeID=1&ItemType=1&PanelIndex=14 &ItemID=53569&SubCategoryTypeID=0&TabMapID=57&TabI D=70>

Using J#'s zip functionality:

Using the Zip Classes in the J# Class Libraries to Compress Files and Data
with C#
<URL:http://msdn.microsoft.com/msdnmag/issues/03/06/zipcompression/>

..NET 2.0 will contain ZIP support too.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
Excellent! Thanks for the advice -- I think I'll use it for performing
backups of the file itself.

I've actually ended up taking a totally left field approach to my many-in-
one serialzation issue. I've extended a Treeview control and addded some
drag/drop funtionality and serialization/deserialzation to xml support. It
works like a dream, and even better makes, my generated files more portable!

--
Message posted via http://www.dotnetmonster.com
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.