22 lines
801 B
C#
22 lines
801 B
C#
namespace AcDream.Plugin.Abstractions;
|
|
|
|
/// <summary>
|
|
/// Per-plugin durable text storage. The host scopes keys to the authenticated
|
|
/// manifest id, so a plugin cannot collide with another plugin's profile.
|
|
/// </summary>
|
|
public interface IPluginStorage
|
|
{
|
|
bool IsAvailable => false;
|
|
string? ReadText(string key) => null;
|
|
/// <summary>Relative file keys beneath one relative prefix.</summary>
|
|
IReadOnlyList<string> List(string prefix) => Array.Empty<string>();
|
|
void WriteText(string key, string content) =>
|
|
throw new NotSupportedException("Plugin storage is unavailable.");
|
|
bool Delete(string key) => false;
|
|
}
|
|
|
|
public sealed class NoOpPluginStorage : IPluginStorage
|
|
{
|
|
public static NoOpPluginStorage Instance { get; } = new();
|
|
private NoOpPluginStorage() { }
|
|
}
|