I want my program to be able to make a copy of a file before another program changes it's contents. I looked into FileSystemWatcher, but I don't think that will be able to help me, as I didn't see any thing about being able to catch or prevent events.
One solution I thought of was detecting when a program open a file with write privileges, and making a copy in memory at that point. I don't know how to detect when a file is opened by another program though.
Incase my desired results are unclear, here is an example. Audio files are linked to the music folders of multiple users on a system to save disk space. If a user want to modify the metadata of a music file, or apply some sort audio effect to a file, the modification shouldn't effect the other user's copies. The user should automatically get his own copy upon making a change.