public static IMdsDescriptor Parse(string str, IMdsDescriptorFactory factory) { if (str == null) { throw new ArgumentNullException("str"); } var match = SequencePattern.Match(str); var pointerParser = new PointerParser(); while (true) { if (!match.Success) { throw new FormatException("Invalid MDS sequence format, '" + str + "'"); } var ptrs = match.Groups["ptrs"].Value.Split(',').Select(t => pointerParser.Parse(t)).ToArray(); factory.Add(ptrs[0], ptrs.Skip(1).Take(ptrs.Length - 2).ToArray(), ptrs[ptrs.Length - 1]); if (match.Index + match.Length == str.Length) { break; } match = match.NextMatch(); } return(factory.Create()); }
public static IMdsDescriptor Parse( string str, IMdsDescriptorFactory factory ) { if(str==null) throw new ArgumentNullException("str"); var match = SequencePattern.Match(str); var pointerParser = new PointerParser(); while(true) { if(!match.Success) { throw new FormatException("Invalid MDS sequence format, '"+str+"'"); } var ptrs = match.Groups["ptrs"].Value.Split(',').Select(t => pointerParser.Parse(t)).ToArray(); factory.Add(ptrs[0], ptrs.Skip(1).Take(ptrs.Length - 2).ToArray(), ptrs[ptrs.Length - 1]); if( match.Index+match.Length==str.Length ) break; match = match.NextMatch(); } return factory.Create(); }