Example #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);
     }
 }
Example #2
0
        private List <string> CreateTurretHpList(string hardpointCode, string replacementLiteral, int hardpointCount, string hardPointBaseName)
        {
            List <string> hardpointTable = new List <string>();

            hardpointTable.AddRange(HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount, hardPointBaseName, RotationDefinitions.RotationArc.RDefault));
            if (Generate70CheckBox.Checked)
            {
                hardpointTable.AddRange(HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount, hardPointBaseName, RotationDefinitions.RotationArc.R70));
            }
            if (GenerateR90CheckBox.Checked)
            {
                hardpointTable.AddRange(HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount, hardPointBaseName, RotationDefinitions.RotationArc.R90));
            }
            if (GenerateR270CheckBox.Checked)
            {
                hardpointTable.AddRange(HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount, hardPointBaseName, RotationDefinitions.RotationArc.R270));
            }
            if (GenerateR360CheckBox.Checked)
            {
                hardpointTable.AddRange(HardPointGeneratorService.GenerateHpVariants(hardpointCode, replacementLiteral, hardpointCount, hardPointBaseName, RotationDefinitions.RotationArc.R360));
            }

            return(hardpointTable);
        }