Add GTX editing/saving back.

This commit is contained in:
KillzXGaming 2019-05-01 15:38:14 -04:00
parent 54cc1d4d92
commit fd4e3f4853
40 changed files with 1932 additions and 171 deletions

Binary file not shown.

View file

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FirstPlugin
{
public class RARC
{
}
}

View file

@ -49,6 +49,12 @@ namespace FirstPlugin
public bool CanReplaceFiles { get; set; } = true;
public bool CanDeleteFiles { get; set; } = true;
public List<FileInfo> files = new List<FileInfo>();
public Dictionary<long, byte[]> SavedDataEntries = new Dictionary<long, byte[]>();
public Dictionary<long, string> SavedStringEntries = new Dictionary<long, string>();
public uint Alignment;
public void Load(System.IO.Stream stream)
{
Text = FileName;
@ -61,7 +67,7 @@ namespace FirstPlugin
reader.ReadSignature(4, "TMPK");
uint FileCount = reader.ReadUInt32();
uint Alignment = reader.ReadUInt32();
Alignment = reader.ReadUInt32();
uint padding = reader.ReadUInt32();
for (int i = 0; i < FileCount; i++)
{
@ -72,12 +78,35 @@ namespace FirstPlugin
archive.Name = info.Text;
Nodes.Add(info);
files.Add(info);
}
}
}
private void SaveFile(FileWriter writer)
{
writer.WriteSignature("TMPK");
writer.Write(files.Count);
writer.Write(Alignment);
writer.Write(0);
for (int i = 0; i < files.Count; i++)
{
files[i]._posHeader = writer.Position;
writer.Write(uint.MaxValue);
writer.Write(uint.MaxValue);
writer.Write(files[i].Data.Length); //Padding
writer.Write(0); //Padding
}
for (int i = 0; i < files.Count; i++)
{
}
}
public class FileInfo : TreeNodeCustom
{
internal long _posHeader;
public byte[] Data;
public FileInfo()
@ -101,6 +130,28 @@ namespace FirstPlugin
}
}
public override void OnDoubleMouseClick(TreeView treeView)
{
if (Data.Length <= 0)
return;
IFileFormat file = STFileLoader.OpenFileFormat(Text, Data, false, true, this);
if (file == null) //File returns null if no supported format is found
return;
ReplaceNode(this.Parent, this, (TreeNode)file);
}
public static void ReplaceNode(TreeNode node, TreeNode replaceNode, TreeNode NewNode)
{
if (NewNode == null)
return;
int index = node.Nodes.IndexOf(replaceNode);
node.Nodes.RemoveAt(index);
node.Nodes.Insert(index, NewNode);
}
public override void OnClick(TreeView treeview)
{
HexEditor editor = (HexEditor)LibraryGUI.Instance.GetActiveContent(typeof(HexEditor));
@ -136,8 +187,11 @@ namespace FirstPlugin
ContextMenu.MenuItems.Add(export);
export.Click += Export;
}
}
public void Write(FileWriter writer)
{
}
}
public void Unload()
{

View file

@ -112,7 +112,7 @@ namespace FirstPlugin
ObjectEditor editor = new ObjectEditor();
editor.Text = "Untitled-" + 0;
editor.treeViewCustom1.Nodes.Add(bfres);
editor.AddNode(bfres);
LibraryGUI.Instance.CreateMdiWindow(editor);
}
private void NewSwitchBfres(object sender, EventArgs args)
@ -125,7 +125,7 @@ namespace FirstPlugin
ObjectEditor editor = new ObjectEditor();
editor.Text = "Untitled-" + 0;
editor.treeViewCustom1.Nodes.Add(bfres);
editor.AddNode(bfres);
LibraryGUI.Instance.CreateMdiWindow(editor);
}
private void DebugInfo(object sender, EventArgs args)
@ -218,7 +218,7 @@ namespace FirstPlugin
if (editor == null)
return;
editor.treeViewCustom1.BeginUpdate();
editor.BeginUpdate();
foreach (var model in BFRESRender.models)
{
@ -276,7 +276,7 @@ namespace FirstPlugin
}
}
editor.treeViewCustom1.EndUpdate();
editor.EndUpdate();
}
private string GetSkeletonAnimCurveOffset(uint offset)
@ -774,6 +774,8 @@ namespace FirstPlugin
var animFolder = new BFRESAnimFolder();
var externalFilesFolder = new BFRESGroupNode(BRESGroupType.Embedded);
texturesFolder.ShowNewContextMenu = false;
Nodes.Add(modelFolder);
Nodes.Add(texturesFolder);
Nodes.Add(animFolder);

View file

