Hi,
What's the best way to tell my application that the file has been modified and that it should ask the user for a filename? Is there a class for that or do I write that all that logic by hand?
Thanks!
Hi,
What's the best way to tell my application that the file has been modified and that it should ask the user for a filename? Is there a class for that or do I write that all that logic by hand?
Thanks!
You'll need to handle that logic by hand. It's not too difficult if you've got a decent application architecture working for you. Just flip a Modified
flag on your "file" object that gets serialized to disk whenever the object is mutated.
Another solution is something I've seen recently. If setting a modified flag on your 'file' object is difficult, you could always try saving to a memory stream and calculating a hash on it, and if the hash is different to the original version's hash, it has changed.
It's not as elegant as setting a modified flag, but is much easier to retrofit.