public class ExamplePlugin : IFilePlugin, IIdentifyFiles
{
// This is the unique plugin id, with which a plugin can be identified in the framework
public Guid PluginId => Guid.Parse("a-valid-Guid-here");
// These file extensions allow for an additional identification of the format
public string[] FileExtensions => new[] { "*.ext" };
// Additional plugin meta data
public PluginMetadata Metadata => new PluginMetadata("Format name", "Plugin author", "Short description");
// Allows an identification of one or more files of the parent file system to identify
// if the given file is the supported file format.
public async Task<bool> IdentifyAsync(IFileSystem fileSystem, UPath filePath, IdentifyContext context)
{
var fileStream = await fileSystem.OpenFileAsync(filePath);
using var br = new BinaryReaderX(fileStream);
return br.ReadString(4) == "MGCK";
}
// Creates the plugin state, which implements all the format specific actions and properties
public IPluginState CreatePluginState(IPluginManager pluginManager)
{
return new ExampleState();
}
}
After
public class ExamplePlugin : IFilePlugin, IIdentifyFiles
{
// This is the unique plugin id, with which a plugin can be identified in the framework
public Guid PluginId => Guid.Parse("a-valid-Guid-here");
// These file extensions allow for an additional identification of the format
public string[] FileExtensions => new[] { "*.ext" };
// Additional plugin meta data
public PluginMetadata Metadata => new PluginMetadata("Format name", "Plugin author", "Short description");
public PluginType PluginType => PluginType.Archive;
// Allows an identification of one or more files of the parent file system to identify
// if the given file is the supported file format.
public async Task<bool> IdentifyAsync(IFileSystem fileSystem, UPath filePath, IdentifyContext context)
{
var fileStream = await fileSystem.OpenFileAsync(filePath);
using var br = new BinaryReaderX(fileStream);
return br.ReadString(4) == "MGCK";
}
public IPluginState CreatePluginState(IBaseFileManager fileManager)
{
return new ExampleState();
}
}
Description
Very small: while reading some documentation, I noticed that the example code snippet it out of date. I'm hoping to have some of that wiki documentation updated. Here is the reference. https://github.com/FanTranslatorsInternational/Kuriimu2/wiki/Plugins#plugin-class
Change
CreatePluginState
Before
After