@ -31,6 +31,12 @@ namespace Bfres.Structs
public class BFRESGroupNode : STGenericWrapper
{
public bool ShowNewContextMenu
{
set { ContextMenuStrip.Items[0].Visible = value; }
get { return ContextMenuStrip.Items[0].Visible; }
}
public bool IsWiiU
{
get
@ -72,6 +78,7 @@ namespace Bfres.Structs
CanDelete = false;
//Folder Operations
ContextMenuStrip.Items.Add(new STToolStipMenuItem("New", null, NewAction, Keys.Control | Keys.N));
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Import", null, ImportAction, Keys.Control | Keys.I));
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction, Keys.Control | Keys.E));
@ -529,7 +536,7 @@ namespace Bfres.Structs
if (setting.DataBlockOutput != null)
{
var surface = GTXSwizzle.CreateGx2Texture(setting.DataBlockOutput[0], setting);
var tex = ftex.FromGx2Surface(surface, setting.TexName);
var tex = FTEX.FromGx2Surface(surface, setting.TexName);
ftex.UpdateTex(tex);
ftex.IsEdited = true;
@ -585,7 +592,7 @@ namespace Bfres.Structs
FTEX ftex = new FTEX();
ftex.texture = new ResU.Texture();
var surface = GTXSwizzle.CreateGx2Texture(setting.DataBlockOutput[0], setting);
var tex = ftex.FromGx2Surface(surface, setting.TexName);
var tex = FTEX.FromGx2Surface(surface, setting.TexName);
ftex.UpdateTex(tex);
ftex.IsEdited = true;
@ -661,7 +668,7 @@ namespace Bfres.Structs
var surface = GTXSwizzle.CreateGx2Texture(setting.DataBlockOutput[0], setting);
FTEX ftex = new FTEX();
ftex.texture = new ResU.Texture();
ftex.texture = ftex.FromGx2Surface(surface, setting.TexName);
ftex.texture = FTEX.FromGx2Surface(surface, setting.TexName);
ftex.IsEdited = true;
ftex.Read(ftex.texture);

View file

@ -115,6 +115,10 @@ namespace Bfres.Structs
lodMenu.DropDownItems.Add(new ToolStripMenuItem("Clear LOD Meshes", null, ClearLODMeshes));
ContextMenuStrip.Items.Add(lodMenu);
ToolStripMenuItem boundingsMenu = new ToolStripMenuItem("Boundings");
boundingsMenu.DropDownItems.Add(new ToolStripMenuItem("Regenerate Bounding Boxes/Radius", null, GenerateBoundingBoxes));
ContextMenuStrip.Items.Add(boundingsMenu);
ToolStripMenuItem uvMenu = new ToolStripMenuItem("UVs");
uvMenu.DropDownItems.Add(new ToolStripMenuItem("Flip (Vertical)", null, FlipUvsVertical));
uvMenu.DropDownItems.Add(new ToolStripMenuItem("Flip (Horizontal)", null, FlipUvsHorizontal));
@ -186,10 +190,35 @@ namespace Bfres.Structs
UpdateVertexData();
Cursor.Current = Cursors.Default;
}
private void GenerateBoundingBoxes(object sender, EventArgs args)
{
Cursor.Current = Cursors.WaitCursor;
CreateNewBoundingBoxes();
SaveShape(GetResFileU() != null);
UpdateVertexData();
Cursor.Current = Cursors.Default;
}
private void GenerateLODMeshes(object sender, EventArgs args)
{
Cursor.Current = Cursors.WaitCursor;
//Todo add lod generating
CreateNewBoundingBoxes();
SaveShape(GetResFileU() != null);
UpdateVertexData();
Cursor.Current = Cursors.Default;
}
private void ClearLODMeshes(object sender, EventArgs args)
{
Cursor.Current = Cursors.WaitCursor;
DisplayLODIndex = 0; //Force index to prevent errors
//Clear all but first base mesh
for (int i = 0; i < lodMeshes.Count; i++)
{

View file

@ -305,7 +305,7 @@ namespace Bfres.Structs
}
//We reuse GX2 data as it's the same thing
public Texture FromGx2Surface(GX2.GX2Surface surf, string Name)
public static Texture FromGx2Surface(GX2.GX2Surface surf, string Name)
{
Texture tex = new Texture();
tex.Name = Name;

View file

@ -131,7 +131,7 @@ namespace FirstPlugin
ObjectEditor editor = new ObjectEditor();
editor.Text = name;
editor.treeViewCustom1.Nodes.Add(kcl);
editor.AddNode(kcl);
LibraryGUI.Instance.CreateMdiWindow(editor);
}
}

View file

@ -127,7 +127,7 @@ namespace FirstPlugin
ObjectEditor editor = new ObjectEditor();
editor.Text = text;
LibraryGUI.Instance.CreateMdiWindow(editor, true);
editor.treeViewCustom1.Nodes.Add((TreeNode)fileFormat);
editor.AddNode((TreeNode)fileFormat);
}
}

View file

@ -83,7 +83,7 @@ namespace FirstPlugin
ObjectEditor editor = new ObjectEditor();
editor.Text = "Untitled-" + 0;
editor.treeViewCustom1.Nodes.Add(bntx);
editor.AddNode(bntx);
LibraryGUI.Instance.CreateMdiWindow(editor);
}
private void Export(object sender, EventArgs args)

View file

