Пример #1
0
        public void MountTo(string mountPoint)
        {
            if ((OperatingSystem.IsMacOS() || OperatingSystem.IsLinux()) && Fuse.IsAvailable)
            {
                _fuse = new Fuse(this)
                {
                    MountPoint = mountPoint
                };

                Task.Run(() =>
                {
                    _fuse.Start();

                    CleanUp();
                });
            }
            else if (OperatingSystem.IsWindows() && Winfsp.IsAvailable)
            {
                _winfsp = new Winfsp(this);
                bool ret = _winfsp.Mount(mountPoint);

                if (ret)
                {
                    return;
                }

                _winfsp = null;
                CleanUp();
            }
            else
            {
                CleanUp();
            }
        }
Пример #2
0
        public void Umount()
        {
            if (OperatingSystem.IsMacOS() || OperatingSystem.IsLinux())
            {
                _fuse?.Umount();
                _fuse = null;
            }

            if (OperatingSystem.IsWindows())
            {
                _winfsp?.Umount();
                _winfsp = null;
            }

            CleanUp();
        }