Пример #1
0
        public void Unmount()
        {
            if (this._threadCancel != null)
            {
                this._threadCancel.Cancel();
            }
            if (this._pauseEvent != null)
            {
                this._pauseEvent.Set();
            }

            Debug.WriteLine("Unmount");

            Status = DriveStatus.Unmounting;
            try
            {
                Dokan.RemoveMountPoint(String.Format("{0}:\\", mountedLetter));
            }
            catch
            {
                //Status = DriveStatus.Unmounted;
                //  OnStatusChanged(EventArgs.Empty);
            }
            finally
            {
                _filesystem = null;
            }
        }
Пример #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
        public void Dispose()
        {
            Debug.WriteLine("Dispose");

            try
            {
                Dokan.RemoveMountPoint(String.Format("{0}:\\", Letter));
            }
            catch
            {
                Status = DriveStatus.Unmounted;
            }
            finally
            {
                _filesystem = null;
            }
        }
Пример #4
0
        public void Unmount()
        {
            Debug.WriteLine("Unmount");

            Status = DriveStatus.Unmounting;
            try
            {
                // Dokan.Unmount(Letter);
                Dokan.RemoveMountPoint(String.Format("{0}:\\", Letter));
            }
            catch
            {
                //Status = DriveStatus.Unmounted;
                //  OnStatusChanged(EventArgs.Empty);
            }
            finally
            {
                _filesystem = null;
            }
        }
Пример #5
0
        public void Unmount()
        {
            _threadCancel?.Cancel();
            _pauseEvent?.Set();

            Debug.WriteLine("Unmount");

            Status = DriveStatus.Unmounting;
            try
            {
                Dokan.RemoveMountPoint($"{mountedLetter}:\\");
            }
            catch
            {
                //Status = DriveStatus.Unmounted;
                //  OnStatusChanged(EventArgs.Empty);
            }
            finally
            {
                _filesystem = null;
            }
        }
Пример #6
0
        public void Dispose()
        {
            Debug.WriteLine("Dispose");

            try
            {
                Dokan.RemoveMountPoint(String.Format("{0}:\\", Letter));
            }
            catch
            {
                Status = DriveStatus.Unmounted;
            }
            finally
            {
                _filesystem = null;
            }
        }
Пример #7
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);
                }

            }
        }
Пример #8
0
        public void Unmount()
        {
            Debug.WriteLine("Unmount");

            Status = DriveStatus.Unmounting;
            try
            {
                // Dokan.Unmount(Letter);
                Dokan.RemoveMountPoint(String.Format("{0}:\\", Letter));
            }
            catch
            {
                //Status = DriveStatus.Unmounted;
                //  OnStatusChanged(EventArgs.Empty);
            }
            finally
            {
                _filesystem = null;
            }
        }