@ -9,6 +9,7 @@ using System.Windows.Forms;
using OpenTK.Graphics.OpenGL;
using Switch_Toolbox.Library.Forms;
using Bfres.Structs;
using System.IO;
namespace FirstPlugin
{
@ -119,16 +120,26 @@ namespace FirstPlugin
else
throw new Exception($"Unsupported GTX version {header.MajorVersion}");
writer.Seek(header.HeaderSize, System.IO.SeekOrigin.Begin);
foreach (var tex in textures)
{
tex.surface.Write(writer);
}
int imageInfoIndex = 0;
int imageBlockIndex = 0;
int imageMipBlockIndex = 0;
writer.Seek(header.HeaderSize, System.IO.SeekOrigin.Begin);
foreach (var block in blocks)
{
if ((uint)block.BlockType == surfBlockType)
{
block.data = textures[imageInfoIndex++].surface.Write();
block.Write(writer);
}
else if ((uint)block.BlockType == dataBlockType)
{
block.data = textures[imageBlockIndex++].surface.data;
block.Write(writer);
}
else if ((uint)block.BlockType == mipBlockType)
{
block.data = textures[imageMipBlockIndex++].surface.mipData;
block.Write(writer);
}
else
@ -318,7 +329,7 @@ namespace FirstPlugin
writer.Write(MajorVersion);
writer.Write(MinorVersion);
writer.Write(BlockType, false);
writer.Write(DataSize);
writer.Write(data.Length);
writer.Write(Identifier);
writer.Write(index);
writer.Seek(blockStart + HeaderSize, System.IO.SeekOrigin.Begin);
@ -361,7 +372,7 @@ namespace FirstPlugin
}
}
public override bool CanEdit { get; set; } = false;
public override bool CanEdit { get; set; } = true;
public SurfaceInfoParse surface;
@ -370,21 +381,96 @@ namespace FirstPlugin
ImageKey = "Texture";
SelectedImageKey = "Texture";
ContextMenu = new ContextMenu();
MenuItem export = new MenuItem("Export");
ContextMenu.MenuItems.Add(export);
export.Click += Export;
MenuItem replace = new MenuItem("Replace");
ContextMenu.MenuItems.Add(replace);
replace.Click += Replace;
MenuItem remove = new MenuItem("Remove");
ContextMenu.MenuItems.Add(remove);
remove.Click += Remove;
LoadContextMenus();
CanDelete = false;
CanRename = false;
}
public override string ExportFilter => FileFilters.GTX;
public override string ReplaceFilter => FileFilters.GTX;
private void ApplySurface(GX2.GX2Surface NewSurface)
{
surface.aa = NewSurface.aa;
surface.alignment = NewSurface.alignment;
surface.bpp = NewSurface.bpp;
surface.compSel = NewSurface.compSel;
surface.data = NewSurface.data;
surface.depth = NewSurface.depth;
surface.dim = NewSurface.dim;
surface.firstMip = NewSurface.firstMip;
surface.firstSlice = NewSurface.firstSlice;
surface.format = NewSurface.format;
surface.height = NewSurface.height;
surface.imageCount = NewSurface.imageCount;
surface.imageSize = NewSurface.imageSize;
surface.mipData = NewSurface.mipData;
surface.mipOffset = NewSurface.mipOffset;
surface.numArray = NewSurface.numArray;
surface.numMips = NewSurface.numMips;
surface.pitch = NewSurface.pitch;
surface.resourceFlags = NewSurface.resourceFlags;
surface.swizzle = NewSurface.swizzle;
surface.texRegs = NewSurface.texRegs;
surface.tileMode = NewSurface.tileMode;
surface.use = NewSurface.use;
surface.width = NewSurface.width;
SetChannelComponents();
}
private void SetChannelComponents()
{
surface.compSel = new byte[4] { 0, 1, 2, 3 };
}
public override void SetImageData(Bitmap bitmap, int ArrayLevel)
{
throw new NotImplementedException("Cannot set image data! Operation not implemented!");
if (bitmap == null)
return; //Image is likely disposed and not needed to be applied
surface.format = (uint)FTEX.ConvertToGx2Format(Format);
surface.width = (uint)bitmap.Width;
surface.height = (uint)bitmap.Height;
if (MipCount != 1)
{
MipCount = GenerateMipCount(bitmap.Width, bitmap.Height);
if (MipCount == 0)
MipCount = 1;
}
surface.numMips = MipCount;
surface.mipOffset = new uint[MipCount];
try
{
//Create image block from bitmap first
var data = GenerateMipsAndCompress(bitmap, Format);
//Swizzle and create surface
var NewSurface = GX2.CreateGx2Texture(data, Text,
(uint)surface.tileMode,
(uint)surface.aa,
(uint)surface.width,
(uint)surface.height,
(uint)surface.depth,
(uint)surface.format,
(uint)surface.swizzle,
(uint)surface.dim,
(uint)surface.numMips
);
ApplySurface(NewSurface);
IsEdited = true;
LoadOpenGLTexture();
LibraryGUI.Instance.UpdateViewport();
}
catch (Exception ex)
{
STErrorDialog.Show("Failed to swizzle and compress image " + Text, "Error", ex.ToString());
}
}
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
@ -415,65 +501,49 @@ namespace FirstPlugin
return surfaces[ArrayLevel][MipLevel];
}
private void Remove(object sender, EventArgs args)
{
private void Remove(object sender, EventArgs args) {
((GTXFile)Parent).Nodes.Remove(this);
}
private void Export(object sender, EventArgs args)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = Text;
sfd.DefaultExt = "bftex";
sfd.Filter = "Supported Formats|*.bftex;*.dds; *.png;*.tga;*.jpg;*.tiff|" +
"Binary Texture |*.bftex|" +
"Microsoft DDS |*.dds|" +
"Portable Network Graphics |*.png|" +
"Joint Photographic Experts Group |*.jpg|" +
"Bitmap Image |*.bmp|" +
"Tagged Image File Format |*.tiff|" +
"All files(*.*)|*.*";
if (sfd.ShowDialog() == DialogResult.OK)
{
Export(sfd.FileName);
}
public override void Export(string FileName) {
Export(FileName);
}
public void Export(string FileName, bool ExportSurfaceLevel = false,
bool ExportMipMapLevel = false, int SurfaceLevel = 0, int MipLevel = 0)
{
string ext = System.IO.Path.GetExtension(FileName);
ext = ext.ToLower();
switch (ext)
public override void Replace(string FileName)
{
FTEX ftex = new FTEX();
ftex.ReplaceTexture(FileName, 1, SupportedFormats, true, true);
if (ftex.texture != null)
{
case ".dds":
SaveDDS(FileName);
break;
default:
SaveBitMap(FileName);
break;
}
}
private void Replace(object sender, EventArgs args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" +
"Microsoft DDS |*.dds|" +
"Portable Network Graphics |*.png|" +
"Joint Photographic Experts Group |*.jpg|" +
"Bitmap Image |*.bmp|" +
"Tagged Image File Format |*.tiff|" +
"All files(*.*)|*.*";
surface.swizzle = ftex.texture.Swizzle;
surface.format = (uint)ftex.texture.Format;
surface.aa = (uint)ftex.texture.AAMode;
surface.alignment = (uint)ftex.texture.Alignment;
surface.dim = (uint)ftex.texture.Dim;
surface.width = (uint)ftex.texture.Width;
surface.height = (uint)ftex.texture.Height;
surface.depth = (uint)ftex.texture.Depth;
surface.numMips = (uint)ftex.texture.MipCount;
surface.imageSize = (uint)ftex.texture.Data.Length;
surface.mipSize = (uint)ftex.texture.MipData.Length;
surface.data = ftex.texture.Data;
surface.mipData = ftex.texture.MipData;
surface.mipOffset = ftex.texture.MipOffsets;
surface.firstSlice = ftex.texture.ViewSliceFirst;
surface.numSlices = ftex.texture.ViewSliceCount;
surface.imageCount = ftex.texture.ArrayLength;
surface.pitch = ftex.texture.Pitch;
SetChannelComponents();
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
Replace(ofd.FileName);
}
}
public void Replace(string FileName)
{
Format = FTEX.ConvertFromGx2Format((Syroot.NintenTools.Bfres.GX2.GX2SurfaceFormat)surface.format);
Width = surface.width;
Height = surface.height;
ImageEditorBase editor = (ImageEditorBase)LibraryGUI.Instance.GetActiveContent(typeof(ImageEditorBase));
if (editor != null)
UpdateEditor();
}
}
public override void OnClick(TreeView treeView)
{
@ -491,11 +561,8 @@ namespace FirstPlugin
LibraryGUI.Instance.LoadEditor(editor);
}
editor.Text = Text;
UserDataEditor userDataEditor = new UserDataEditor();
userDataEditor.Name = "User Data";
editor.LoadProperties(FTEX.FromGx2Surface(surface, Text));
editor.LoadImage(this);
editor.AddCustomControl(userDataEditor, typeof(UserDataEditor));
}
}
public class SurfaceInfoParse : GX2.GX2Surface
@ -528,8 +595,12 @@ namespace FirstPlugin
compSel = reader.ReadBytes(4);
texRegs = reader.ReadUInt32s(5);
}
public void Write(FileWriter writer)
public byte[] Write()
{
MemoryStream mem = new MemoryStream();
FileWriter writer = new FileWriter(mem);
writer.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian;
writer.Write(dim);
writer.Write(width);
writer.Write(height);
@ -546,13 +617,37 @@ namespace FirstPlugin
writer.Write(swizzle);
writer.Write(alignment);
writer.Write(pitch);
writer.Write(mipOffset);
for (int i = 0; i < 13; i++)
{
if (mipOffset.Length > i)
writer.Write(mipOffset[i]);
else
writer.Write(0);
}
writer.Write(firstMip);
writer.Write(imageCount);
writer.Write(firstSlice);
writer.Write(numSlices);
writer.Write(compSel);
writer.Write(texRegs);
for (int i = 0; i < 4; i++)
{
if (compSel != null && compSel.Length > i)
writer.Write(compSel[i]);
else
writer.Write((byte)0);
}
for (int i = 0; i < 5; i++)
{
if (texRegs != null && texRegs.Length > i)
writer.Write(texRegs[i]);
else
writer.Write(0);
}
return mem.ToArray();
}
}
}

