Well, one can easily check the state of a file (whether it is used or not) via FileWatcher in C#.NET. Following is more handy if you want to handle it manually and need to log it.
// create an event
public delegate void FileUpdatedEventHandler (object sender, EventArgs e);
public event FileUpdateEventHandler Updated;
private _lastWrite = 0;
private void CheckFileChanged () {
string myFile = @"C:\myconnections.txt";
FileInfo fi = new FileInfo(myFile);
if (_lastWrite == 0) {
_lastWrite = fi.LastWriteTimeUtc;
}
else if (_lastWrite != fi.LastWriteUtc) {
if (Updated != null)
// fire off the event
Updated(this, EventArgs.Empty); // change this if you want to pass some data
}
}