Ejemplo n.º 1
0
            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);
                }
            }
Ejemplo n.º 2
0
 protected virtual void CloseFileStream()
 {
     try
     {
         if (_fileInfoLock != null)
         {
             _fileInfoLock.Dispose();
             _fileInfoLock = null;
         }
     }
     catch (Exception exception)
     {
         Log.Error(exception, false);
     }
 }
Ejemplo n.º 3
0
            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);
                }
            }