View file

@ -187,6 +187,7 @@
<Compile Include="Config.cs" />
<Compile Include="FileFormats\AAMP\AAMP.cs" />
<Compile Include="FileFormats\Archives\APAK.cs" />
<Compile Include="FileFormats\Archives\RARC.cs" />
<Compile Include="FileFormats\Archives\TMPK.cs" />
<Compile Include="FileFormats\Audio\Archives\BARS.cs" />
<Compile Include="FileFormats\Audio\BARSLIST.cs" />

View file

@ -1 +1 @@
f53bc1a7dc49be17dafeb980d0fb64be3ad3bda8
00baaa26ab24ed622a4872ef7187472151f2eea3

File diff suppressed because it is too large Load diff

View file

@ -4,11 +4,21 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Collada141;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Globalization;
using System.Xml;
using ColladaHelper;
namespace Switch_Toolbox.Library
{
public class DAE
public class DAE : DAEHelper
{
public List<STGenericObject> objects = new List<STGenericObject>();
public List<STGenericMaterial> materials = new List<STGenericMaterial>();
public STSkeleton skeleton;
public List<string> BoneNames = new List<string>();
public bool UseTransformMatrix = true;
public void LoadFile(string FileName)
@ -19,14 +29,36 @@ namespace Switch_Toolbox.Library
{
if (item is library_geometries)
{
LoadGeometry((library_geometries)item);
}
}
}
private void LoadGeometry()
private void SetControllers(COLLADA collada)
{
}
private void LoadGeometry(library_geometries Geometries)
{
foreach (var geom in Geometries.geometry)
{
var mesh = geom.Item as mesh;
if (mesh == null)
continue;
foreach (var source in mesh.source)
{
var float_array = source.Item as float_array;
if (float_array == null)
continue;
Console.Write("Geometry {0} source {1} : ", geom.id, source.id);
foreach (var mesh_source_value in float_array.Values)
Console.Write("{0} ", mesh_source_value);
Console.WriteLine();
}
}
}
}
}

