private Field BuildField(string rawField) { Match fieldMatch = _fieldRegex.Match(rawField); if (fieldMatch.Success) { DataField field = new DataField { Name = fieldMatch.Groups["Name"].Value, X = Convert.ToInt32(fieldMatch.Groups["XPos"].Value), Y = Convert.ToInt32(fieldMatch.Groups["YPos"].Value), Width = Convert.ToInt32(fieldMatch.Groups["Length"].Value), Type = fieldMatch.Groups["Format"].Value }; if (fieldMatch.Groups["PossibleValues"].Success && !string.IsNullOrEmpty(fieldMatch.Groups["PossibleValues"].Value)) field.PossibleValues = new List<string>(fieldMatch.Groups["PossibleValues"].Value.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries)); return field; } else { Match labelMatch = _labelRegex.Match(rawField); if (labelMatch.Success) { LabelField field = new LabelField { Name = labelMatch.Groups["Name"].Value, X = Convert.ToInt32(labelMatch.Groups["XPos"].Value), Y = Convert.ToInt32(labelMatch.Groups["YPos"].Value), Width = Convert.ToInt32(labelMatch.Groups["Length"].Value) }; return field; } } return null; }
internal override void Parse(List<string> segments) { if (segments.Count > 0) { string[] paramaters = segments[0].Split(','); Field = new DataField { Name = paramaters[0], Type = paramaters[1], Length = Convert.ToInt32(paramaters[2]), Value = paramaters[3] }; } }
internal override void Parse(List<string> segments) { Fields = new List<Field>(); while (segments.Count > 0) { string[] raw = segments[0].Split(','); DataField field = new DataField { Name = raw[0], Length = Convert.ToInt32(raw[1]), Type = raw[2] }; Fields.Add(field); } }