public XMLValue(XMLParamData data) { if (data.type == null || data.type == "") { Type = XType.UNDEFINED; } else { Type = (XType)Enum.Parse(this.Type.GetType(), data.type.ToUpper()); } if (data.behaviors == null || data.behaviors == "") { Behavior = XBehavior.DEFAULT; } else { string[] behaviordata = data.behaviors.Split(BehaviorDelimiter); for (int a = 0; a < behaviordata.Length; a++) { string[] refdata = behaviordata[a].Split(RefDelimiter); if (refdata.Length == 2) { RefBlockType = refdata[1].ToLower(); Behavior |= (XBehavior)Enum.Parse(this.Behavior.GetType(), refdata[0].ToUpper()); } else { Behavior |= (XBehavior)Enum.Parse(this.Behavior.GetType(), behaviordata[a].ToUpper()); } } } masks = new List <XMLValueMask>(); foreach (string s in data.masksPattern) { masks.Add(new XMLValueMaskPattern(s)); } foreach (string s in data.masksRegex) { masks.Add(new XMLValueMaskRegex(s)); } foreach (string s in data.masksNumeric) { masks.Add(new XMLValueMaskNumeric(s)); } if (masks.Count == 0) { noMasks = true; } else { noMasks = false; } }
public XMLParameter(string name, string behavior, List <XMLParamData> data) { this.name = name.ToLower(); if (behavior == "") { this.behavior = XBehavior.REQUIRED; } else { this.behavior = (XBehavior)Enum.Parse(this.behavior.GetType(), behavior.ToUpper()); } values = new XMLValue[data.Count]; int a = 0; foreach (XMLParamData d in data) { values[a] = new XMLValue(d); a++; } }