Sven Groot said:
I think a better approach would be to store your data in e.g. a zip file with a custom extension so your app can recognize them, much like Word's .docx files are actually zip files.
Thanks for the tip. I actually not only thought of that, but implemented using the .net package library. A few problems came up.
1. The .NET package library performs very poorly in a highly multithreaded enviornment, and trying to serialize my data accesss was turning into a whack-the-mole bug farm that wasn't working. (I often have multiple audio streams and photos comming in from multiple devices simultaneously, multithreading is a must.)
2. The .NET package library has a particularly egregious bug that if you don't close it right, it throws an exception and leaves the file in a completely unreadable state. The software threw one of those bugs at me just as I was printing the results of a 6 hour long forensic consultation. I swore I would never use a data store that didn't support transactions. (So I could guarentee that the worst clicking save would do is take you back to the last save point.)
3. Beleive it on not, renaming a file from .pda to .zip is a little to complicated more complicated that some of my collegues want to deal with. (By expert here we mean medical experts, who are by no means computer experts.)
4. WPFs media player will play from a file, but not from an arbitrary stream. It would be nice to be able to hand a video file to that componet and have it just play rather than trying to jimmy it into working with a stream.
Anyway your solution is very good, and had a lot of positives running for it. If I could find a ZIP library that did in place zip file modifications, was transactional, and was threadsafe, it would be the perfect solution. Given that no such library is forth comming, I was hoping to find a hack to make it work.