View file

@ -13,6 +13,7 @@ namespace Switch_Toolbox.Library.Forms
InitializeComponent();
StartPosition = FormStartPosition.CenterParent;
button2.Select();
}
public void SetString(string Default)
{

View file

@ -235,7 +235,7 @@
public STPanel stPanel2;
private STPanel stPanel1;
private STPanel stPanel3;
public TreeViewCustom treeViewCustom1;
private TreeViewCustom treeViewCustom1;
private STMenuStrip stContextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private STTextBox stTextBox1;

View file

@ -17,6 +17,53 @@ namespace Switch_Toolbox.Library.Forms
{
public partial class ObjectEditor : STForm
{
private TreeView _fieldsTreeCache;
public void BeginUpdate() { treeViewCustom1.BeginUpdate(); }
public void EndUpdate() { treeViewCustom1.EndUpdate(); }
public void AddNodeCollection (TreeNodeCollection nodes, bool ClearNodes)
{
// Invoke the treeview to add the nodes
treeViewCustom1.Invoke((Action)delegate ()
{
treeViewCustom1.BeginUpdate(); // No visual updates until we say
if (ClearNodes)
treeViewCustom1.Nodes.Clear(); // Remove existing nodes
foreach (TreeNode node in nodes)
treeViewCustom1.Nodes.Add(node); // Add the new nodes
treeViewCustom1.EndUpdate(); // Allow the treeview to update visually
});
}
public TreeNodeCollection GetNodes() { return treeViewCustom1.Nodes; }
public void AddNode(TreeNode node, bool ClearAllNodes = false)
{
// Invoke the treeview to add the nodes
treeViewCustom1.Invoke((Action)delegate ()
{
treeViewCustom1.BeginUpdate(); // No visual updates until we say
// if (ClearAllNodes)
// ClearNodes();
treeViewCustom1.EndUpdate(); // Allow the treeview to update visually
});
treeViewCustom1.Nodes.Add(node); // Add the new nodes
// _fieldsTreeCache.Nodes.Add(node);
}
public void ClearNodes()
{
treeViewCustom1.Nodes.Clear();
// _fieldsTreeCache.Nodes.Clear();
}
public bool AddFilesToActiveEditor
{
get
@ -40,6 +87,8 @@ namespace Switch_Toolbox.Library.Forms
{
InitializeComponent();
_fieldsTreeCache = new TreeView();
if (Runtime.ObjectEditor.ListPanelWidth > 0)
stPanel1.Width = Runtime.ObjectEditor.ListPanelWidth;
@ -180,7 +229,7 @@ namespace Switch_Toolbox.Library.Forms
((IFileFormat)node).Unload();
}
}
treeViewCustom1.Nodes.Clear();
ClearNodes();
}
private void selectItem(object sender, TreeNodeMouseClickEventArgs e)
@ -347,6 +396,35 @@ namespace Switch_Toolbox.Library.Forms
}
}
private void SearchText(string searchText)
{
//blocks repainting tree till all objects loaded
this.treeViewCustom1.BeginUpdate();
this.treeViewCustom1.Nodes.Clear();
if (searchText != string.Empty)
{
foreach (TreeNode _parentNode in _fieldsTreeCache.Nodes)
{
foreach (TreeNode _childNode in _parentNode.Nodes)
{
if (_childNode.Text.StartsWith(searchText))
{
this.treeViewCustom1.Nodes.Add((TreeNode)_childNode.Clone());
}
}
}
}
else
{
foreach (TreeNode _node in this._fieldsTreeCache.Nodes)
{
treeViewCustom1.Nodes.Add((TreeNode)_node.Clone());
}
}
//enables redrawing tree after all objects have been added
this.treeViewCustom1.EndUpdate();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
@ -370,7 +448,7 @@ namespace Switch_Toolbox.Library.Forms
if (file is TreeNode)
{
var node = (TreeNode)file;
treeViewCustom1.Nodes.Add(node);
AddNode(node);
}
else
{

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Switch_Toolbox.Library
{
public class GenericArchive
{
public List<ArchiveFileInfo> Files = new List<ArchiveFileInfo>();
}
public class ArchiveFileInfo
{
IFileFormat FileFormat = null; //Format attached for saving
protected Stream _fileData = null;
public string FileName { get; set; } = string.Empty; //Full File Name
public string Name { get; set; } = string.Empty; //File Name (No Path)
public virtual Stream FileData
{
get
{
_fileData.Position = 0;
return _fileData;
}
set { _fileData = value; }
}
}
}

View file

@ -335,24 +335,15 @@ namespace Switch_Toolbox.Library.IO
public static byte[] Compress(byte[] b, uint Position = 0)
{
//Set position and write the first 2 bytes if necessary
MemoryStream mem = new MemoryStream();
using (var decompressedStream = new FileWriter(new MemoryStream()))
{
if (Position == 2)
{
decompressedStream.Write(0x780A);
decompressedStream.Write(b);
}
}
var output = new MemoryStream();
using (var decompressedStream = new MemoryStream(mem.ToArray()))
output.Write(new byte[] { 0x78, 0xDA }, 0, 2);
using (var decompressedStream = new MemoryStream(output.ToArray()))
{
decompressedStream.Position = Position;
using (var zipStream = new DeflateStream(output, CompressionMode.Compress))
{
decompressedStream.CopyTo(zipStream);
zipStream.Write(b, 2, b.Length);
return output.ToArray();
}
}

View file

@ -80,23 +80,4 @@ namespace Switch_Toolbox.Library
return false;
}
}
public abstract class ArchiveFileInfo : TreeNodeCustom
{
IFileFormat FileFormat = null; //Format attached for saving
protected Stream _fileData = null;
public string FileName { get; set; } = string.Empty; //Full File Name
public string Name { get; set; } = string.Empty; //File Name (No Path)
public virtual Stream FileData
{
get
{
_fileData.Position = 0;
return _fileData;
}
set { _fileData = value; }
}
}
}

