mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Quick fix for mtxt right click saving
This commit is contained in:
parent
08aae51016
commit
84dcc87506
1 changed files with 23 additions and 4 deletions
|
@ -2,13 +2,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library;
|
||||
using Toolbox.Library.IO;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class MTXT : TreeNodeFile, IFileFormat, ITextureContainer
|
||||
public class MTXT : TreeNodeFile, IFileFormat, ITextureContainer, IContextMenuNode
|
||||
{
|
||||
public FileType FileType { get; set; } = FileType.Image;
|
||||
|
||||
|
@ -40,6 +40,26 @@ namespace FirstPlugin
|
|||
this.TreeView.SelectedNode = Nodes[0];
|
||||
}
|
||||
|
||||
public ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
return new ToolStripItem[]
|
||||
{
|
||||
new ToolStripMenuItem("Save", null, Save, Keys.Control | Keys.S),
|
||||
};
|
||||
}
|
||||
|
||||
private void Save(object sender, EventArgs args)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.DefaultExt = "bctex";
|
||||
sfd.Filter = "Supported Formats|*.bctex;";
|
||||
sfd.FileName = FileName;
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK) {
|
||||
STFileSaver.SaveFileFormat(this, sfd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
public List<STGenericTexture> TextureList { get; set; }
|
||||
|
||||
public bool DisplayIcons => false;
|
||||
|
@ -53,6 +73,7 @@ namespace FirstPlugin
|
|||
public void Load(System.IO.Stream stream)
|
||||
{
|
||||
Text = this.FileName;
|
||||
Tag = this;
|
||||
|
||||
using (var reader = new FileReader(stream))
|
||||
{
|
||||
|
@ -65,7 +86,6 @@ namespace FirstPlugin
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void ReadTextureBinary(byte[] data)
|
||||
{
|
||||
using (var reader = new FileReader(data))
|
||||
|
@ -91,7 +111,6 @@ namespace FirstPlugin
|
|||
TextureFile = new XTX();
|
||||
TextureFile.FileName = textureName;
|
||||
TextureFile.Load(stream);
|
||||
this.Tag = TextureFile;
|
||||
foreach (STGenericTexture node in TextureFile.Nodes)
|
||||
Nodes.Add(node);
|
||||
|
||||
|
|
Loading…
Reference in a new issue