I wrote such a plugin once. Forget about the template in a minute, you can do it from scratch.
Start by adding links to PaintDotnet.Base, PaintDotNet.Core, and PaintDotNet.Data.
, FileType:
:
public class SampleFileType : FileType
{
public SampleFileType() : base ("Sample file type", FileTypeFlags.SupportsSaving |
FileTypeFlags.SupportsLoading,
new string[] { ".sample" })
{
}
protected override void OnSave(Document input, System.IO.Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback)
{
using (RenderArgs ra = new RenderArgs(new Surface(input.Size)))
{
input.Render(ra);
var sampleData = ConvertBitmapToSampleFormat(ra.Bitmap);
output.Write(sampleData, 0, sampleData.Length);
}
}
protected override Document OnLoad(System.IO.Stream input)
{
using(var bitmap = ConvertFromFileToBitmap(input))
{
return Document.FromImage(bitmap);
}
}
}
, FileType. , (/) . .
, , .
, Pain.Net, FileType , , .
public class SampleFileTypeFactory : IFileTypeFactory
{
public FileType[] GetFileTypeInstances()
{
return new FileType[] { new SampleFileType() };
}
, , , . }