View file

@ -205,6 +205,7 @@
<Compile Include="FileFormats\APNG\CRC.cs" />
<Compile Include="FileFormats\Assimp\AssimpSaver.cs" />
<Compile Include="FileFormats\Animation\SEANIM.cs" />
<Compile Include="FileFormats\DAE\ColladaHelper.cs" />
<Compile Include="FileFormats\DAE\collada_schema_1_4.cs" />
<Compile Include="FileFormats\DAE\DAE.cs" />
<Compile Include="FileFormats\OBJ.cs" />
@ -464,6 +465,7 @@
<Compile Include="Forms\Wpf\WpfTimeline.xaml.cs">
<DependentUpon>WpfTimeline.xaml</DependentUpon>
</Compile>
<Compile Include="Generics\GenericArchive.cs" />
<Compile Include="Generics\GenericMaterial.cs" />
<Compile Include="Generics\GenericMatTexture.cs" />
<Compile Include="Generics\GenericModel.cs" />

Binary file not shown.

Binary file not shown.

168
Toolbox/GUI/GithubIssueDialog.Designer.cs generated Normal file
View file

@ -0,0 +1,168 @@
namespace Toolbox
{
partial class GithubIssueDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.titleTB = new Switch_Toolbox.Library.Forms.STTextBox();
this.stLabel1 = new Switch_Toolbox.Library.Forms.STLabel();
this.infoTB = new Switch_Toolbox.Library.Forms.STTextBox();
this.typeCB = new Switch_Toolbox.Library.Forms.STComboBox();
this.stLabel2 = new Switch_Toolbox.Library.Forms.STLabel();
this.stLabel3 = new Switch_Toolbox.Library.Forms.STLabel();
this.stButton1 = new Switch_Toolbox.Library.Forms.STButton();
this.stButton2 = new Switch_Toolbox.Library.Forms.STButton();
this.contentContainer.SuspendLayout();
this.stPanel1.SuspendLayout();
this.SuspendLayout();
//
// contentContainer
//
this.contentContainer.Controls.Add(this.stPanel1);
this.contentContainer.Controls.SetChildIndex(this.stPanel1, 0);
//
// stPanel1
//
this.stPanel1.Controls.Add(this.stButton2);
this.stPanel1.Controls.Add(this.stButton1);
this.stPanel1.Controls.Add(this.stLabel3);
this.stPanel1.Controls.Add(this.stLabel2);
this.stPanel1.Controls.Add(this.typeCB);
this.stPanel1.Controls.Add(this.infoTB);
this.stPanel1.Controls.Add(this.stLabel1);
this.stPanel1.Controls.Add(this.titleTB);
this.stPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.stPanel1.Location = new System.Drawing.Point(0, 25);
this.stPanel1.Name = "stPanel1";
this.stPanel1.Size = new System.Drawing.Size(543, 368);
this.stPanel1.TabIndex = 11;
//
// titleTB
//
this.titleTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.titleTB.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.titleTB.Location = new System.Drawing.Point(12, 71);
this.titleTB.Name = "titleTB";
this.titleTB.Size = new System.Drawing.Size(512, 29);
this.titleTB.TabIndex = 0;
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(9, 55);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(30, 13);
this.stLabel1.TabIndex = 1;
this.stLabel1.Text = "Title:";
//
// infoTB
//
this.infoTB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.infoTB.Location = new System.Drawing.Point(11, 128);
this.infoTB.Multiline = true;
this.infoTB.Name = "infoTB";
this.infoTB.Size = new System.Drawing.Size(512, 205);
this.infoTB.TabIndex = 2;
//
// typeCB
//
this.typeCB.BorderColor = System.Drawing.Color.Empty;
this.typeCB.BorderStyle = System.Windows.Forms.ButtonBorderStyle.Solid;
this.typeCB.ButtonColor = System.Drawing.Color.Empty;
this.typeCB.FormattingEnabled = true;
this.typeCB.Location = new System.Drawing.Point(11, 19);
this.typeCB.Name = "typeCB";
this.typeCB.ReadOnly = true;
this.typeCB.Size = new System.Drawing.Size(159, 21);
this.typeCB.TabIndex = 3;
//
// stLabel2
//
this.stLabel2.AutoSize = true;
this.stLabel2.Location = new System.Drawing.Point(8, 3);
this.stLabel2.Name = "stLabel2";
this.stLabel2.Size = new System.Drawing.Size(34, 13);
this.stLabel2.TabIndex = 4;
this.stLabel2.Text = "Type:";
//
// stLabel3
//
this.stLabel3.AutoSize = true;
this.stLabel3.Location = new System.Drawing.Point(12, 112);
this.stLabel3.Name = "stLabel3";
this.stLabel3.Size = new System.Drawing.Size(62, 13);
this.stLabel3.TabIndex = 5;
this.stLabel3.Text = "Information:";
//
// stButton1
//
this.stButton1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton1.Location = new System.Drawing.Point(449, 339);
this.stButton1.Name = "stButton1";
this.stButton1.Size = new System.Drawing.Size(75, 23);
this.stButton1.TabIndex = 6;
this.stButton1.Text = "Cancel";
this.stButton1.UseVisualStyleBackColor = false;
//
// stButton2
//
this.stButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.stButton2.Location = new System.Drawing.Point(368, 339);
this.stButton2.Name = "stButton2";
this.stButton2.Size = new System.Drawing.Size(75, 23);
this.stButton2.TabIndex = 7;
this.stButton2.Text = "Ok";
this.stButton2.UseVisualStyleBackColor = false;
//
// GithubIssueDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(549, 398);
this.Name = "GithubIssueDialog";
this.Text = "GithubIssueDialog";
this.contentContainer.ResumeLayout(false);
this.stPanel1.ResumeLayout(false);
this.stPanel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private Switch_Toolbox.Library.Forms.STPanel stPanel1;
private Switch_Toolbox.Library.Forms.STTextBox titleTB;
private Switch_Toolbox.Library.Forms.STButton stButton2;
private Switch_Toolbox.Library.Forms.STButton stButton1;
private Switch_Toolbox.Library.Forms.STLabel stLabel3;
private Switch_Toolbox.Library.Forms.STLabel stLabel2;
private Switch_Toolbox.Library.Forms.STComboBox typeCB;
private Switch_Toolbox.Library.Forms.STTextBox infoTB;
private Switch_Toolbox.Library.Forms.STLabel stLabel1;
}
}

