private void btnImport_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);
import.Filter = string.Format("{0} (*.{0})|*.{0}|All files (*.*)|*.*", _fileExt);
import.Title = string.Format("Import {0} file", _fileExt);
import.CheckFileExists = true;
import.CheckPathExists = true;
import.FileName = fname;
if (import.ShowDialog(this) != DialogResult.Cancel)
{
fname = import.FileName;
_qbItem.ScriptData = File.ReadAllBytes(fname);
txtScript.Text = bytesToHexAsciiString(_qbItem.ScriptData);
AppState.LastScriptPath = (new FileInfo(fname)).DirectoryName;
loadStringList();
}
}
catch (Exception ex)
{
base.ShowException("Script Import Error", ex);
}
}