示例#1
0
        public void LockFile(string filePath, LockFileDelegate lockFileFunction)
        {
            if (IsLocked(filePath))
            {
                throw new Exception("File " + filePath + " is already locked");
            }

            IDisposable fileLocker = lockFileFunction(filePath);

            _lockedFiles.Add(filePath, fileLocker);
        }
示例#2
0
 protected DokanDefaultImplementation(CreateFileDelegate onCreateFile           = null,
                                      OpenDirectoryDelegate onOpenDirectory     = null,
                                      CreateDirectoryDelegate onCreateDirectory = null,
                                      CleanupDelegate onCleanup     = null,
                                      CloseFileDelegate onCloseFile = null,
                                      ReadFileDelegate onReadFile   = null,
                                      WriteFileDelegate onWriteFile = null,
                                      FlushFileBuffersDelegate onFlushFileBuffers     = null,
                                      GetFileInformationDelegate onGetFileInformation = null,
                                      FindFilesDelegate onFindFiles = null,
                                      SetFileAttributesDelegate onSetFileAttributes = null,
                                      SetFileTimeDelegate onSetFileTime             = null,
                                      DeleteFileDelegate onDeleteFile           = null,
                                      DeleteDirectoryDelegate onDeleteDirectory = null,
                                      MoveFileDelegate onMoveFile                   = null,
                                      SetEndOfFileDelegate onSetEndOfFile           = null,
                                      SetAllocationSizeDelegate onSetAllocationSize = null,
                                      LockFileDelegate onLockFile                   = null,
                                      UnlockFileDelegate onUnlockFile               = null,
                                      GetDiskFreeSpaceDelegate onGetDiskFreeSpace   = null,
                                      UnmountDelegate onUnmount = null)
 {
     OnCreateFile         = onCreateFile;
     OnOpenDirectory      = onOpenDirectory;
     OnCreateDirectory    = onCreateDirectory;
     OnCleanup            = onCleanup;
     OnCloseFile          = onCloseFile;
     OnReadFile           = onReadFile;
     OnWriteFile          = onWriteFile;
     OnFlushFileBuffers   = onFlushFileBuffers;
     OnGetFileInformation = onGetFileInformation;
     OnFindFiles          = onFindFiles;
     OnSetFileAttributes  = onSetFileAttributes;
     OnSetFileTime        = onSetFileTime;
     OnDeleteFile         = onDeleteFile;
     OnDeleteDirectory    = onDeleteDirectory;
     OnMoveFile           = onMoveFile;
     OnSetEndOfFile       = onSetEndOfFile;
     OnSetAllocationSize  = onSetAllocationSize;
     OnLockFile           = onLockFile;
     OnUnlockFile         = onUnlockFile;
     OnGetDiskFreeSpace   = onGetDiskFreeSpace;
     OnUnmount            = onUnmount;
 }