private bool validateName(string name) { if (string.IsNullOrEmpty(name)) { MessageBox.Show("Name is empty", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } if (name.StartsWith("@", StringComparison.Ordinal)) { name = name.Substring(1); } if (!VPLUtil.IsValidVariableName(name)) { MessageBox.Show("Name is invalid", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } name = string.Format(CultureInfo.InvariantCulture, "@{0}", name); for (int i = 0; i < this.Count; i++) { if (string.Compare(name, this[i].Name, StringComparison.OrdinalIgnoreCase) == 0) { MessageBox.Show("Name is in use", "Parameter Name", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } return(true); }
private void parseFields() { Dictionary <string, string> fs = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(_value)) { int n = 0; while (true) { n = _value.IndexOf("[!", n); if (n < 0) { break; } int m = _value.IndexOf("!]", n + 2); if (m > n + 2) { string s = _value.Substring(n + 2, m - n - 2); if (VPLUtil.IsValidVariableName(s)) { if (!fs.ContainsKey(s)) { string val = string.Empty; if (_fields != null) { _fields.TryGetValue(s, out val); } fs.Add(s, val); } } n = m + 2; } else { break; } } } _fields = fs; }