diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 2724d511..5bcd026c 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 8e1650a9..d7a448e7 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index 62f209cf..fd5a78b0 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index cd653cbd..df022dee 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 4f8fd766..182b4f23 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs b/Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs index 9d35abe8..10b57a91 100644 --- a/Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs +++ b/Switch_Toolbox_Library/Forms/Archive/ArchiveFilePanel.cs @@ -57,11 +57,47 @@ namespace Switch_Toolbox.Library.Forms { if (GetEditor() == 0) UpdateHexView(); - + if (GetEditor() == 1) + UpdateFileEditor(); if (GetEditor() == 2) UpdateTextView(); } + private void UpdateFileEditor() + { + var File = ArchiveFileInfo.FileFormat; + if (File == null) + File = ArchiveFileInfo.OpenFile(); + + UserControl control = GetEditorForm(File); + if (control != null) + { + AddControl(control); + + // if (CheckActiveType(control.GetType())) + // AddControl(control); + } + } + + private bool CheckActiveType(Type type) + { + return stPanel1.Controls.Count > 0 && stPanel1.Controls[0].GetType() != type; + } + + public UserControl GetEditorForm(IFileFormat fileFormat) + { + Type objectType = fileFormat.GetType(); + foreach (var inter in objectType.GetInterfaces()) + { + if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>)) + { + System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm"); + return (UserControl)method.Invoke(fileFormat, new object[0]); + } + } + return null; + } + private void UpdateTextView() { TextEditor editor = (TextEditor)GetActiveEditor(typeof(TextEditor)); diff --git a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs index fece5481..d0a17265 100644 --- a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs +++ b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs @@ -530,7 +530,7 @@ namespace Switch_Toolbox.Library return; } - private UserControl GetEditorForm(IFileFormat fileFormat) + public UserControl GetEditorForm(IFileFormat fileFormat) { Type objectType = fileFormat.GetType(); foreach (var inter in objectType.GetInterfaces()) diff --git a/Toolbox/Lib/Syroot.NintenTools.Bfres.dll b/Toolbox/Lib/Syroot.NintenTools.Bfres.dll index b3583fbc..0cf85e07 100644 Binary files a/Toolbox/Lib/Syroot.NintenTools.Bfres.dll and b/Toolbox/Lib/Syroot.NintenTools.Bfres.dll differ diff --git a/Toolbox/Lib/Syroot.NintenTools.Bfres.pdb b/Toolbox/Lib/Syroot.NintenTools.Bfres.pdb index 130de0fa..d0857ca9 100644 Binary files a/Toolbox/Lib/Syroot.NintenTools.Bfres.pdb and b/Toolbox/Lib/Syroot.NintenTools.Bfres.pdb differ diff --git a/Toolbox/Lib/Syroot.NintenTools.Bfres.xml b/Toolbox/Lib/Syroot.NintenTools.Bfres.xml index f49bf760..645500dd 100644 --- a/Toolbox/Lib/Syroot.NintenTools.Bfres.xml +++ b/Toolbox/Lib/Syroot.NintenTools.Bfres.xml @@ -5580,6 +5580,11 @@ Gets or sets the pixel swizzling stride. + + + Gets or sets the desired texture data buffer format. + + Gets or sets the desired texture data buffer format.