Add Editor.cs

This commit is contained in:
miku-666
2025-02-01 11:57:41 +01:00
parent ae2e10d658
commit 6e17072629
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MetroFramework.Forms;
using PckStudio.Interfaces;
namespace PckStudio.Internal
{
public abstract class Editor<T> : MetroForm where T : class
{
protected T EditorValue;
private readonly ISaveContext<T> SaveContext;
protected Editor(T value, ISaveContext<T> saveContext)
{
_ = value ?? throw new ArgumentNullException(nameof(value));
EditorValue = value;
SaveContext = saveContext;
}
protected void Save() => SaveContext.Save(EditorValue);
}
}

View File

@@ -164,6 +164,9 @@
</Compile>
<Compile Include="Interfaces\IModelImportProvider.cs" />
<Compile Include="Internal\App\Updater.cs" />
<Compile Include="Internal\Editor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Internal\GameModelInfo.cs" />
<Compile Include="Internal\IO\PSM\PSMFileReader.cs" />
<Compile Include="Internal\IO\PSM\PSMFileWriter.cs" />