private void mnuReplaceFile_Click(object sender, EventArgs e)
{
try
{
string qbname = lstPakContents.SelectedItems[0].SubItems[1].Text;
string fname = qbname.Replace('\\', '#').Replace('/', '#');
if (AppState.LastQbReplacePath.Length != 0)
{
if (Directory.Exists(AppState.LastQbReplacePath))
{
openQb.InitialDirectory = AppState.LastQbReplacePath;
fname = Path.Combine(AppState.LastQbReplacePath, fname);
}
}
fname = getBestFullFilename(fname);
openQb.Filter = string.Format("{0} (*.qb.{1})|*.qb.{1}|All files (*.*)|*.*", _pakFormat.PakFormatType.ToString(), _pakFormat.FileExtension);
openQb.FileName = fname;
if (openQb.ShowDialog(this) != DialogResult.Cancel)
{
this.Cursor = Cursors.WaitCursor;
AppState.LastQbReplacePath = (new FileInfo(openQb.FileName)).DirectoryName;
_pakFile.ReplaceFile(qbname, openQb.FileName);
refreshPakList();
}
}
catch (Exception ex)
{
showException("Replace Error", ex);
}
finally
{
this.Cursor = Cursors.Default;
}
}