comparison FrmMain.cs @ 73:12f11e3c6261

Re #178: "crash" when loading old .army file with equipment tags that are "old" * Catch the "Required Data Missing" exception that is thrown by loading armies and display a message box
author IBBoard <dev@ibboard.co.uk>
date Mon, 28 Sep 2009 19:50:16 +0000
parents fd8654afd331
children f1b7a08a8f6f
comparison
equal deleted inserted replaced
72:9a215113c84c 73:12f11e3c6261
604 string newFilePath = openArmyDialog.FileName; 604 string newFilePath = openArmyDialog.FileName;
605 CurrentArmy = WarFoundryLoader.GetDefault().LoadArmy(new FileInfo(newFilePath)); 605 CurrentArmy = WarFoundryLoader.GetDefault().LoadArmy(new FileInfo(newFilePath));
606 loadedFilePath = newFilePath; 606 loadedFilePath = newFilePath;
607 return true; 607 return true;
608 } 608 }
609 catch (RequiredDataMissingException ex)
610 {
611 log.Error(ex);
612 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
613 return false;
614 }
609 catch (InvalidFileException ex) 615 catch (InvalidFileException ex)
610 { 616 {
611 log.Error(ex); 617 log.Error(ex);
612 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error); 618 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
613 return false; 619 return false;