public void Dispose()
 {
     _findFirstFile           = null;
     _createDirectoryDelegate = null;
     _createFileDelegate      = null;
     _moveFileDelegate        = null;
     _removeDirectoryDelegate = null;
     _readFileDelegate        = null;
     _deleteFileDelegate      = null;
 }
Beispiel #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;
 }
 private void InitializeDelegates()
 {
     _createFileDelegate                 = new CreateFileADelegate(CreateFileHook);
     _createDirectoryDelegate            = new CreateDirectoryDelegate(CreateDirectoryHook);
     _deleteFileDelegate                 = new DeleteFileDelegate(DeleteFileHook);
     _removeDirectoryDelegate            = new RemoveDirectoryDelegate(RemoveDirectoryHook);
     _moveFileDelegate                   = new MoveFileDelegate(MoveFileHook);
     _readFileDelegate                   = new ReadFileDelegate(ReadFileHook);
     _closeHandleDelegate                = new CloseHandleDelegate(CloseHandleHook);
     _getFileAttributesDelegate          = new GetFileAttributesDelegate(GetFileAttributesHook);
     _getFileTypeDelegate                = new GetFileTypeDelegate(GetFileTypeHook);
     _setFilePointerDelegate             = new SetFilePointerDelegate(SetFilePointerHook);
     _getFileInformationByHandleDelegate = new GetFileInformationByHandleDelegate(GetFileInformationByHandleHook);
     _setEndOfFileDelegate               = new SetEndOfFileDelegate(SetEndOfFileHook);
     _findFirstFile = new FindFirstFile(FindFirstFileHook);
     _findNextFile  = new FindNextFile(FindNextFileHook);
     _findClose     = new FindClose(FindCloseHook);
     _tioPathAdd    = new TioPathAdd(TioPathAddHook);
 }
Beispiel #4
0
        //public void DeleteLogFile(string filenm)
        //{
        //    DeleteFileDelegate deleteFileDelegate = new DeleteFileDelegate(DoDeleteFile);
        //    AsyncCallback callback = new AsyncCallback(DeletCallBackMethod);
        //    IAsyncResult iar = deleteFileDelegate.BeginInvoke(filenm, callback, deleteFileDelegate);
        //}

        public void DeleteLogFileBatch(List <string> files)
        {
            DeleteFileDelegate deleteFileDelegate = new DeleteFileDelegate(DoDeleteFileBatch);
            AsyncCallback      callback           = new AsyncCallback(DeletCallBackMethod);
            IAsyncResult       iar = deleteFileDelegate.BeginInvoke(files, callback, deleteFileDelegate);
        }
 private void BeginThreads()
 {
     while (InProgressActions.Count < MaxActions)
     {
         // Pop a pending action off the queue.
         SyncOperation op;
         lock (PendingFileActions)
         {
             op = PendingFileActions.Dequeue();
         }
         // Kick off a thread.
         switch (op.Action)
         {
             case SyncOperation.SyncAction.Copy:
                 CopyFileDelegate cf = new CopyFileDelegate(File.Copy);
                 lock (InProgressActions)
                 {
                     InProgressActions.Add(cf.BeginInvoke(op.SourceFile, op.TargetFile, FinishAction, cf));
                 }
                 break;
             case SyncOperation.SyncAction.Delete:
                 if (Directory.Exists(op.SourceFile))
                 {
                     DeleteDirectoryDelegate dd = new DeleteDirectoryDelegate(Directory.Delete);
                     lock (InProgressActions)
                     {
                         InProgressActions.Add(dd.BeginInvoke(op.SourceFile, FinishAction, dd));
                     }
                 }
                 else if (File.Exists(op.SourceFile))
                 {
                     DeleteFileDelegate df = new DeleteFileDelegate(File.Delete);
                     lock (InProgressActions)
                     {
                         InProgressActions.Add(df.BeginInvoke(op.SourceFile, FinishAction, df));
                     }
                 }
                 break;
             case SyncOperation.SyncAction.Move:
                 MoveFileDelegate mf = new MoveFileDelegate(File.Move);
                 lock (InProgressActions)
                 {
                     InProgressActions.Add(mf.BeginInvoke(op.SourceFile, op.TargetFile, FinishAction, mf));
                 }
                 break;
             default:
                 break;
         }
     }
 }