I’m writing a new c# desktop application that is going to allow users to select a group of image files that the application requires to remember. I also have some other settings to save that I was going to save as an xml file along with the files they specify. I was thinking of trying to save the files together in a zip/cab type file or something similar, sort of like a .war or .docx file. That way when the user comes back, they can select their file and have everything they need. This way user’s wouldn’t be able to (easily) delete a needed file. Cons would be the file could get rather large, especially since it could contain image files.
But, then I was thinking of how visual studio stores things in their project files (.cproj) which is a pointer to specific files in a folder. This seems like a good solution also. Going this route, I’d have to add some more error checking to make sure the user didn’t delete a file. I’m not sure if this would out way the code needed to zip/unzip the files though.
Any pointers on which way would be better? Any pros/cons to either method?
Hmmmm…. as you are looking at having an XML file anyway, i would look at saving the image data as a CDATA section in the XML file, from this they can be recreated (and the images won’t get “lost” or “moved”).
While this can lead to a rather large XML file, you can always zip it once it gets over a certain size (up to a certain size there will be no payback in zipping it, the time it takes to unzip it can be longer than the time it takes to load the uncompressed version).
Including it in the XML file also eliminates the need for using a database for storage – although using SQLCompact might also be a viable option (you can just store the image in the database).