mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
Reset the file format instance if an archive file is opened, closed, and then replaced
This commit is contained in:
parent
18a64c528b
commit
d4fdeca032
6 changed files with 96 additions and 1 deletions
|
@ -1524,5 +1524,8 @@
|
|||
<ItemGroup>
|
||||
<None Include="Resources\Layout\WindowPane.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Layout\QuickAccess.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -23,12 +23,15 @@ namespace LayoutBXLYT
|
|||
treeView1.ForeColor = FormThemes.BaseTheme.FormForeColor;
|
||||
|
||||
var imgList = new ImageList();
|
||||
imgList.Images.Add("folder", Toolbox.Library.Properties.Resources.Folder);
|
||||
imgList.Images.Add("AlignmentPane", FirstPlugin.Properties.Resources.AlignmentPane);
|
||||
imgList.Images.Add("WindowPane", FirstPlugin.Properties.Resources.WindowPane);
|
||||
imgList.Images.Add("ScissorPane", FirstPlugin.Properties.Resources.ScissorPane);
|
||||
imgList.Images.Add("BoundryPane", FirstPlugin.Properties.Resources.BoundryPane);
|
||||
imgList.Images.Add("NullPane", FirstPlugin.Properties.Resources.NullPane);
|
||||
imgList.Images.Add("PicturePane", FirstPlugin.Properties.Resources.PicturePane);
|
||||
imgList.Images.Add("QuickAcess", FirstPlugin.Properties.Resources.QuickAccess);
|
||||
|
||||
imgList.ImageSize = new Size(22,22);
|
||||
treeView1.ImageList = imgList;
|
||||
}
|
||||
|
@ -40,11 +43,15 @@ namespace LayoutBXLYT
|
|||
isLoaded = false;
|
||||
OnProperySelected = onPropertySelected;
|
||||
|
||||
treeView1.BeginUpdate();
|
||||
treeView1.Nodes.Clear();
|
||||
|
||||
CreateQuickAccess(bxlyt);
|
||||
LoadPane(bxlyt.RootGroup);
|
||||
LoadPane(bxlyt.RootPane);
|
||||
|
||||
treeView1.EndUpdate();
|
||||
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
|
@ -54,7 +61,72 @@ namespace LayoutBXLYT
|
|||
isLoaded = false;
|
||||
}
|
||||
|
||||
private void LoadPane(BasePane pane, TreeNode parent = null)
|
||||
private void CreateQuickAccess(BxlytHeader bxlyt)
|
||||
{
|
||||
var panes = new List<BasePane>();
|
||||
var groupPanes = new List<BasePane>();
|
||||
GetPanes(bxlyt.RootPane,ref panes);
|
||||
GetGroupPanes(bxlyt.RootGroup,ref groupPanes);
|
||||
|
||||
TreeNode node = new TreeNode("Quick Access");
|
||||
node.ImageKey = "QuickAcess";
|
||||
node.SelectedImageKey = "QuickAcess";
|
||||
treeView1.Nodes.Add(node);
|
||||
|
||||
TreeNode nullFolder = new TreeNode("Null Panes");
|
||||
TreeNode windowFolder = new TreeNode("Window Panes");
|
||||
TreeNode pictureFolder = new TreeNode("Picture Panes");
|
||||
TreeNode boundryFolder = new TreeNode("Boundry Panes");
|
||||
TreeNode partsFolder = new TreeNode("Part Panes");
|
||||
TreeNode groupFolder = new TreeNode("Groups");
|
||||
|
||||
node.Nodes.Add(nullFolder);
|
||||
node.Nodes.Add(windowFolder);
|
||||
node.Nodes.Add(pictureFolder);
|
||||
node.Nodes.Add(boundryFolder);
|
||||
node.Nodes.Add(partsFolder);
|
||||
node.Nodes.Add(groupFolder);
|
||||
|
||||
for (int i = 0; i < panes.Count; i++)
|
||||
{
|
||||
var paneNode = CreatePaneWrapper(panes[i]);
|
||||
if (panes[i] is BFLYT.WND1) windowFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BCLYT.WND1) windowFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BRLYT.WND1) windowFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BFLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BCLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BRLYT.PIC1) pictureFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BFLYT.BND1) boundryFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BCLYT.BND1) boundryFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BRLYT.BND1) boundryFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BCLYT.PRT1) partsFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BFLYT.PRT1) partsFolder.Nodes.Add(paneNode);
|
||||
else if (panes[i] is BRLYT.PRT1) partsFolder.Nodes.Add(paneNode);
|
||||
else nullFolder.Nodes.Add(paneNode);
|
||||
}
|
||||
|
||||
for (int i = 0; i < groupPanes.Count; i++)
|
||||
{
|
||||
var paneNode = CreatePaneWrapper(groupPanes[i]);
|
||||
groupFolder.Nodes.Add(paneNode);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetPanes(BasePane pane, ref List<BasePane> panes)
|
||||
{
|
||||
panes.Add(pane);
|
||||
foreach (var childPane in pane.Childern)
|
||||
GetPanes(childPane,ref panes);
|
||||
}
|
||||
|
||||
private void GetGroupPanes(BasePane pane, ref List<BasePane> panes)
|
||||
{
|
||||
panes.Add(pane);
|
||||
foreach (var childPane in pane.Childern)
|
||||
GetPanes(childPane,ref panes);
|
||||
}
|
||||
|
||||
private PaneTreeWrapper CreatePaneWrapper(BasePane pane)
|
||||
{
|
||||
PaneTreeWrapper paneNode = new PaneTreeWrapper();
|
||||
paneNode.Checked = true;
|
||||
|
@ -76,6 +148,12 @@ namespace LayoutBXLYT
|
|||
paneNode.ImageKey = imageKey;
|
||||
paneNode.SelectedImageKey = imageKey;
|
||||
|
||||
return paneNode;
|
||||
}
|
||||
|
||||
private void LoadPane(BasePane pane, TreeNode parent = null)
|
||||
{
|
||||
var paneNode = CreatePaneWrapper(pane);
|
||||
if (parent == null)
|
||||
treeView1.Nodes.Add(paneNode);
|
||||
else
|
||||
|
|
10
File_Format_Library/Properties/Resources.Designer.cs
generated
10
File_Format_Library/Properties/Resources.Designer.cs
generated
|
@ -210,6 +210,16 @@ namespace FirstPlugin.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap QuickAccess {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("QuickAccess", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
@ -187,4 +187,7 @@
|
|||
<data name="WindowPane" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Layout\WindowPane.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="QuickAccess" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Layout\QuickAccess.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
File_Format_Library/Resources/Layout/QuickAccess.png
Normal file
BIN
File_Format_Library/Resources/Layout/QuickAccess.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
|
@ -871,6 +871,7 @@ namespace Toolbox.Library
|
|||
private void ReplaceAction(object sender, EventArgs args)
|
||||
{
|
||||
ArchiveFileInfo.Replace();
|
||||
ArchiveFileInfo.FileFormat = null;
|
||||
UpdateEditor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue