Exemplo n.º 1
0
 private void GenerateButton_Click(object sender, EventArgs e)
 {
     try
     {
         UseWaitCursor = true;
         string        replacementLiteral = GetReplacementLiteral();
         string        hardpointCode      = GetHardpointCode();
         int           hardpointCount     = GetHardpointCountToCreate();
         List <string> hardpointTable;
         if (IsTurretCheckBox.Checked)
         {
             hardpointTable = CreateTurretHpList(hardpointCode, replacementLiteral, hardpointCount,
                                                 GetHardPointBaseName());
         }
         else
         {
             hardpointTable =
                 HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount);
         }
         FileWriterService.WriteToFile(hardpointTable);
         UseWaitCursor = false;
         MessageBox.Show(Strings.SuccessfullyCreadedMessage, Strings.Success, MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
     catch (MissingReplacementPatternException missingReplacementPatternException)
     {
         UseWaitCursor = false;
         MessageBox.Show(missingReplacementPatternException.ToString(), Strings.Error,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (MissingHardpointCodeException missingHardpointCodeException)
     {
         UseWaitCursor = false;
         MessageBox.Show(missingHardpointCodeException.ToString(), Strings.Error,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (MissingHardpointBaseNameException missingHardpointBaseNameException)
     {
         UseWaitCursor = false;
         MessageBox.Show(missingHardpointBaseNameException.ToString(), Strings.Error,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex)
     {
         UseWaitCursor = false;
         MessageBox.Show(ex.ToString(), Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }