private void createPREffect_Click(object sender, EventArgs e) { String resource = eventResource.SelectedValue.ToString(); int min, max; if (int.TryParse(minResource.Text, out min) && int.TryParse(maxResource.Text, out max)) { String prEffect = String.Format("{0}:{1}:{2}:{3}:{4}", PREventEffect.PR_EFFECT_TAG, resource, min, max, prResult.Text); if (PREventEffect.IsValidPREventEffect(prEffect)) { prEffectsList.Add(prEffect); } else { MessageBox.Show(this, prEffect); } } string toWrite = "PREFFECTS"; foreach (String ie in prEffectsList) { toWrite += "^" + ie; } WriteFile("prEffects.txt", toWrite); }
public void PREventEffect_CheckStringValid() { foreach (Tuple <String, String> test in validStrings) { Assert.IsTrue(PREventEffect.IsValidPREventEffect(test.Item1), test.Item2); } foreach (Tuple <String, String> test in invalidStrings) { Assert.IsFalse(PREventEffect.IsValidPREventEffect(test.Item1), test.Item2); } }