Skip to content

Commit

Permalink
[Fix]: Reload tab, duplicates the tab. fixes #18
Browse files Browse the repository at this point in the history
[Fix]: Memory optimizations(Work in Progress)
[Rev]: All object buffers are now always closed and reopened as soon as necessary

Version: 1.2.3.0
  • Loading branch information
EliotVU committed Mar 2, 2013
1 parent a74813e commit 0f808ae
Show file tree
Hide file tree
Showing 16 changed files with 922 additions and 766 deletions.
1 change: 1 addition & 0 deletions UE Explorer/UI/Main/ProgramForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ private void TabComponentsStrip_TabStripItemClosing( TabStripItemClosingEventArg
{
foreach( var tc in Tabs.Components.Where( tab => tab.TabItem == e.Item ) )
{
tc.TabClosing();
Tabs.Remove( tc );
break;
}
Expand Down
8 changes: 6 additions & 2 deletions UE Explorer/UI/Tabs/TabsCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ public ITabComponent Add( Type tabType, string tabName )
return tabComp;
}

public void Remove( ITabComponent delComponent )
public void Remove( ITabComponent delComponent, bool fullRemove = false )
{
delComponent.TabClosing();
if( fullRemove )
{
_TabsControl.RemoveTab( delComponent.TabItem );
delComponent.TabItem.Dispose();
}
Components.Remove( delComponent );
}

Expand Down
2 changes: 2 additions & 0 deletions UE Explorer/UI/Tabs/UC_Default.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 58 additions & 6 deletions UE Explorer/UI/Tabs/UC_PackageExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,67 @@ public override void TabClosing()
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose( bool disposing )
{
Console.WriteLine( "Disposing UC_PackageExplorer " + disposing );
if( disposing )
{
exportDecompiledClassesToolStripMenuItem.Click -= _OnExportClassesClick;
exportScriptClassesToolStripMenuItem.Click -= _OnExportScriptsClick;

TreeView_Classes.AfterSelect -= _OnClassesNodeSelected;
TreeView_Classes.BeforeExpand -= _OnClassesNodeExpand;
Num_ObjectIndex.ValueChanged -= Num_ObjectIndex_ValueChanged;
Num_NameIndex.ValueChanged -= Num_NameIndex_ValueChanged;
checkBox9.CheckedChanged -= FilterByClassCheckBox;
checkBox8.CheckedChanged -= FilterByClassCheckBox;
checkBox7.CheckedChanged -= FilterByClassCheckBox;
checkBox6.CheckedChanged -= FilterByClassCheckBox;
checkBox5.CheckedChanged -= FilterByClassCheckBox;
checkBox4.CheckedChanged -= FilterByClassCheckBox;
checkBox3.CheckedChanged -= FilterByClassCheckBox;
checkBox2.CheckedChanged -= FilterByClassCheckBox;
checkBox1.CheckedChanged -= FilterByClassCheckBox;
splitContainer1.SplitterMoved -= SplitContainer1_SplitterMoved;
panel1.Paint -= Panel1_Paint;

TabControl_General.Selecting -= TabControl_General_Selecting;
TabControl_General.Selected -= TabControl_General_Selected;

TabControl_Tables.Selected -= TabControl_Tables_Selected;

TreeView_Exports.AfterSelect -= _OnExportsNodeSelected;
TreeView_Exports.NodeMouseClick -= TreeView_Exports_NodeMouseClick;
TreeView_Imports.NodeMouseClick -= TreeView_Imports_NodeMouseClick;
TreeView_Classes.NodeMouseClick -= TreeView_Classes_NodeMouseClick;

this.FilterText.TextChanged -= this.FilterText_TextChanged;
this.Button_Export.Click -= this.Button_Export_Click;
this.TreeView_Content.BeforeExpand -= this.TreeView_Content_BeforeExpand;
this.TreeView_Content.AfterSelect -= this.TreeView_Content_AfterSelect;
this.TreeView_Content.NodeMouseClick -= this.TreeView_Content_NodeMouseClick;
this.TreeView_Deps.DrawNode -= this.TreeView_Deps_DrawNode;
this.ToolStrip_Main.Paint -= this.ToolStrip_Content_Paint;
this.findNextToolStripMenuItem.Click -= this.FindNextToolStripMenuItem_Click;
this.findInDocumentToolStripMenuItem.Click -= this.FindInDocumentToolStripMenuItem_Click;
this.findInClassesToolStripMenuItem.Click -= this.FindInClassesToolStripMenuItem_Click;
this.viewBufferToolStripMenuItem.Click -= this.ViewBufferToolStripMenuItem_Click;
this.ReloadButton.Click -= this.ReloadButton_Click;
this.panel4.Paint -= this.Panel4_Paint;
this.ToolStrip_Content.Paint -= this.ToolStrip_Content_Paint;
this.PrevButton.Click -= this.ToolStripButton_Backward_Click;
this.NextButton.Click -= this.ToolStripButton_Forward_Click;
this.ExportButton.Click -= this.ToolStripButton1_Click;
this.toolStripSeparator1.Paint -= this.ToolStripSeparator1_Paint;
this.SearchBox.KeyPress -= this.SearchBox_KeyPress_1;
this.SearchBox.TextChanged -= this.SearchBox_TextChanged;
this.FindButton.Click -= this.ToolStripButton_Find_Click;
this.toolStripSeparator4.Paint -= this.ToolStripSeparator1_Paint;
this.toolStripSeparator3.Paint -= this.ToolStripSeparator1_Paint;
this.ViewTools.DropDownItemClicked -= this.ViewTools_DropDownItemClicked;

_BorderPen.Dispose();
_LinePen.Dispose();

WPFHost.Dispose();

_ClassesList = null;
_Form = null;

Expand Down Expand Up @@ -883,7 +933,7 @@ private void DoExportPackageClasses( bool exportScripts = false )

internal void ReloadPackage()
{
Tabs.Remove( this );
Tabs.Remove( this, true );
Tabs.Form.LoadFile( FileName );
}

Expand Down Expand Up @@ -1844,12 +1894,14 @@ private void Button_Export_Click( object sender, EventArgs e )
}
}
var dialog = new SaveFileDialog{Filter = extensions, FileName = ((UObject)exportableObject).Name};
if( dialog.ShowDialog() == DialogResult.OK )
if( dialog.ShowDialog() != DialogResult.OK )
return;

using( var stream = new FileStream( dialog.FileName, FileMode.Create, FileAccess.Write ) )
{
var stream = new FileStream( dialog.FileName, FileMode.Create, FileAccess.Write );
exportableObject.SerializeExport( exportableObject.ExportableExtensions.ElementAt( dialog.FilterIndex - 1 ), stream );
exportableObject.SerializeExport(
exportableObject.ExportableExtensions.ElementAt( dialog.FilterIndex - 1 ), stream );
stream.Flush();
stream.Close();
}
}

Expand Down

0 comments on commit 0f808ae

Please sign in to comment.