Пример #1
0
 public void CheckFileLockWrite()
 {
     using (var locked = new LockedFile(_tmpFile))
     {
         using (var f = File.Open(_tmpFile, FileMode.Open, FileAccess.Write)){};
     }
 }
Пример #2
0
 public void CheckFileLockRead()
 {
     using (var locked = new LockedFile(_tmpFile))
     {
         using (var f = File.Open(_tmpFile, FileMode.Open, FileAccess.Read)) { }
     }
 }
Пример #3
0
 public void CheckRelease()
 {
     try
     {
         using (var locked = new LockedFile(_tmpFile))
         {
             File.Open(_tmpFile, FileMode.Open);
         }
     }
     catch (IOException)
     {
         using(var f = File.Open(_tmpFile, FileMode.Open)){}
         return;
     }
     throw new Exception("Unexpected code path!");
 }