private static XmlDiffPathNodeList SelectAbsoluteNodes( XmlDiffViewParentNode rootNode, string path) { Debug.Assert(path[0] == '/'); var pos = 1; var node = (XmlDiffViewNode)rootNode; int startPos; while (true) { startPos = pos; var num = XmlDiffPath.ReadPosition(path, ref pos); if (pos == path.Length || path[pos] == '/') { if (node.FirstChildNode == null) { XmlDiffPath.OnNoMatchingNode(path); } var diffViewParentNode = (XmlDiffViewParentNode)node; if (num <= 0 || num > diffViewParentNode._sourceChildNodesCount) { XmlDiffPath.OnNoMatchingNode(path); } node = diffViewParentNode.GetSourceChildNode(num - 1); if (pos != path.Length) { ++pos; } else { break; } } else if (path[pos] != '-' && path[pos] != '|') { XmlDiffPath.OnInvalidExpression(path); } else { goto label_10; } } var diffPathNodeList = (XmlDiffPathNodeList) new XmlDiffPathSingleNodeList(); diffPathNodeList.AddNode(node); return(diffPathNodeList); label_10: if (node.FirstChildNode == null) { XmlDiffPath.OnNoMatchingNode(path); } return(XmlDiffPath.SelectChildNodes((XmlDiffViewParentNode)node, path, startPos)); }
private static XmlDiffPathNodeList SelectChildNodes( XmlDiffViewParentNode parentNode, string path, int startPos) { var pos = startPos; XmlDiffPathNodeList diffPathNodeList; while (true) { int num1; do { num1 = XmlDiffPath.ReadPosition(path, ref pos); diffPathNodeList = pos != path.Length ? (XmlDiffPathNodeList) new XmlDiffPathMultiNodeList() : (XmlDiffPathNodeList) new XmlDiffPathSingleNodeList(); if (num1 <= 0 || num1 > parentNode._sourceChildNodesCount) { XmlDiffPath.OnNoMatchingNode(path); } diffPathNodeList.AddNode(parentNode.GetSourceChildNode(num1 - 1)); if (pos != path.Length) { if (path[pos] == '|') { ++pos; } } else { goto label_15; } }while (path[pos] != '-'); ++pos; var num2 = XmlDiffPath.ReadPosition(path, ref pos); if (num2 <= 0 || num2 > parentNode._sourceChildNodesCount) { XmlDiffPath.OnNoMatchingNode(path); } while (num1 < num2) { ++num1; diffPathNodeList.AddNode(parentNode.GetSourceChildNode(num1 - 1)); } if (pos != path.Length) { if (path[pos] == '|') { ++pos; } else { XmlDiffPath.OnInvalidExpression(path); } } else { break; } } label_15: return(diffPathNodeList); }