Fix bug with shpk editing.

This commit is contained in:
Ottermandias 2023-04-20 09:35:23 +02:00
parent 1364b39f65
commit 25cb46525a
2 changed files with 4 additions and 7 deletions

View file

@ -26,7 +26,7 @@ public class FileEditor<T> where T : class, IWritable
public FileEditor(ModEditWindow owner, DataManager gameData, Configuration config, FileDialogService fileDialog, string tabName,
string fileType, Func<IReadOnlyList<FileRegistry>> getFiles, Func<T, bool, bool> drawEdit, Func<string> getInitialPath,
Func<byte[], T?>? parseFile)
Func<byte[], T?> parseFile)
{
_owner = owner;
_gameData = gameData;
@ -35,7 +35,7 @@ public class FileEditor<T> where T : class, IWritable
_fileType = fileType;
_drawEdit = drawEdit;
_getInitialPath = getInitialPath;
_parseFile = parseFile ?? DefaultParseFile;
_parseFile = parseFile;
_combo = new Combo(config, getFiles);
}
@ -170,9 +170,6 @@ public class FileEditor<T> where T : class, IWritable
UpdateCurrentFile(_combo.CurrentSelection);
}
private static T? DefaultParseFile(byte[] bytes)
=> Activator.CreateInstance(typeof(T), bytes) as T;
private void UpdateCurrentFile(FileRegistry path)
{
if (ReferenceEquals(_currentPath, path))