public Dictionary <ArgName, Dictionary <string, object> > Parse() { if (parsed) { return(result); } Dictionary <ArgName, Dictionary <string, object> > localResult = new Dictionary <ArgName, Dictionary <string, object> >(); var segments = SeparateSegments(storedArgs); foreach (var arg in segments) { ArgName name = ParseArgName(arg); if (name == ArgName.Unknown) { continue; } if (localResult.ContainsKey(name)) { continue; } Dictionary <string, string> attributes = SeparateAttributes(arg); Dictionary <string, object> parsedAttrs = ParseAttributes(name, attributes); localResult.Add(name, parsedAttrs); } result = localResult; return(result); }
private Dictionary <string, object> ParseAttributes(ArgName arg, Dictionary <string, string> attrs) { Dictionary <string, object> result = new Dictionary <string, object>(); foreach (KeyValuePair <string, string> pair in attrs) { if (pair.Value == null) { result.Add(pair.Key, null); } else if (attributeTypes[arg].ContainsKey(pair.Key)) { Type type = attributeTypes[arg][pair.Key]; object attrValue = ParseType(type, pair.Value); result.Add(pair.Key, attrValue); } } return(result); }