private void ChoosePackageDialog()
{
// Configure open file dialog box
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document"; // Default file name
dlg.DefaultExt = ".AGT"; // Default file extension
dlg.Filter = "Agent Package (.agt)|*.agt"; // Filter files by extension
// Show open file dialog box
Nullable<bool> result = dlg.ShowDialog();
// Process open file dialog box results
if (result == true)
{
// Open document
PackageSource = dlg.FileName;
ICSharpCode.SharpZipLib.Zip.FastZip fz = new FastZip();
var root = System.IO.Path.Combine(System.IO.Path.GetTempPath(), (Guid.NewGuid().ToString()));
fz.ExtractZip(PackageSource, root, FastZip.Overwrite.Always, null, null, null, true);
PackageFile = System.IO.Path.Combine(root, "package.json");
if (System.IO.File.Exists(PackageFile))
{
var cnt = System.IO.File.ReadAllText(PackageFile);
Contents = cnt;
}
}
}