Files
romrepomgr/RomRepoMgr.Core/Filesystem/Vfs.cs

40 lines
864 B
C#
Raw Normal View History

2020-09-01 11:54:16 +01:00
using System;
using System.Threading.Tasks;
2020-08-30 14:22:41 +01:00
namespace RomRepoMgr.Core.Filesystem
{
2020-09-01 11:54:16 +01:00
public class Vfs : IDisposable
2020-08-30 14:22:41 +01:00
{
2020-09-01 11:54:16 +01:00
Fuse _fuse;
2020-08-30 14:22:41 +01:00
public static bool IsAvailable => Winfsp.IsAvailable || Fuse.IsAvailable;
2020-09-01 11:54:16 +01:00
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;
}
2020-08-30 14:22:41 +01:00
}
}