View file

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Switch_Toolbox.Library.Forms;
using Octokit;
namespace Toolbox
{
public partial class GithubIssueDialog : STForm
{
public GithubIssueDialog()
{
InitializeComponent();
typeCB.Items.Add("Bug");
typeCB.Items.Add("Feature");
typeCB.SelectedIndex = 0;
}
public void CreateIssue()
{
if (titleTB.Text == String.Empty) {
MessageBox.Show("Title must not be empty!", "Issue Dialog", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (titleTB.Text.Length > 5)
{
MessageBox.Show("Title too short! Atleast have 5 or more characters!", "Issue Dialog", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
var client = new GitHubClient(new ProductHeaderValue("Switch_Toolbox"));
var createIssue = new NewIssue(titleTB.Text);
createIssue.Body = infoTB.Text;
if (typeCB.GetSelectedText() == "Bug")
createIssue.Labels.Add("bug");
else
createIssue.Labels.Add("enhancement");
CreateIssue(client, createIssue).Wait();
}
static async Task CreateIssue(GitHubClient client, NewIssue createIssue)
{
var issue = await client.Issue.Create("fake", "test", createIssue);
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

View file

@ -52,8 +52,7 @@
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mainSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileAssociationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.creditsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.consoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.tabForms = new Switch_Toolbox.Library.Forms.STTabControl();
this.tabControlContextMenuStrip = new Switch_Toolbox.Library.Forms.STContextMenuStrip(this.components);
@ -65,7 +64,11 @@
this.stToolStrip1 = new Switch_Toolbox.Library.Forms.STToolStrip();
this.saveToolStripButton = new System.Windows.Forms.ToolStripButton();
this.updateToolstrip = new System.Windows.Forms.ToolStripButton();
this.consoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.requestFeatureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportBugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.requestFeatureToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.githubToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.stPanel1.SuspendLayout();
this.tabControlContextMenuStrip.SuspendLayout();
@ -87,8 +90,8 @@
this.experimentalToolStripMenuItem,
this.windowsToolStripMenuItem,
this.settingsToolStripMenuItem,
this.aboutToolStripMenuItem,
this.consoleToolStripMenuItem});
this.consoleToolStripMenuItem,
this.requestFeatureToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1108, 25);
@ -244,7 +247,7 @@
// mainSettingsToolStripMenuItem
//
this.mainSettingsToolStripMenuItem.Name = "mainSettingsToolStripMenuItem";
this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mainSettingsToolStripMenuItem.Text = "Main Settings";
this.mainSettingsToolStripMenuItem.Click += new System.EventHandler(this.mainSettingsToolStripMenuItem_Click);
//
@ -252,24 +255,16 @@
//
this.fileAssociationsToolStripMenuItem.Enabled = false;
this.fileAssociationsToolStripMenuItem.Name = "fileAssociationsToolStripMenuItem";
this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.fileAssociationsToolStripMenuItem.Text = "File Associations";
this.fileAssociationsToolStripMenuItem.Click += new System.EventHandler(this.fileAssociationsToolStripMenuItem_Click);
//
// aboutToolStripMenuItem
// consoleToolStripMenuItem
//
this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.creditsToolStripMenuItem});
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(52, 21);
this.aboutToolStripMenuItem.Text = "About";
//
// creditsToolStripMenuItem
//
this.creditsToolStripMenuItem.Name = "creditsToolStripMenuItem";
this.creditsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.creditsToolStripMenuItem.Text = "Credits";
this.creditsToolStripMenuItem.Click += new System.EventHandler(this.creditsToolStripMenuItem_Click);
this.consoleToolStripMenuItem.Name = "consoleToolStripMenuItem";
this.consoleToolStripMenuItem.Size = new System.Drawing.Size(62, 21);
this.consoleToolStripMenuItem.Text = "Console";
this.consoleToolStripMenuItem.Click += new System.EventHandler(this.consoleToolStripMenuItem_Click);
//
// stPanel1
//
@ -400,12 +395,43 @@
this.updateToolstrip.ToolTipText = "Update Tool";
this.updateToolstrip.Click += new System.EventHandler(this.updateToolstrip_Click);
//
// consoleToolStripMenuItem
// requestFeatureToolStripMenuItem
//
this.consoleToolStripMenuItem.Name = "consoleToolStripMenuItem";
this.consoleToolStripMenuItem.Size = new System.Drawing.Size(62, 21);
this.consoleToolStripMenuItem.Text = "Console";
this.consoleToolStripMenuItem.Click += new System.EventHandler(this.consoleToolStripMenuItem_Click);
this.requestFeatureToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.aboutToolStripMenuItem1,
this.reportBugToolStripMenuItem,
this.requestFeatureToolStripMenuItem1,
this.githubToolStripMenuItem});
this.requestFeatureToolStripMenuItem.Name = "requestFeatureToolStripMenuItem";
this.requestFeatureToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.requestFeatureToolStripMenuItem.Text = "Help";
//
// reportBugToolStripMenuItem
//
this.reportBugToolStripMenuItem.Name = "reportBugToolStripMenuItem";
this.reportBugToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.reportBugToolStripMenuItem.Text = "Report Bug";
this.reportBugToolStripMenuItem.Click += new System.EventHandler(this.reportBugToolStripMenuItem_Click);
//
// requestFeatureToolStripMenuItem1
//
this.requestFeatureToolStripMenuItem1.Name = "requestFeatureToolStripMenuItem1";
this.requestFeatureToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.requestFeatureToolStripMenuItem1.Text = "Request Feature";
//
// githubToolStripMenuItem
//
this.githubToolStripMenuItem.Name = "githubToolStripMenuItem";
this.githubToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.githubToolStripMenuItem.Text = "Github";
this.githubToolStripMenuItem.Click += new System.EventHandler(this.githubToolStripMenuItem_Click);
//
// aboutToolStripMenuItem1
//
this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
this.aboutToolStripMenuItem1.Text = "About";
this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click);
//
// MainForm
//
@ -474,13 +500,16 @@
private Switch_Toolbox.Library.Forms.STToolStrip stToolStrip1;
private System.Windows.Forms.ToolStripButton updateToolstrip;
private System.Windows.Forms.ToolStripMenuItem newFromFileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem creditsToolStripMenuItem;
private System.Windows.Forms.PictureBox BtnMdiMinimize;
private System.Windows.Forms.PictureBox BtnMdiMinMax;
private System.Windows.Forms.PictureBox BtnMdiClose;
private System.Windows.Forms.ToolStripButton saveToolStripButton;
private System.Windows.Forms.ToolStripMenuItem consoleToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem requestFeatureToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem reportBugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem requestFeatureToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem githubToolStripMenuItem;
}
}

