Пример #1
0
 internal void AddSubFS(SftpDrive sftpDrive)
 {
     _drives.Add(sftpDrive);
     if (_filesystem != null)
     {
         _filesystem.AddSubFS(sftpDrive);
     }
 }
Пример #2
0
        private void MountLoop()
        {
            while (true)
            {
                Debug.WriteLine("Thread:Pause");

                _pauseEvent.WaitOne(-1);
                if (_threadCancel.IsCancellationRequested)
                {
                    Debug.WriteLine("Thread:Cancel");
                    break;
                }

                Debug.WriteLine("Thread:Mount");


                try
                {
                    _filesystem = new VirtualFilesystem("WinSshFS spool");
                    foreach (SftpDrive drive in _drives)
                    {
                        if (drive.MountPoint != "")
                        {
                            _filesystem.AddSubFS(drive);
                        }
                    }
                    mountedLetter = Letter;
                    int threadCount = 8;
#if DEBUG
                    threadCount = 1;
#endif
                    _filesystem.Mount(String.Format("{0}:\\", mountedLetter), Settings.Default.UseNetworkDrive ? DokanOptions.NetworkDrive : DokanOptions.RemovableDrive, threadCount);
                }
                catch (Exception e)
                {
                    _lastExeption   = e;
                    _exeptionThrown = true;
                    _mountCancel.Cancel();
                }
                Status            = DriveStatus.Unmounted;
                this._mountThread = null;
                if (!_exeptionThrown)
                {
                    OnStatusChanged(EventArgs.Empty);
                }
            }
        }
Пример #3
0
        private void MountLoop()
        {
            while (true)
            {
                Debug.WriteLine("Thread:Pause");

                _pauseEvent.WaitOne(-1);
                if (_threadCancel.IsCancellationRequested)
                {
                    Debug.WriteLine("Thread:Cancel");
                    break;
                }

                Debug.WriteLine("Thread:Mount");

                try
                {
                    _filesystem = new VirtualFilesystem("WinSshFS spool");
                    foreach (SftpDrive drive in _drives)
                    {
                        _filesystem.AddSubFS(drive);
                    }

                    _filesystem.Mount(String.Format("{0}:\\", Letter), Settings.Default.UseNetworkDrive ? DokanOptions.NetworkDrive | DokanOptions.KeepAlive : DokanOptions.RemovableDrive | DokanOptions.KeepAlive);
                }
                catch (Exception e)
                {

                    _lastExeption = e;
                    _exeptionThrown = true;
                    _mountCancel.Cancel();
                }
                Status = DriveStatus.Unmounted;
                if (!_exeptionThrown)
                {

                    OnStatusChanged(EventArgs.Empty);
                }

            }
        }
Пример #4
0
 internal void AddSubFS(SftpDrive sftpDrive)
 {
     _drives.Add(sftpDrive);
     _filesystem?.AddSubFS(sftpDrive);
 }