protected override void ProcessRecord() { INode root = new Node(type: "Root", depth: 0, parent: null); RootContentFormatter.Deserialize(root); WriteObject(root); }
private INode GetNode(string path) { string[] pathParts = path.Split(new[] { DriveProvider.pathSeparatorChar }, StringSplitOptions.RemoveEmptyEntries); INode currentNode = new Node(type: "Root", depth: 0, parent: null); bool success = RootContentFormatter.Deserialize(currentNode); Debug.Assert(success); for (int i = 1; i < pathParts.Length; ++i) { bool foundChild = false; foreach (INode child in currentNode.Children) { var identifiableChild = child as IIdentifiableObject; if (identifiableChild != null) { if (string.Compare(pathParts[i], identifiableChild.ID, StringComparison.OrdinalIgnoreCase) == 0) { currentNode = child; foundChild = true; break; } } } if (!foundChild) { return(null); } } return(currentNode); }