mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Allow to umount VFS.
This commit is contained in:
@@ -1,7 +1,40 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RomRepoMgr.Core.Filesystem
|
||||
{
|
||||
public class Vfs
|
||||
public class Vfs : IDisposable
|
||||
{
|
||||
Fuse _fuse;
|
||||
|
||||
public static bool IsAvailable => Winfsp.IsAvailable || Fuse.IsAvailable;
|
||||
|
||||
public void Dispose() => _fuse?.Dispose();
|
||||
|
||||
public event EventHandler<System.EventArgs> Umounted;
|
||||
|
||||
public void MountTo(string result)
|
||||
{
|
||||
if(Fuse.IsAvailable)
|
||||
{
|
||||
_fuse = new Fuse
|
||||
{
|
||||
MountPoint = result
|
||||
};
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
_fuse.Start();
|
||||
|
||||
Umounted?.Invoke(this, System.EventArgs.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Umount()
|
||||
{
|
||||
_fuse?.Umount();
|
||||
_fuse = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user