View file

@ -312,16 +312,7 @@ namespace Toolbox
{
TabDupeIndex = 0;
editor.MdiParent = this;
// Invoke the treeview to add the nodes
editor.treeViewCustom1.Invoke((Action)delegate ()
{
editor.treeViewCustom1.BeginUpdate(); // No visual updates until we say
if (ClearFiles)
editor.treeViewCustom1.Nodes.Clear(); // Remove existing nodes
editor.treeViewCustom1.Nodes.Add(file); // Add the new nodes
editor.treeViewCustom1.EndUpdate(); // Allow the treeview to update visually
});
editor.AddNode(file, ClearFiles);
if (file is TreeNodeFile)
{
@ -402,7 +393,7 @@ namespace Toolbox
private void SaveNodeFormats(ObjectEditor editor, bool UseSaveDialog, bool UseCompressDialog)
{
foreach (var node in editor.treeViewCustom1.Nodes)
foreach (var node in editor.GetNodes())
{
if (node is IFileFormat)
{
@ -1042,8 +1033,7 @@ namespace Toolbox
private void creditsToolStripMenuItem_Click(object sender, EventArgs e)
{
CreditsWindow window = new CreditsWindow();
window.Show();
}
private void BtnMinMax_Click(object sender, EventArgs e)
@ -1155,5 +1145,25 @@ namespace Toolbox
}
form.Focus();
}
private void aboutToolStripMenuItem1_Click(object sender, EventArgs e)
{
CreditsWindow window = new CreditsWindow();
window.Show();
}
private void githubToolStripMenuItem_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://github.com/KillzXGaming/Switch-Toolbox");
}
private void reportBugToolStripMenuItem_Click(object sender, EventArgs e)
{
var dialog = new GithubIssueDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
dialog.CreateIssue();
}
}
}
}

View file

@ -123,6 +123,9 @@
<metadata name="tabControlContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>249, 17</value>
</metadata>
<metadata name="stToolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="BtnMdiMinimize.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View file

@ -76,6 +76,12 @@
<Compile Include="GUI\FileAssociationForm.Designer.cs">
<DependentUpon>FileAssociationForm.cs</DependentUpon>
</Compile>
<Compile Include="GUI\GithubIssueDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GUI\GithubIssueDialog.Designer.cs">
<DependentUpon>GithubIssueDialog.cs</DependentUpon>
</Compile>
<Compile Include="GUI\NodeWrappers.cs" />
<Compile Include="GUI\PluginManager.cs">
<SubType>Form</SubType>
@ -111,6 +117,9 @@
<EmbeddedResource Include="GUI\FileAssociationForm.resx">
<DependentUpon>FileAssociationForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\GithubIssueDialog.resx">
<DependentUpon>GithubIssueDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="GUI\PluginManager.resx">
<DependentUpon>PluginManager.cs</DependentUpon>
</EmbeddedResource>