private void btnExport_Click(object sender, EventArgs e)
{
try
{
string fname = string.Format("{0}_{1}.{2}", _qbItem.Root.Filename.Replace('\\', '#').Replace('/', '#').Replace('.', '#'), _qbItem.ItemQbKey.Crc.ToString("X").PadLeft(8, '0'), _fileExt);
if (AppState.LastScriptPath.Length == 0)
fname = Path.Combine(AppState.LastScriptPath, fname);
fname = getBestFullFilename(fname);
export.Filter = string.Format("{0} (*.{0})|*.{0}|All files (*.*)|*.*", _fileExt);
export.Title = string.Format("Export {0} file", _fileExt);
export.OverwritePrompt = true;
export.FileName = fname;
if (export.ShowDialog(this) != DialogResult.Cancel)
{
fname = export.FileName;
if (File.Exists(fname))
File.Delete(fname);
AppState.LastScriptPath = (new FileInfo(fname)).DirectoryName;
File.WriteAllBytes(fname, _qbItem.ScriptData);
}
}
catch (Exception ex)
{
base.ShowException("Script Export Error", ex);
}
}