public static TransformCommand Parse(string input) { var regex = @"(.+?)\((.+?)\)"; var matches = Regex.Matches(input, regex); TransformCommand first = null; TransformCommand last = null; foreach (Match match in matches) { var key = match.Groups[1].Value.Trim(); var value = match.Groups[2].Value.Trim(); TransformCommandType type; if (!Enum.TryParse <TransformCommandType>(key, true, out type)) { throw new FormatException("Input string was not in correct format: " + input); } var command = new TransformCommand(type, value.Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries).Select(n => double.Parse(n)).ToArray()); if (first == null) { first = command; } else { last.SetNext(command); } last = command; } return(first); }
public object GetRealObject(StreamingContext context) { return(TransformCommand.Parse(Input)); }
public TransformCommand Append(TransformCommand command) { return(Last.SetNext(command)); }
public virtual TransformCommand SetNext(TransformCommand command) { command.Next = Next; Next = command; return(command); }