31 lines
624 B
C#
31 lines
624 B
C#
using Inspectron.Fastbuffer.Interfaces;
|
|
using Serilog;
|
|
|
|
namespace Inspectron.Fastbuffer.Filesystems;
|
|
|
|
public class DirectFilesystem:IFilesystem
|
|
{
|
|
public void Write(string path, byte[] data)
|
|
{
|
|
// ensure path
|
|
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
|
File.WriteAllBytes(path, data);
|
|
}
|
|
|
|
public byte[] Read(string path)
|
|
{
|
|
return File.ReadAllBytes(path);
|
|
}
|
|
|
|
public void Delete(string path)
|
|
{
|
|
Log.Debug($"Deleting {path}");
|
|
if (File.Exists(path))
|
|
File.Delete(path);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
|
|
}
|
|
} |