diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo
index 6fccd283..bc011cef 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 d95e341f..b49b0e13 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-shm b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm
index f5929742..a67a4203 100644
Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm differ
diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal
index a7ebdc60..df358fbe 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/BrawlboxHelper/BrawlHelper.cs b/BrawlboxHelper/BrawlHelper.cs
index 61a4fcb5..2bd41e5b 100644
--- a/BrawlboxHelper/BrawlHelper.cs
+++ b/BrawlboxHelper/BrawlHelper.cs
@@ -221,6 +221,24 @@ namespace BrawlboxHelper
}
}
+ public class FTXPConverter
+ {
+ public static void Pat02Ftxp(MaterialAnim matAnim, string FileName)
+ {
+ PAT0Node pat0 = new PAT0Node();
+ matAnim.FrameCount = pat0.FrameCount;
+ matAnim.Name = pat0.Name;
+ matAnim.Path = pat0.OriginalPath;
+ matAnim.Loop = pat0.Loop;
+
+ foreach (var entry in pat0.Children)
+ {
+ var Material = (PAT0EntryNode)entry;
+
+ }
+ }
+ }
+
public class FSKAConverter
{
static float Deg2Rad = (float)(Math.PI / 180f);
diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs
index e941089a..3dcf8e5c 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/BFRES.cs
@@ -795,10 +795,10 @@ namespace FirstPlugin
Text = resFileU.Name;
- var modelFolder = new BFRESGroupNode(BRESGroupType.Models);
- var texturesFolder = new BFRESGroupNode(BRESGroupType.Textures);
+ var modelFolder = new BFRESGroupNode(BRESGroupType.Models, true);
+ var texturesFolder = new BFRESGroupNode(BRESGroupType.Textures, true);
var animFolder = new BFRESAnimFolder();
- var externalFilesFolder = new BFRESGroupNode(BRESGroupType.Embedded);
+ var externalFilesFolder = new BFRESGroupNode(BRESGroupType.Embedded, true);
//Reload context menus to load specific context menus
modelFolder.LoadContextMenus();
@@ -834,7 +834,7 @@ namespace FirstPlugin
}
if (resFileU.SkeletalAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.SkeletalAnim);
+ var group = new BFRESGroupNode(BRESGroupType.SkeletalAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.SkeletalAnims.Count; i++)
@@ -842,7 +842,7 @@ namespace FirstPlugin
}
if (resFileU.ShaderParamAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.ShaderParamAnim);
+ var group = new BFRESGroupNode(BRESGroupType.ShaderParamAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.ShaderParamAnims.Count; i++)
@@ -850,7 +850,7 @@ namespace FirstPlugin
}
if (resFileU.ColorAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.ColorAnim);
+ var group = new BFRESGroupNode(BRESGroupType.ColorAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.ColorAnims.Count; i++)
@@ -858,7 +858,7 @@ namespace FirstPlugin
}
if (resFileU.TexSrtAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.TexSrtAnim);
+ var group = new BFRESGroupNode(BRESGroupType.TexSrtAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.TexSrtAnims.Count; i++)
@@ -866,7 +866,7 @@ namespace FirstPlugin
}
if (resFileU.TexPatternAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.TexPatAnim);
+ var group = new BFRESGroupNode(BRESGroupType.TexPatAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.TexPatternAnims.Count; i++)
@@ -874,7 +874,7 @@ namespace FirstPlugin
}
if (resFileU.ShapeAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.ShapeAnim);
+ var group = new BFRESGroupNode(BRESGroupType.ShapeAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.ShapeAnims.Count; i++)
@@ -882,7 +882,7 @@ namespace FirstPlugin
}
if (resFileU.BoneVisibilityAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.BoneVisAnim);
+ var group = new BFRESGroupNode(BRESGroupType.BoneVisAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.BoneVisibilityAnims.Count; i++)
@@ -890,7 +890,7 @@ namespace FirstPlugin
}
if (resFileU.MatVisibilityAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.MatVisAnim);
+ var group = new BFRESGroupNode(BRESGroupType.MatVisAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.MatVisibilityAnims.Count; i++)
@@ -898,7 +898,7 @@ namespace FirstPlugin
}
if (resFileU.SceneAnims.Count > 0)
{
- var group = new BFRESGroupNode(BRESGroupType.SceneAnim);
+ var group = new BFRESGroupNode(BRESGroupType.SceneAnim, true);
animFolder.Nodes.Add(group);
for (int i = 0; i < resFileU.SceneAnims.Count; i++)
diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs
index ee57ec18..9f22e546 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/BFRESGroupNode.cs
@@ -125,8 +125,8 @@ namespace Bfres.Structs
}
}
- public BFRESGroupNode(string name) : base() { Text = name; }
- public BFRESGroupNode(BRESGroupType type) : base() { Type = type; SetNameByType(); }
+ public BFRESGroupNode(string name, bool isWiiU = false) : base() { Text = name; IsWiiU = isWiiU; }
+ public BFRESGroupNode(BRESGroupType type, bool isWiiU = false) : base() { Type = type; SetNameByType(); IsWiiU = isWiiU; }
public BRESGroupType Type { get; set; }
diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
index 3bf6a0a4..83bb9414 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
@@ -253,8 +253,15 @@ namespace Bfres.Structs
}
else if (ext == ".seanim")
{
- var ska = FromGeneric(SEANIM.Read(FileName));
- UpdateAnimation(ska);
+ STSkeleton skeleton = GetActiveSkeleton();
+
+ if (skeleton != null)
+ {
+ var ska = FromGeneric(SEANIM.Read(FileName, skeleton));
+ UpdateAnimation(ska);
+ }
+ else
+ STErrorDialog.Show("No matching skeleton bones found to assign!", "Skeleton Importer", "");
}
else if (ext == ".smd")
{
@@ -556,8 +563,8 @@ namespace Bfres.Structs
}
//Difference of last and first key value
- // if (curve.Keys.Length > 0)
- // curve.Delta = curve.Keys[curve.Keys.Length - 1, 0] - curve.Keys[0, 0];
+ if (curve.Keys.Length > 0)
+ curve.Delta = curve.Keys[keyGroup.Keys.Count - 1, 0] - curve.Keys[0, 0];
curve.EndFrame = curve.Frames.Max();
diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs
index 8d7ac1f4..5c1e2d36 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs
@@ -427,6 +427,8 @@ namespace FirstPlugin
}
public static void ReadMaterial(this FMAT m, Material mat)
{
+ m.MaterialU = mat;
+
if (mat.Flags == MaterialFlags.Visible)
m.Enabled = true;
else
@@ -436,7 +438,6 @@ namespace FirstPlugin
m.ReadShaderAssign(mat);
m.SetActiveGame();
m.ReadShaderParams(mat);
- m.MaterialU = mat;
m.ReadTextureRefs(mat);
m.ReadRenderState(mat.RenderState);
}
diff --git a/Switch_FileFormatsMain/GUI/BFRES/BoneAnimEditor.cs b/Switch_FileFormatsMain/GUI/BFRES/BoneAnimEditor.cs
index 0607a254..e6e2aee9 100644
--- a/Switch_FileFormatsMain/GUI/BFRES/BoneAnimEditor.cs
+++ b/Switch_FileFormatsMain/GUI/BFRES/BoneAnimEditor.cs
@@ -44,8 +44,11 @@ namespace FirstPlugin.Forms
frameCountLbl.Text = $" / {fska.FrameCount}";
currentFrameUD.Maximum = fska.FrameCount;
+ fska.SetFrame(0);
for (int frame = 0; frame < fska.FrameCount; frame++)
{
+ fska.NextFrame(null, false, true);
+
bool IsKeyed = boneAnim.HasKeyedFrames(frame);
if (IsKeyed)
{
diff --git a/Switch_FileFormatsMain/GUI/BFRES/BoneAnims/BoneAnimEditor.cs b/Switch_FileFormatsMain/GUI/BFRES/BoneAnims/BoneAnimEditor.cs
index d628109e..a215d4c3 100644
--- a/Switch_FileFormatsMain/GUI/BFRES/BoneAnims/BoneAnimEditor.cs
+++ b/Switch_FileFormatsMain/GUI/BFRES/BoneAnims/BoneAnimEditor.cs
@@ -43,6 +43,8 @@ namespace FirstPlugin.Forms
frameCountLbl.Text = $" / {fska.FrameCount}";
currentFrameUD.Maximum = fska.FrameCount;
+ return;
+
for (int frame = 0; frame <= fska.FrameCount; frame++)
{
bool IsKeyed = boneAnim.HasKeyedFrames(frame);
diff --git a/Switch_FileFormatsMain/NodeWrappers/Archives/BFRESWrapper.cs b/Switch_FileFormatsMain/NodeWrappers/Archives/BFRESWrapper.cs
index aa06e8d0..e3c2e27f 100644
--- a/Switch_FileFormatsMain/NodeWrappers/Archives/BFRESWrapper.cs
+++ b/Switch_FileFormatsMain/NodeWrappers/Archives/BFRESWrapper.cs
@@ -22,8 +22,8 @@ namespace FirstPlugin.NodeWrappers
public bool IsWiiU { get; set; }
- public void LoadMenus(bool isWiiUBfres)
- {
+ public void LoadMenus(bool isWiiUBfres) {
+ IsWiiU = isWiiUBfres;
}
public override void Delete()
diff --git a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll
index f36027b2..3a3dfac4 100644
Binary files a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache
index cad1d349..74f4435a 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/Interop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll
index acb02b42..daffa325 100644
Binary files a/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll differ
diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache
index 65812b1a..1c398980 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/FileFormats/ANIM.cs b/Switch_Toolbox_Library/FileFormats/Animation/ANIM.cs
similarity index 100%
rename from Switch_Toolbox_Library/FileFormats/ANIM.cs
rename to Switch_Toolbox_Library/FileFormats/Animation/ANIM.cs
diff --git a/Switch_Toolbox_Library/FileFormats/Animation/SEANIM.cs b/Switch_Toolbox_Library/FileFormats/Animation/SEANIM.cs
index 61f10c08..510e6105 100644
--- a/Switch_Toolbox_Library/FileFormats/Animation/SEANIM.cs
+++ b/Switch_Toolbox_Library/FileFormats/Animation/SEANIM.cs
@@ -5,108 +5,152 @@ namespace Switch_Toolbox.Library.Animations
{
public class SEANIM
{
- public static Animation Read(string FileName)
+ public static Animation Read(string FileName, STSkeleton skeleton)
{
Animation anim = new Animation();
var seanim = SEAnim.Read(FileName);
anim.FrameCount = seanim.FrameCount;
anim.CanLoop = seanim.Looping;
-
foreach (var bone in seanim.Bones)
{
- var boneAnim = new Animation.KeyNode(bone);
- boneAnim.RotType = Animation.RotationType.EULER;
- boneAnim.UseSegmentScaleCompensate = false;
- anim.Bones.Add(boneAnim);
+ STBone genericBone = skeleton.GetBone(bone);
+ if (genericBone != null)
+ {
+ var boneAnim = new Animation.KeyNode(bone);
+ boneAnim.RotType = Animation.RotationType.EULER;
+ boneAnim.UseSegmentScaleCompensate = false;
+ anim.Bones.Add(boneAnim);
- if (seanim.AnimationPositionKeys.ContainsKey(bone))
- {
- var translationKeys = seanim.AnimationPositionKeys[bone];
- foreach (SEAnimFrame animFrame in translationKeys)
- {
- boneAnim.XPOS.Keys.Add(new Animation.KeyFrame()
- {
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).X,
- Frame = animFrame.Frame,
- });
- boneAnim.YPOS.Keys.Add(new Animation.KeyFrame()
- {
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Y,
- Frame = animFrame.Frame,
- });
- boneAnim.ZPOS.Keys.Add(new Animation.KeyFrame()
- {
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Z,
- Frame = animFrame.Frame,
- });
- }
- }
- if (seanim.AnimationRotationKeys.ContainsKey(bone))
- {
- var rotationnKeys = seanim.AnimationRotationKeys[bone];
- foreach (SEAnimFrame animFrame in rotationnKeys)
- {
- var quat = ((SELib.Utilities.Quaternion)animFrame.Data);
- var euler = STMath.ToEulerAngles(quat.X, quat.Y, quat.Z, quat.W);
+ float PositionX = 0;
+ float PositionY = 0;
+ float PositionZ = 0;
- boneAnim.XROT.Keys.Add(new Animation.KeyFrame()
- {
- Value = euler.X,
- Frame = animFrame.Frame,
- });
- boneAnim.YROT.Keys.Add(new Animation.KeyFrame()
- {
- Value = euler.Y,
- Frame = animFrame.Frame,
- });
- boneAnim.ZROT.Keys.Add(new Animation.KeyFrame()
- {
- Value = euler.Z,
- Frame = animFrame.Frame,
- });
+ float RotationX = 0;
+ float RotationY = 0;
+ float RotationZ = 0;
+
+ float ScaleX = 0;
+ float ScaleY = 0;
+ float ScaleZ = 0;
+
+ if (seanim.AnimType == AnimationType.Relative)
+ {
+ PositionX = genericBone.position[0];
+ PositionY = genericBone.position[1];
+ PositionZ = genericBone.position[2];
+
+ RotationX = genericBone.rotation[0];
+ RotationY = genericBone.rotation[1];
+ RotationZ = genericBone.rotation[2];
+
+ ScaleX = genericBone.scale[0];
+ ScaleY = genericBone.scale[1];
+ ScaleZ = genericBone.scale[2];
}
- }
- if (seanim.AnimationScaleKeys.ContainsKey(bone))
- {
- var scaleKeys = seanim.AnimationScaleKeys[bone];
- foreach (SEAnimFrame animFrame in scaleKeys)
+
+ System.Console.WriteLine(bone);
+
+ if (seanim.AnimationPositionKeys.ContainsKey(bone))
+ {
+ var translationKeys = seanim.AnimationPositionKeys[bone];
+ foreach (SEAnimFrame animFrame in translationKeys)
+ {
+ System.Console.WriteLine(animFrame.Frame + " T " + ((SELib.Utilities.Vector3)animFrame.Data).X);
+ System.Console.WriteLine(animFrame.Frame + " T " + ((SELib.Utilities.Vector3)animFrame.Data).Y);
+ System.Console.WriteLine(animFrame.Frame + " T " + ((SELib.Utilities.Vector3)animFrame.Data).Z);
+
+ boneAnim.XPOS.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).X + PositionX,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.YPOS.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Y + PositionY,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.ZPOS.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Z + PositionZ,
+ Frame = animFrame.Frame,
+ });
+ }
+ }
+ if (seanim.AnimationRotationKeys.ContainsKey(bone))
+ {
+ var rotationnKeys = seanim.AnimationRotationKeys[bone];
+ foreach (SEAnimFrame animFrame in rotationnKeys)
+ {
+ var quat = ((SELib.Utilities.Quaternion)animFrame.Data);
+ var euler = STMath.ToEulerAngles(quat.X, quat.Y, quat.Z, quat.W);
+
+ System.Console.WriteLine(animFrame.Frame + " R " + euler.X);
+ System.Console.WriteLine(animFrame.Frame + " R " + euler.Y);
+ System.Console.WriteLine(animFrame.Frame + " R " + euler.Z);
+
+ boneAnim.XROT.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = euler.X + RotationX,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.YROT.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = euler.Y + RotationY,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.ZROT.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = euler.Z + RotationZ,
+ Frame = animFrame.Frame,
+ });
+ }
+ }
+ if (seanim.AnimationScaleKeys.ContainsKey(bone))
+ {
+ var scaleKeys = seanim.AnimationScaleKeys[bone];
+ foreach (SEAnimFrame animFrame in scaleKeys)
+ {
+ System.Console.WriteLine(animFrame.Frame + " S " + ((SELib.Utilities.Vector3)animFrame.Data).X);
+ System.Console.WriteLine(animFrame.Frame + " S " + ((SELib.Utilities.Vector3)animFrame.Data).Y);
+ System.Console.WriteLine(animFrame.Frame + " S " + ((SELib.Utilities.Vector3)animFrame.Data).Z);
+
+ boneAnim.XSCA.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).X + ScaleX,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.YSCA.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Y + ScaleY,
+ Frame = animFrame.Frame,
+ });
+ boneAnim.ZSCA.Keys.Add(new Animation.KeyFrame()
+ {
+ Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Z + ScaleZ,
+ Frame = animFrame.Frame,
+ });
+ }
+ }
+ else
{
boneAnim.XSCA.Keys.Add(new Animation.KeyFrame()
{
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).X,
- Frame = animFrame.Frame,
+ Value = 1,
+ Frame = 0,
});
boneAnim.YSCA.Keys.Add(new Animation.KeyFrame()
{
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Y,
- Frame = animFrame.Frame,
+ Value = 1,
+ Frame = 0,
});
boneAnim.ZSCA.Keys.Add(new Animation.KeyFrame()
{
- Value = (float)((SELib.Utilities.Vector3)animFrame.Data).Z,
- Frame = animFrame.Frame,
+ Value = 1,
+ Frame = 0,
});
}
}
- else
- {
- boneAnim.XSCA.Keys.Add(new Animation.KeyFrame()
- {
- Value = 1,
- Frame = 0,
- });
- boneAnim.YSCA.Keys.Add(new Animation.KeyFrame()
- {
- Value = 1,
- Frame = 0,
- });
- boneAnim.ZSCA.Keys.Add(new Animation.KeyFrame()
- {
- Value = 1,
- Frame = 0,
- });
- }
}
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditor.cs b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditor.cs
index 92a9da8e..b1327901 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditor.cs
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditor.cs
@@ -73,7 +73,7 @@ namespace Switch_Toolbox.Library.Forms
{
InitializeComponent();
- ObjectTree = new ObjectEditorTree();
+ ObjectTree = new ObjectEditorTree(this);
ObjectTree.Dock = DockStyle.Fill;
stPanel1.Controls.Add(ObjectTree);
}
@@ -89,7 +89,7 @@ namespace Switch_Toolbox.Library.Forms
stPanel1.Controls.Add(ObjectList);
ObjectList.FillList((IArchiveFile)FileFormat);*/
- ObjectTree = new ObjectEditorTree();
+ ObjectTree = new ObjectEditorTree(this);
ObjectTree.Dock = DockStyle.Fill;
stPanel1.Controls.Add(ObjectTree);
@@ -99,7 +99,7 @@ namespace Switch_Toolbox.Library.Forms
}
else
{
- ObjectTree = new ObjectEditorTree();
+ ObjectTree = new ObjectEditorTree(this);
ObjectTree.Dock = DockStyle.Fill;
stPanel1.Controls.Add(ObjectTree);
AddNode((TreeNode)FileFormat);
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.Designer.cs
index 49e4987c..9e9bfe60 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.Designer.cs
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.Designer.cs
@@ -30,6 +30,7 @@
{
this.components = new System.ComponentModel.Container();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
+ this.activeEditorChkBox = new Switch_Toolbox.Library.Forms.STCheckBox();
this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.searchLbl = new Switch_Toolbox.Library.Forms.STLabel();
@@ -47,7 +48,6 @@
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.splitter1 = new System.Windows.Forms.Splitter();
- this.activeEditorChkBox = new Switch_Toolbox.Library.Forms.STCheckBox();
this.stPanel1.SuspendLayout();
this.stPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.searchImgPB)).BeginInit();
@@ -68,6 +68,16 @@
this.stPanel1.TabIndex = 11;
this.stPanel1.Resize += new System.EventHandler(this.stPanel1_Resize);
//
+ // activeEditorChkBox
+ //
+ this.activeEditorChkBox.AutoSize = true;
+ this.activeEditorChkBox.Location = new System.Drawing.Point(140, 4);
+ this.activeEditorChkBox.Name = "activeEditorChkBox";
+ this.activeEditorChkBox.Size = new System.Drawing.Size(144, 17);
+ this.activeEditorChkBox.TabIndex = 4;
+ this.activeEditorChkBox.Text = "Add Files to Active Editor";
+ this.activeEditorChkBox.UseVisualStyleBackColor = true;
+ //
// treeViewCustom1
//
this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -84,7 +94,8 @@
this.treeViewCustom1.Size = new System.Drawing.Size(319, 488);
this.treeViewCustom1.TabIndex = 0;
this.treeViewCustom1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterSelect);
- this.treeViewCustom1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeViewCustom1_DoubleClick);
+ this.treeViewCustom1.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewCustom1_DragDrop);
+ this.treeViewCustom1.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewCustom1_DragOver);
//
// stPanel3
//
@@ -229,16 +240,6 @@
this.splitter1.LocationChanged += new System.EventHandler(this.splitter1_LocationChanged);
this.splitter1.Resize += new System.EventHandler(this.splitter1_Resize);
//
- // activeEditorChkBox
- //
- this.activeEditorChkBox.AutoSize = true;
- this.activeEditorChkBox.Location = new System.Drawing.Point(140, 4);
- this.activeEditorChkBox.Name = "activeEditorChkBox";
- this.activeEditorChkBox.Size = new System.Drawing.Size(144, 17);
- this.activeEditorChkBox.TabIndex = 4;
- this.activeEditorChkBox.Text = "Add Files to Active Editor";
- this.activeEditorChkBox.UseVisualStyleBackColor = true;
- //
// ObjectEditorList
//
this.Controls.Add(this.splitter1);
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.cs b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.cs
index 2edafa59..85ff21f9 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.cs
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorList.cs
@@ -339,7 +339,12 @@ namespace Switch_Toolbox.Library.Forms
Runtime.ObjectEditor.ListPanelWidth = stPanel1.Width;
}
- private void treeViewCustom1_DoubleClick(object sender, MouseEventArgs e)
+ private void treeViewCustom1_DragDrop(object sender, DragEventArgs e)
+ {
+
+ }
+
+ private void treeViewCustom1_DragOver(object sender, DragEventArgs e)
{
}
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.Designer.cs b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.Designer.cs
index aa978c5f..c51ddc92 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.Designer.cs
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.Designer.cs
@@ -29,26 +29,44 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
+ this.splitter1 = new System.Windows.Forms.Splitter();
+ this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
- this.activeEditorChkBox = new Switch_Toolbox.Library.Forms.STCheckBox();
- this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
- this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
this.searchLbl = new Switch_Toolbox.Library.Forms.STLabel();
- this.searchImgPB = new System.Windows.Forms.PictureBox();
+ this.treeViewCustom1 = new Switch_Toolbox.Library.TreeViewCustom();
this.stTextBox1 = new Switch_Toolbox.Library.Forms.STTextBox();
+ this.stPanel3 = new Switch_Toolbox.Library.Forms.STPanel();
+ this.searchImgPB = new System.Windows.Forms.PictureBox();
+ this.activeEditorChkBox = new Switch_Toolbox.Library.Forms.STCheckBox();
this.stContextMenuStrip1 = new Switch_Toolbox.Library.Forms.STMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
- this.splitter1 = new System.Windows.Forms.Splitter();
this.stPanel1.SuspendLayout();
this.stPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.searchImgPB)).BeginInit();
this.stContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
+ // splitter1
+ //
+ this.splitter1.Location = new System.Drawing.Point(314, 0);
+ this.splitter1.Name = "splitter1";
+ this.splitter1.Size = new System.Drawing.Size(3, 542);
+ this.splitter1.TabIndex = 13;
+ this.splitter1.TabStop = false;
+ this.splitter1.LocationChanged += new System.EventHandler(this.splitter1_LocationChanged);
+ this.splitter1.Resize += new System.EventHandler(this.splitter1_Resize);
+ //
+ // stPanel2
+ //
+ this.stPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.stPanel2.Location = new System.Drawing.Point(314, 0);
+ this.stPanel2.Name = "stPanel2";
+ this.stPanel2.Size = new System.Drawing.Size(593, 542);
+ this.stPanel2.TabIndex = 12;
+ //
// stPanel1
//
this.stPanel1.Controls.Add(this.searchLbl);
@@ -62,19 +80,19 @@
this.stPanel1.TabIndex = 11;
this.stPanel1.Resize += new System.EventHandler(this.stPanel1_Resize);
//
- // activeEditorChkBox
+ // searchLbl
//
- this.activeEditorChkBox.AutoSize = true;
- this.activeEditorChkBox.Location = new System.Drawing.Point(137, 6);
- this.activeEditorChkBox.Name = "activeEditorChkBox";
- this.activeEditorChkBox.Size = new System.Drawing.Size(144, 17);
- this.activeEditorChkBox.TabIndex = 3;
- this.activeEditorChkBox.Text = "Add Files to Active Editor";
- this.activeEditorChkBox.UseVisualStyleBackColor = true;
- this.activeEditorChkBox.CheckedChanged += new System.EventHandler(this.activeEditorChkBox_CheckedChanged);
+ this.searchLbl.AutoSize = true;
+ this.searchLbl.ForeColor = System.Drawing.Color.Silver;
+ this.searchLbl.Location = new System.Drawing.Point(3, 31);
+ this.searchLbl.Name = "searchLbl";
+ this.searchLbl.Size = new System.Drawing.Size(41, 13);
+ this.searchLbl.TabIndex = 2;
+ this.searchLbl.Text = "Search";
//
// treeViewCustom1
//
+ this.treeViewCustom1.AllowDrop = true;
this.treeViewCustom1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -91,41 +109,10 @@
this.treeViewCustom1.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeViewCustom1_DrawNode);
this.treeViewCustom1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewCustom1_AfterSelect);
this.treeViewCustom1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.selectItem);
+ this.treeViewCustom1.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewCustom1_DragDrop);
+ this.treeViewCustom1.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewCustom1_DragOver);
this.treeViewCustom1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.treeViewCustom1_DoubleClick);
//
- // stPanel3
- //
- this.stPanel3.Controls.Add(this.searchImgPB);
- this.stPanel3.Controls.Add(this.activeEditorChkBox);
- this.stPanel3.Controls.Add(this.stContextMenuStrip1);
- this.stPanel3.Dock = System.Windows.Forms.DockStyle.Top;
- this.stPanel3.Location = new System.Drawing.Point(0, 0);
- this.stPanel3.Name = "stPanel3";
- this.stPanel3.Size = new System.Drawing.Size(314, 26);
- this.stPanel3.TabIndex = 2;
- //
- // searchLbl
- //
- this.searchLbl.AutoSize = true;
- this.searchLbl.ForeColor = System.Drawing.Color.Silver;
- this.searchLbl.Location = new System.Drawing.Point(3, 31);
- this.searchLbl.Name = "searchLbl";
- this.searchLbl.Size = new System.Drawing.Size(41, 13);
- this.searchLbl.TabIndex = 2;
- this.searchLbl.Text = "Search";
- //
- // searchImgPB
- //
- this.searchImgPB.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.searchImgPB.BackColor = System.Drawing.Color.Transparent;
- this.searchImgPB.Image = global::Switch_Toolbox.Library.Properties.Resources.Antu_edit_find_mail_svg;
- this.searchImgPB.Location = new System.Drawing.Point(-654, 5);
- this.searchImgPB.Name = "searchImgPB";
- this.searchImgPB.Size = new System.Drawing.Size(22, 17);
- this.searchImgPB.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
- this.searchImgPB.TabIndex = 1;
- this.searchImgPB.TabStop = false;
- //
// stTextBox1
//
this.stTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -139,6 +126,40 @@
this.stTextBox1.TextChanged += new System.EventHandler(this.stTextBox1_TextChanged);
this.stTextBox1.Leave += new System.EventHandler(this.stTextBox1_Leave);
//
+ // stPanel3
+ //
+ this.stPanel3.Controls.Add(this.searchImgPB);
+ this.stPanel3.Controls.Add(this.activeEditorChkBox);
+ this.stPanel3.Controls.Add(this.stContextMenuStrip1);
+ this.stPanel3.Dock = System.Windows.Forms.DockStyle.Top;
+ this.stPanel3.Location = new System.Drawing.Point(0, 0);
+ this.stPanel3.Name = "stPanel3";
+ this.stPanel3.Size = new System.Drawing.Size(314, 26);
+ this.stPanel3.TabIndex = 2;
+ //
+ // searchImgPB
+ //
+ this.searchImgPB.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.searchImgPB.BackColor = System.Drawing.Color.Transparent;
+ this.searchImgPB.Image = global::Switch_Toolbox.Library.Properties.Resources.Antu_edit_find_mail_svg;
+ this.searchImgPB.Location = new System.Drawing.Point(-654, 5);
+ this.searchImgPB.Name = "searchImgPB";
+ this.searchImgPB.Size = new System.Drawing.Size(22, 17);
+ this.searchImgPB.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.searchImgPB.TabIndex = 1;
+ this.searchImgPB.TabStop = false;
+ //
+ // activeEditorChkBox
+ //
+ this.activeEditorChkBox.AutoSize = true;
+ this.activeEditorChkBox.Location = new System.Drawing.Point(137, 6);
+ this.activeEditorChkBox.Name = "activeEditorChkBox";
+ this.activeEditorChkBox.Size = new System.Drawing.Size(144, 17);
+ this.activeEditorChkBox.TabIndex = 3;
+ this.activeEditorChkBox.Text = "Add Files to Active Editor";
+ this.activeEditorChkBox.UseVisualStyleBackColor = true;
+ this.activeEditorChkBox.CheckedChanged += new System.EventHandler(this.activeEditorChkBox_CheckedChanged);
+ //
// stContextMenuStrip1
//
this.stContextMenuStrip1.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -162,7 +183,7 @@
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
- this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.openToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
this.openToolStripMenuItem.Text = "Add File";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
@@ -177,28 +198,10 @@
// sortToolStripMenuItem
//
this.sortToolStripMenuItem.Name = "sortToolStripMenuItem";
- this.sortToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.sortToolStripMenuItem.Size = new System.Drawing.Size(95, 22);
this.sortToolStripMenuItem.Text = "Sort";
this.sortToolStripMenuItem.Click += new System.EventHandler(this.sortToolStripMenuItem_Click);
//
- // stPanel2
- //
- this.stPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.stPanel2.Location = new System.Drawing.Point(314, 0);
- this.stPanel2.Name = "stPanel2";
- this.stPanel2.Size = new System.Drawing.Size(593, 542);
- this.stPanel2.TabIndex = 12;
- //
- // splitter1
- //
- this.splitter1.Location = new System.Drawing.Point(314, 0);
- this.splitter1.Name = "splitter1";
- this.splitter1.Size = new System.Drawing.Size(3, 542);
- this.splitter1.TabIndex = 13;
- this.splitter1.TabStop = false;
- this.splitter1.LocationChanged += new System.EventHandler(this.splitter1_LocationChanged);
- this.splitter1.Resize += new System.EventHandler(this.splitter1_Resize);
- //
// ObjectEditorTree
//
this.Controls.Add(this.splitter1);
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.cs b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.cs
index 340462ad..528e8d5d 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.cs
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.cs
@@ -17,6 +17,8 @@ namespace Switch_Toolbox.Library.Forms
{
public partial class ObjectEditorTree : UserControl
{
+ public ObjectEditor ObjectEditor;
+
private TreeView _fieldsTreeCache;
public void BeginUpdate() { treeViewCustom1.BeginUpdate(); }
@@ -86,10 +88,12 @@ namespace Switch_Toolbox.Library.Forms
}
}
- public ObjectEditorTree()
+ public ObjectEditorTree(ObjectEditor objectEditor)
{
InitializeComponent();
+ ObjectEditor = objectEditor;
+
_fieldsTreeCache = new TreeView();
if (Runtime.ObjectEditor.ListPanelWidth > 0)
@@ -487,5 +491,48 @@ namespace Switch_Toolbox.Library.Forms
{
AddFilesToActiveEditor = activeEditorChkBox.Checked;
}
+
+ private void AddFiles(TreeNode parentNode, string[] Files)
+ {
+ if (Files == null || Files.Length <= 0) return;
+
+ for (int i = 0; i < Files.Length; i++)
+ {
+ var File = ArchiveNodeWrapper.FromPath(Files[i]);
+ File.ArchiveFileInfo = new ArchiveFileInfo();
+ File.ArchiveFileInfo.FileData = System.IO.File.ReadAllBytes(Files[i]);
+ File.ArchiveFileInfo.FileName = Files[i];
+
+ parentNode.Nodes.Add(File);
+ }
+ }
+
+ private void treeViewCustom1_DragDrop(object sender, DragEventArgs e)
+ {
+ Point pt = treeViewCustom1.PointToClient(new Point(e.X, e.Y));
+ treeViewCustom1.SelectedNode = treeViewCustom1.GetNodeAt(pt.X, pt.Y);
+ bool IsFile = treeViewCustom1.SelectedNode is ArchiveNodeWrapper && treeViewCustom1.SelectedNode.Parent != null;
+
+ //Use the parent folder for files if it has any
+ if (IsFile)
+ AddFiles(treeViewCustom1.SelectedNode.Parent, e.Data.GetData(DataFormats.FileDrop) as string[]);
+ else
+ AddFiles(treeViewCustom1.SelectedNode, e.Data.GetData(DataFormats.FileDrop) as string[]);
+ }
+
+ private void treeViewCustom1_DragOver(object sender, DragEventArgs e)
+ {
+ Point pt = treeViewCustom1.PointToClient(new Point(e.X, e.Y));
+ TreeNode node = treeViewCustom1.GetNodeAt(pt.X, pt.Y);
+ treeViewCustom1.SelectedNode = node;
+ bool IsRoot = node is ArchiveRootNodeWrapper;
+ bool IsFolder = node is ArchiveFolderNodeWrapper;
+ bool IsFile = node is ArchiveNodeWrapper && node.Parent != null;
+
+ if (IsFolder || IsRoot || IsFile)
+ e.Effect = DragDropEffects.Link;
+ else
+ e.Effect = DragDropEffects.None;
+ }
}
}
diff --git a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.resx b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.resx
index 197ca22e..a3264e1d 100644
--- a/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.resx
+++ b/Switch_Toolbox_Library/Forms/Editors/Object Editor/ObjectEditorTree.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 17, 17
+
\ No newline at end of file
diff --git a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs
index 07456958..bc6b42bd 100644
--- a/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs
+++ b/Switch_Toolbox_Library/Interfaces/IArchiveFile.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
+using System.ComponentModel;
using System.Windows.Forms;
using Switch_Toolbox.Library.Forms;
using Switch_Toolbox.Library.IO;
@@ -70,6 +70,8 @@ namespace Switch_Toolbox.Library
//Wrapper for the archive file itself
public class ArchiveRootNodeWrapper : TreeNodeCustom
{
+ public virtual object PropertyDisplay { get; set; }
+
IArchiveFile ArchiveFile;
public ArchiveRootNodeWrapper(string text, IArchiveFile archiveFile)
@@ -81,6 +83,8 @@ namespace Switch_Toolbox.Library
ContextMenuStrip.Items.Add(new STToolStripItem("Save", SaveAction));
if (!((IFileFormat)archiveFile).CanSave)
ContextMenuStrip.Items[0].Enabled = false;
+
+ PropertyDisplay = new GenericArchiveProperties(archiveFile, text);
}
private void SaveAction(object sender, EventArgs args)
@@ -102,11 +106,51 @@ namespace Switch_Toolbox.Library
}
GC.Collect();
}
+
+ public override void OnClick(TreeView treeView)
+ {
+ STPropertyGrid editor = (STPropertyGrid)LibraryGUI.Instance.GetActiveContent(typeof(STPropertyGrid));
+ if (editor == null)
+ {
+ editor = new STPropertyGrid();
+ LibraryGUI.Instance.LoadEditor(editor);
+ }
+ editor.Text = Text;
+ editor.Dock = DockStyle.Fill;
+ editor.LoadProperty(PropertyDisplay, OnPropertyChanged);
+ }
+
+ public virtual void OnPropertyChanged() {
+ Text = Name;
+ }
+
+
+ public class GenericArchiveProperties
+ {
+ private IArchiveFile ArchiveFile;
+
+ [Category("Archive Properties")]
+ public string Name { get; set; }
+
+ [Category("Archive Properties")]
+ [DisplayName("File Count")]
+ public int FileCount
+ {
+ get { return ArchiveFile.Files.ToList().Count; }
+ }
+
+ public GenericArchiveProperties(IArchiveFile archiveFile, string text) {
+ ArchiveFile = archiveFile;
+ Name = text;
+ }
+ }
}
//Wrapper for folders
public class ArchiveFolderNodeWrapper : TreeNodeCustom
{
+ public virtual object PropertyDisplay { get; set; }
+
public bool CanReplace
{
set
@@ -132,13 +176,43 @@ namespace Switch_Toolbox.Library
public ArchiveFolderNodeWrapper(string text)
{
Text = text;
+ PropertyDisplay = new GenericFolderProperties();
+ ((GenericFolderProperties)PropertyDisplay).Name = Text;
+ ReloadMenus();
+ }
+
+ private void ReloadMenus()
+ {
ContextMenuStrip = new STContextMenuStrip();
ContextMenuStrip.Items.Add(new STToolStripItem("Extract Folder", ExtractAction));
ContextMenuStrip.Items.Add(new STToolStripItem("Replace Folder", ReplaceAction));
ContextMenuStrip.Items.Add(new STToolStripItem("Delete Folder", DeleteAction));
}
+ public override void OnClick(TreeView treeView)
+ {
+ STPropertyGrid editor = (STPropertyGrid)LibraryGUI.Instance.GetActiveContent(typeof(STPropertyGrid));
+ if (editor == null)
+ {
+ editor = new STPropertyGrid();
+ LibraryGUI.Instance.LoadEditor(editor);
+ }
+ editor.Text = Text;
+ editor.Dock = DockStyle.Fill;
+ editor.LoadProperty(PropertyDisplay, OnPropertyChanged);
+ }
+
+ public class GenericFolderProperties
+ {
+ [Category("Folder Properties")]
+ public string Name { get; set; }
+ }
+
+ public virtual void OnPropertyChanged() {
+ Text = Name;
+ }
+
private void ExtractAction(object sender, EventArgs args)
{
TreeNode node = this;
@@ -165,20 +239,23 @@ namespace Switch_Toolbox.Library
int Curfile = 0;
foreach (TreeNode file in Collection)
{
- string FilePath = ((ArchiveNodeWrapper)file).ArchiveFileInfo.FileName;
- FilePath = FilePath.Replace(ParentPath, string.Empty);
-
- Console.WriteLine($"FilePath " + FilePath);
- var path = Path.Combine(folderDialog.SelectedPath, FilePath);
-
- progressBar.Value = (Curfile++ * 100) / Collection.Count();
- progressBar.Refresh();
- CreateDirectoryIfExists($"{path}");
-
if (file is ArchiveNodeWrapper)
{
- File.WriteAllBytes($"{path}",
- ((ArchiveNodeWrapper)file).ArchiveFileInfo.FileData);
+ string FilePath = ((ArchiveNodeWrapper)file).ArchiveFileInfo.FileName;
+ FilePath = FilePath.Replace(ParentPath, string.Empty);
+
+ Console.WriteLine($"FilePath " + FilePath);
+ var path = Path.Combine(folderDialog.SelectedPath, FilePath);
+
+ progressBar.Value = (Curfile++ * 100) / Collection.Count();
+ progressBar.Refresh();
+ CreateDirectoryIfExists($"{path}");
+
+ if (file is ArchiveNodeWrapper)
+ {
+ File.WriteAllBytes($"{path}",
+ ((ArchiveNodeWrapper)file).ArchiveFileInfo.FileData);
+ }
}
}
@@ -242,7 +319,20 @@ namespace Switch_Toolbox.Library
public ArchiveNodeWrapper(string text)
{
Text = text;
+ ReloadMenus();
+ }
+ public static ArchiveNodeWrapper FromPath(string FilePath)
+ {
+ var wrapper = new ArchiveNodeWrapper(Path.GetFileName(FilePath));
+ wrapper.ArchiveFileInfo = new ArchiveFileInfo();
+ wrapper.ArchiveFileInfo.FileName = FilePath;
+ wrapper.ArchiveFileInfo.FileData = File.ReadAllBytes(FilePath);
+ return wrapper;
+ }
+
+ private void ReloadMenus()
+ {
ContextMenuStrip = new STContextMenuStrip();
ContextMenuStrip.Items.Add(new STToolStripItem("Extract", ExtractAction));
ContextMenuStrip.Items.Add(new STToolStripItem("Replace", ReplaceAction));
diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
index 0615f6b6..1036e66f 100644
--- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
+++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj
@@ -277,7 +277,7 @@
-
+
diff --git a/Toolbox/MainForm.Designer.cs b/Toolbox/MainForm.Designer.cs
index 49e59113..35779575 100644
--- a/Toolbox/MainForm.Designer.cs
+++ b/Toolbox/MainForm.Designer.cs
@@ -117,33 +117,33 @@
// newToolStripMenuItem
//
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
- this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.newToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.newToolStripMenuItem.Text = "New";
//
// newFromFileToolStripMenuItem
//
this.newFromFileToolStripMenuItem.Name = "newFromFileToolStripMenuItem";
- this.newFromFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.newFromFileToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.newFromFileToolStripMenuItem.Text = "New From File";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
- this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.openToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
// recentToolStripMenuItem
//
this.recentToolStripMenuItem.Name = "recentToolStripMenuItem";
- this.recentToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.recentToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.recentToolStripMenuItem.Text = "Recent";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Enabled = false;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
- this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.saveToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.saveToolStripMenuItem.Text = "Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
@@ -151,14 +151,14 @@
//
this.saveAsToolStripMenuItem.Enabled = false;
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
- this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.saveAsToolStripMenuItem.Text = "Save As";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@@ -179,7 +179,7 @@
// compressionToolStripMenuItem
//
this.compressionToolStripMenuItem.Name = "compressionToolStripMenuItem";
- this.compressionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.compressionToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.compressionToolStripMenuItem.Text = "Compression";
//
// experimentalToolStripMenuItem
@@ -248,7 +248,7 @@
// mainSettingsToolStripMenuItem
//
this.mainSettingsToolStripMenuItem.Name = "mainSettingsToolStripMenuItem";
- this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.mainSettingsToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.mainSettingsToolStripMenuItem.Text = "Main Settings";
this.mainSettingsToolStripMenuItem.Click += new System.EventHandler(this.mainSettingsToolStripMenuItem_Click);
//
@@ -256,7 +256,7 @@
//
this.fileAssociationsToolStripMenuItem.Enabled = false;
this.fileAssociationsToolStripMenuItem.Name = "fileAssociationsToolStripMenuItem";
- this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.fileAssociationsToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.fileAssociationsToolStripMenuItem.Text = "File Associations";
this.fileAssociationsToolStripMenuItem.Click += new System.EventHandler(this.fileAssociationsToolStripMenuItem_Click);
//
diff --git a/Toolbox/MainForm.resx b/Toolbox/MainForm.resx
index e32fafe3..5bf5c890 100644
--- a/Toolbox/MainForm.resx
+++ b/Toolbox/MainForm.resx
@@ -123,6 +123,9 @@
249, 17
+
+ 132, 17
+