This is what I have now as "Best example" (least amount of errors and such) in Code.cs
But not working of course.
using System;
using System.Collections.Generic;
using System.Text;
using PaintDotNet;
using PaintDotNet.Data;
using System.IO;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Imaging;
namespace PaintDotNet.Data
{
public class SPZFileType : FileType
{
internal SPZFileType()
: base(
"SPAZ Image format",
0
| FileTypeFlags.SupportsLoading /* | FileTypeFlags.SupportsSaving */
,
new[] { ".spz" })
{
}
protected override Document OnLoad(Stream input)
{
PngFileType pngft = new PngFileType();
Document doc = pngft.Load(input);
return doc;
}
/*
protected override void OnSave(Document input, Stream output , SaveConfigToken token,
Surface scratchSurface, ProgressEventHandler callback)
{
PngFileType pngft = new PngFileType();
Document doc = pngft.Save(output, ImageFormat.Png);
}
*/
//Keep Save/load stuff above this line!!
}
public class SPZFileTypeFactory : IFileTypeFactory
{
public FileType[] GetFileTypeInstances()
{
return new FileType[] { new SPZFileType() };
}
}
}
I've currently (and deliberately) commented out the "Supportsaving" and "onSave" sections. (for now)
Amongst the "OnSave" Section still pops up the error: "No overload for method 'Save' takes 2 arguments"
Which is on the pngft.Save part.
This is the part where it still fails and is probably in it's entire wrong from the get go. (everything between { & } there)
Everything else works. (the .spz filetype is correctly opened by Paint.net)
Just due to the lack of a save section it can't be saved as .spz if wanted. (or force paint.net to show a "save as.." dialog instead, when trying to close with edits unsaved)
The "//Keep Save/load stuff above this line!!" is because my tweaking caused code to get underneath the "}" that is placed below it.
Which will breaks just about the whole file.