Files
HawkeyeVision/framework/Inspectron.Fastbuffer/Filesystems/DirectFilesystem.cs
2025-09-05 11:11:23 +02:00

33 lines
677 B
C#

using Inspectron.Fastbuffer.Interfaces;
using OpenCvSharp;
using Serilog;
namespace Inspectron.Fastbuffer.Filesystems;
public class DirectFilesystem:IFilesystem
{
public void Write(string path, Mat data)
{
// ensure path
Directory.CreateDirectory(Path.GetDirectoryName(path));
var bytes = data.ToBytes();
File.WriteAllBytes(path, bytes);
}
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()
{
}
}