Ok, thanks for your replys. Actually I am not a coder except some very basic Java knowledge. But I managed it to create a functional Filetype plugin. I have no idea, if it is good coding style but at least it is working for me and I'd like to share this here - just in case someone is having a similar problem.
My code is based on a project template created by toe_head2001 - thanks man, that helped a lot:
using PaintDotNet;
using System.IO;
using System.Drawing;
namespace RoHoFileTypePlugin2
{
public sealed class RoHoFileTypePlugin2Factory : IFileTypeFactory
{
public FileType[] GetFileTypeInstances()
{
return new[] { new RoHoFileTypePlugin2Plugin() };
}
}
[PluginSupportInfo(typeof(PluginSupportInfo))]
internal class RoHoFileTypePlugin2Plugin : FileType
{
// Constructs a ExamplePropertyBasedFileType instance
internal RoHoFileTypePlugin2Plugin()
: base(
"MyFileType",
new FileTypeOptions
{
LoadExtensions = new string[] { ".1", ".2" },
})
{
}
/// <summary>
/// Creates a document from a stream
/// </summary>
protected override Document OnLoad(Stream input)
{
Image image = Image.FromStream(input, true);
return Document.FromImage(image);
}
}
}