Update editor properly.

This commit is contained in:
KillzXGaming 2019-06-09 20:16:11 -04:00
parent bb691dcd0b
commit afe0fc2e3f
6 changed files with 9 additions and 7 deletions

Binary file not shown.

View file

@ -18,17 +18,18 @@ namespace Switch_Toolbox.Library.Forms
private bool _IsLoaded = false;
public ArchiveFilePanel(ArchiveFileInfo archiveFileInfo)
public ArchiveFilePanel()
{
InitializeComponent();
ArchiveFileInfo = archiveFileInfo;
ReloadEditors();
_IsLoaded = true;
}
public void LoadFile(ArchiveFileInfo archiveFileInfo) {
ArchiveFileInfo = archiveFileInfo;
}
private void ReloadEditors()
{
stComboBox1.Items.Clear();

View file

@ -85,13 +85,13 @@ namespace Switch_Toolbox.Library
for (int i = 0; i < Files.Length; i++)
{
var File = ArchiveFileWrapper.FromPath(Files[i], archiveFile);
File.ArchiveFileInfo = new ArchiveFileInfo();
File.ArchiveFileInfo.FileData = System.IO.File.ReadAllBytes(Files[i]);
string FileName = Path.GetFileName(Files[i]);
//Don't add the root file name
if (parentNode.FullPath != string.Empty || !(parentNode is ArchiveRootNodeWrapper))
{
File.ArchiveFileInfo.FileName = Path.Combine(parentNode.FullPath, FileName);
}
else
File.ArchiveFileInfo.FileName = FileName;

View file

@ -537,11 +537,12 @@ namespace Switch_Toolbox.Library
ArchiveFilePanel editor = (ArchiveFilePanel)LibraryGUI.Instance.GetActiveContent(typeof(ArchiveFilePanel));
if (editor == null)
{
editor = new ArchiveFilePanel(ArchiveFileInfo);
editor = new ArchiveFilePanel();
editor.Dock = DockStyle.Fill;
LibraryGUI.Instance.LoadEditor(editor);
}
editor.LoadFile(ArchiveFileInfo);
editor.UpdateEditor();
}