Fix removing textures from archive for layout editor.

This commit is contained in:
KillzXGaming 2019-10-18 17:08:44 -04:00
parent a6d1e2d4de
commit 63fdff7b5e
4 changed files with 47 additions and 3 deletions

View file

@ -91,7 +91,44 @@ namespace LayoutBXLYT
return texture;
}
public List<STGenericTexture> AddTextures()
public void RemoveTextures(List<STGenericTexture> textures) {
foreach (var tex in textures)
RemoveTexture(tex);
}
public void RemoveTexture(STGenericTexture texture)
{
switch (Platform)
{
case PlatformType.WiiU:
{
var archive = ArchiveParent;
if (archive == null) return;
ArchiveFileInfo fileInfoDelete = null;
foreach (var file in archive.Files)
{
if (file.FileName.Contains(texture.Text))
fileInfoDelete = file;
}
if (fileInfoDelete != null)
archive.DeleteFile(fileInfoDelete);
}
break;
case PlatformType.Switch:
{
foreach (var bntx in BinaryContainers.Values)
{
if (bntx.Textures.ContainsKey(texture.Text))
bntx.RemoveTexture(bntx.Textures[texture.Text]);
}
}
break;
}
}
public List<STGenericTexture> AddTextures()
{
List<STGenericTexture> textures = new List<STGenericTexture>();

View file

@ -54,7 +54,10 @@ namespace LayoutBXLYT
Textures = new Dictionary<string, STGenericTexture>();
var theme = new VS2015DarkTheme();
ThemeBase theme = new VS2015DarkTheme();
if (FormThemes.ActivePreset == FormThemes.Preset.White)
theme = new VS2015LightTheme();
this.dockPanel1.Theme = theme;
this.dockPanel1.BackColor = FormThemes.BaseTheme.FormBackColor;
this.BackColor = FormThemes.BaseTheme.FormBackColor;

View file

@ -214,7 +214,10 @@ namespace LayoutBXLYT
{
var texture = item.Text;
if (TextureList.ContainsKey(texture))
{
ActiveLayout.TextureManager.RemoveTexture(TextureList[texture]);
TextureList.Remove(texture);
}
ActiveLayout.RemoveTexture(texture);
listViewCustom1.Items.Remove(item);

View file

@ -1130,8 +1130,9 @@ namespace LayoutBXLYT
SelectionBoxPanes.Clear();
ParentEditor.RefreshEditors();
glControl1.Invalidate();
}
glControl1.Invalidate();
}
public enum PickAction