private void mnuAddFile_Click(object sender, EventArgs e)
{
EditPakItem f = new EditPakItem(EditPakItemType.Add);
if (f.ShowDialog(this) == DialogResult.OK)
{
try
{
this.Cursor = Cursors.WaitCursor;
if (!File.Exists(f.ImportFilename))
{
MessageBox.Show(this, string.Format("'{0}' does not exist", f.ImportFilename), "Add File Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (f.PakItemFilename.Trim().Length == 0)
{
MessageBox.Show(this, "The pak item filename was not specified", "Add File Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
if (pakItemExists(f.PakItemFilename, null))
{
MessageBox.Show(this, string.Format("'{0}' already exists", f.PakItemFilename), "Add File Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
selectPakItem(f.PakItemFilename);
return;
}
//some hard coded values rather than ask the user for them... Always the same update if required
_pakFile.AddFile(f.ImportFilename, f.PakItemFilename, f.ItemType, f.IncludeFileNameInHeader);
reloadPak();
selectPakItem(f.PakItemFilename);
}
finally
{
this.Cursor = Cursors.Default;
}
}
}