Add basic file removale. Will be improved later
This commit is contained in:
parent
efd6d6613e
commit
325f1e25f6
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using Switch_Toolbox.Library.Forms;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class BEA : TreeNode, IArchiveFile
|
||||
public class BEA : TreeNodeFile, IArchiveFile
|
||||
{
|
||||
public bool CanAddFiles { get; set; } = false;
|
||||
public bool CanRenameFiles { get; set; } = false;
|
||||
@ -126,17 +126,14 @@ namespace FirstPlugin
|
||||
beaFile = new BezelEngineArchive(stream);
|
||||
FillTreeNodes(this, beaFile.FileList);
|
||||
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Save", null, Save, Keys.Control | Keys.S));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Preview Window", null, PreviewWindow, Keys.Control | Keys.P));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Export All", null, ExportAll, Keys.Control | Keys.E));
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem save = new MenuItem("Save");
|
||||
ContextMenu.MenuItems.Add(save);
|
||||
save.Click += Save;
|
||||
MenuItem previewFiles = new MenuItem("Preview Window");
|
||||
ContextMenu.MenuItems.Add(previewFiles);
|
||||
previewFiles.Click += PreviewWindow;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
CanDelete = true;
|
||||
}
|
||||
public void Unload()
|
||||
{
|
||||
|
@ -46,13 +46,12 @@ namespace FirstPlugin
|
||||
|
||||
Text = FileName;
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem save = new MenuItem("Save");
|
||||
ContextMenu.MenuItems.Add(save);
|
||||
save.Click += Save;
|
||||
MenuItem previewFiles = new MenuItem("Preview Window");
|
||||
ContextMenu.MenuItems.Add(previewFiles);
|
||||
previewFiles.Click += PreviewWindow;
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Save", null, Save, Keys.Control | Keys.S));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Preview Window", null, PreviewWindow, Keys.Control | Keys.P));
|
||||
|
||||
CanDelete = true;
|
||||
}
|
||||
public void Unload()
|
||||
{
|
||||
|
@ -59,8 +59,8 @@ namespace FirstPlugin
|
||||
SelectedImageKey = "bntx";
|
||||
}
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
ContextMenu.MenuItems.Add(new MenuItem("Export Raw Data", Export));
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Export Raw Data", null, Export, Keys.Control | Keys.E));
|
||||
}
|
||||
private void Export(object sender, EventArgs args)
|
||||
{
|
||||
|
@ -65,6 +65,7 @@ namespace FirstPlugin
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Batch Texture Editor", null, PreviewTextures, Keys.Control | Keys.P));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Sort Childern", null, SortChildern, Keys.Control | Keys.E));
|
||||
CanDelete = true;
|
||||
|
||||
sarcData.Files.Clear();
|
||||
}
|
||||
@ -79,6 +80,13 @@ namespace FirstPlugin
|
||||
|
||||
}
|
||||
|
||||
private void Delete(object sender, EventArgs args) {
|
||||
Unload();
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (editor != null)
|
||||
editor.ResetControls();
|
||||
}
|
||||
|
||||
private void SortChildern(object sender, EventArgs args)
|
||||
{
|
||||
TreeView.TreeViewNodeSorter = new TreeChildSorter();
|
||||
|
@ -46,7 +46,6 @@ namespace FirstPlugin
|
||||
|
||||
public bool CanAddFiles { get; set; } = true;
|
||||
public bool CanRenameFiles { get; set; } = true;
|
||||
public bool CanDelete { get; set; } = true;
|
||||
public bool CanReplaceFiles { get; set; } = true;
|
||||
public bool CanDeleteFiles { get; set; } = true;
|
||||
|
||||
@ -54,6 +53,8 @@ namespace FirstPlugin
|
||||
{
|
||||
Text = FileName;
|
||||
|
||||
CanDelete = true;
|
||||
|
||||
using (var reader = new FileReader(stream))
|
||||
{
|
||||
reader.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
|
||||
|
@ -466,6 +466,8 @@ namespace FirstPlugin
|
||||
|
||||
public void Load(ResU.ResFile res)
|
||||
{
|
||||
CanDelete = true;
|
||||
|
||||
resFileU = res;
|
||||
|
||||
Text = resFileU.Name;
|
||||
|
@ -120,7 +120,7 @@ namespace FirstPlugin
|
||||
|
||||
STToolStripItem[] newFileExt = new STToolStripItem[2];
|
||||
|
||||
public MenuExt()
|
||||
public MenuExt()
|
||||
{
|
||||
newFileExt[0] = new STToolStripItem("KCL (Switch)", CreateNew);
|
||||
newFileExt[1] = new STToolStripItem("KCL (Wii U)", CreateNew);
|
||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Switch_Toolbox.Library.NodeWrappers;
|
||||
using Switch_Toolbox.Library.Animations;
|
||||
using Switch_Toolbox.Library;
|
||||
using System.Windows.Forms;
|
||||
using ResU = Syroot.NintenTools.Bfres;
|
||||
using ResNX = Syroot.NintenTools.NSW.Bfres;
|
||||
@ -20,12 +20,21 @@ namespace FirstPlugin.NodeWrappers
|
||||
}
|
||||
|
||||
public bool IsWiiU { get; set; }
|
||||
|
||||
|
||||
public void LoadMenus(bool isWiiUBfres)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (editor != null)
|
||||
{
|
||||
editor.RemoveFile(this);
|
||||
editor.ResetControls();
|
||||
}
|
||||
}
|
||||
|
||||
protected void ImportModelAction(object sender, EventArgs e) { ImportModel(); }
|
||||
protected void ImportEmbeddedFileAction(object sender, EventArgs e) { ImportEmbeddedFile(); }
|
||||
|
@ -200,6 +200,7 @@
|
||||
<Compile Include="FileFormats\BFRES\BFRESAnimFolder.cs" />
|
||||
<Compile Include="FileFormats\BFRES\gfxEnum.cs" />
|
||||
<Compile Include="FileFormats\BFRES\GLEnumConverter.cs" />
|
||||
<Compile Include="FileFormats\Collision\KclFile.cs" />
|
||||
<Compile Include="FileFormats\Font\BFFNT.cs" />
|
||||
<Compile Include="FileFormats\Audio\Archives\BFGRP.cs" />
|
||||
<Compile Include="FileFormats\Hashes\SAHT.cs" />
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -24,13 +24,40 @@ namespace Switch_Toolbox.Library
|
||||
}
|
||||
public class TreeNodeFile : TreeNodeCustom
|
||||
{
|
||||
public bool CanDelete
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
if (ContextMenuStrip == null)
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Delete", null, Delete, Keys.Control | Keys.Delete));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TreeNodeFile()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TreeNodeFile(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
|
||||
private void Delete(object sender, EventArgs args)
|
||||
{
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (editor != null)
|
||||
{
|
||||
editor.RemoveFile(this);
|
||||
editor.ResetControls();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnAfterAdded() //After added to treeview
|
||||
{
|
||||
|
||||
|
@ -247,6 +247,22 @@ namespace Switch_Toolbox.Library.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveFile(TreeNode File)
|
||||
{
|
||||
if (File is IFileFormat) {
|
||||
((IFileFormat)File).Unload();
|
||||
}
|
||||
|
||||
treeViewCustom1.Nodes.Remove(File);
|
||||
}
|
||||
|
||||
public void ResetControls()
|
||||
{
|
||||
treeViewCustom1.Nodes.Clear();
|
||||
stPanel2.Controls.Clear();
|
||||
Text = "";
|
||||
}
|
||||
|
||||
bool UpdateViewport = false;
|
||||
bool IsModelChecked = false;
|
||||
private void treeViewCustom1_AfterCheck(object sender, TreeViewEventArgs e)
|
||||
|
@ -718,6 +718,17 @@ namespace Switch_Toolbox.Library
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
DisposeRenderable();
|
||||
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (editor != null)
|
||||
{
|
||||
editor.RemoveFile(this);
|
||||
editor.ResetControls();
|
||||
}
|
||||
}
|
||||
|
||||
public Properties GenericProperties
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user