protected virtual void Lock(string filePath, System.IO.FileMode fileMode, System.IO.FileAccess fileAccess, System.IO.FileShare fileShare) { try { try { if (FileInfo == null) { throw new Exception("FileInfo is null"); } _fileInfoLock = LockStream(this, filePath, fileMode, fileAccess, fileShare); } catch (Exception exception) { throw new Exception("Could not lock file '" + Title + "' - " + exception.Message); } } catch (Exception exception) { Log.Error(exception, breakWithDebugger: false); } }
protected virtual void CloseFileStream() { try { if (_fileInfoLock != null) { _fileInfoLock.Dispose(); _fileInfoLock = null; } } catch (Exception exception) { Log.Error(exception, false); } }
protected virtual void Lock() { try { try { if (FileInfo == null) { throw new Exception("FileInfo is null"); } _fileInfoLock = LockStream(this, FilePath); } catch (Exception exception) { throw new Exception("Could not lock file '" + Title + "' - " + exception.Message); } } catch (Exception exception) { Log.Error(exception); } }