Files
Speykious a099ea939f Refactor resource provider (#27)
* These pointers are C++ strings, not C strings

* Create a `DummyResourceManager` as an example

* Hide unsafe APIs

* Oops

* Using a `Span` results in segfaults :(

* Handle exceptions in `provideResource`

* Remove stray comment

* Document the delegates

Co-authored-by: Ayane Satomi <ayane@vignetteapp.org>
2022-03-11 14:52:33 +01:00

27 lines
784 B
C#

// Copyright (c) homuler and The Vignette Authors
// This file is part of MediaPipe.NET.
// MediaPipe.NET is licensed under the MIT License. See LICENSE for details.
using System;
using System.IO;
using Mediapipe.Net.Util;
namespace Mediapipe.Net.Examples.FaceMesh
{
public class DummyResourceManager : ResourceManager
{
public override PathResolver ResolvePath => (path) =>
{
Console.WriteLine($"PathResolver: (not) resolving path '{path}'");
return path;
};
public unsafe override ResourceProvider ProvideResource => (path) =>
{
Console.WriteLine($"ResourceProvider: providing resource '{path}'");
byte[] bytes = File.ReadAllBytes(path);
return bytes;
};
}
}