Skip to content

Commit

Permalink
Dispose of folder browser dialog correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yaakov-h committed Oct 20, 2019
1 parent 7b71ac1 commit d959b04
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions Resources/NetHookAnalyzer2/NetHookAnalyzer2/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,27 @@ void OnExitToolStripMenuItemClick(object sender, EventArgs e)
Application.Exit();
}

void OnOpenToolStripMenuItemClick(object sender, EventArgs e)
void OnOpenToolStripMenuItemClick( object sender, EventArgs e )
{
var dialog = new FolderBrowserDialog { ShowNewFolderButton = false };
var latestNethookDir = GetLatestNethookDumpDirectory();
if (latestNethookDir != null)
{
dialog.SelectedPath = GetLatestNethookDumpDirectory();
}
string dumpDirectory;

if (dialog.ShowDialog() != WinForms.DialogResult.OK)
using ( var dialog = new FolderBrowserDialog() )
{
return;
}
dialog.ShowNewFolderButton = false;

var dumpDirectory = dialog.SelectedPath;
var latestNethookDir = GetLatestNethookDumpDirectory();
if ( latestNethookDir != null )
{
dialog.SelectedPath = GetLatestNethookDumpDirectory();
}

if ( dialog.ShowDialog() != WinForms.DialogResult.OK )
{
return;
}

dumpDirectory = dialog.SelectedPath;
}

var dump = new NetHookDump();
dump.LoadFromDirectory(dumpDirectory);
Expand Down

0 comments on commit d959b04

Please sign in to comment.