public bool TryParse(string line, Queue <string> queue, Func <List <Node> > getChildNodes, out Node node) { node = default; if (!line.Contains(" = ") || line.Contains('\"') || !line.IsHierarchicalStart(queue, out var name)) { return(false); } var parameterStart = line.IndexOf('(') + 1; var parameterEnd = line.IndexOf(')'); var parameter = line.Substring(parameterStart, parameterEnd - parameterStart); var value = line.Substring(parameterEnd + ") = ".Length); node = new SolutionItemSectionNode(name, parameter, value, getChildNodes()); return(true); }
public bool GetOrCreateSection(string name, string value, List <Node> childNodes, out SolutionItemSectionNode sectionNode) { var identifier = $"{Name}Section"; sectionNode = ChildNodes .OfType <SolutionItemSectionNode>() .SingleOrDefault(x => x.Name == identifier && x.SectionName == name); if (sectionNode != null) { return(true); } sectionNode = new SolutionItemSectionNode( name: identifier, sectionName: name, value: value, childNodes: childNodes); ChildNodes.Add(sectionNode); return(false); }