public static List <List <string> > NodeListToStrings(List <Node> _nodes) { List <List <string> > nodes_as_strings = new List <List <string> >(); if (_nodes == null) { return(nodes_as_strings); } foreach (Node n in _nodes) { List <string> node_record = NodeAssembler.GetNodeRecordSimple(n); nodes_as_strings.Add(node_record); } return(nodes_as_strings); }
private static List <List <string> > GetSubNodeRecords(Node _node, int _node_level, bool _explicit = false) { List <List <string> > subnode_records = new List <List <string> >(); if (_node == null) { return(subnode_records); } if (_node.ContainedNodes == null || _node.ContainedNodes.Count < 1) { return(subnode_records); } foreach (Node subNode in _node.ContainedNodes) { if (!_explicit) { if (subNode.SyncByName && !subNode.HasNonSyncNodes()) { continue; } } List <string> subnode_record = NodeAssembler.GetNodeRecordSimple(subNode); int subNode_level = _node_level + 1; subnode_record.Add(subNode_level.ToString()); subnode_records.Add(subnode_record); List <List <string> > subnode_contained_records = NodeAssembler.GetSubNodeRecords(subNode, subNode_level, _explicit); if (subnode_contained_records.Count > 0) { subnode_records.AddRange(subnode_contained_records); } } return(subnode_records); }
public static List <List <string> > NodeListToStringsComplete(List <Node> _nodes, bool _explicit = false) { List <List <string> > nodes_as_strings = new List <List <string> >(); if (_nodes == null) { return(nodes_as_strings); } foreach (Node n in _nodes) { List <string> node_record = NodeAssembler.GetNodeRecordSimple(n); node_record.Add("0"); // level nodes_as_strings.Add(node_record); List <List <string> > node_contained_records = NodeAssembler.GetSubNodeRecords(n, 0, _explicit); if (node_contained_records.Count > 0) { nodes_as_strings.AddRange(node_contained_records); } } return(nodes_as_strings); }