private void FromDirectoryHelper(IWritableDargonNode fileNode, ModificationImportEntryDirectoryViewModel viewModelNode) { foreach (var fileNodeChild in fileNode.Children) { if (fileNodeChild.Children.None()) { viewModelNode.Children.Add(new ModificationImportEntryFileViewModel { Name = fileNodeChild.Name, Parent = viewModelNode }); } else { var newDirectoryName = fileNodeChild.Name; var currentNode = fileNodeChild; while (currentNode.Children.Count == 1 && currentNode.Children.First().Children.Count != 0) { currentNode = currentNode.Children.First(); newDirectoryName = newDirectoryName + "/" + currentNode.Name; } var directoryNode = new ModificationImportEntryDirectoryViewModel { Name = newDirectoryName, Parent = viewModelNode }; viewModelNode.Children.Add(directoryNode); FromDirectoryHelper(currentNode, directoryNode); } } }
public DirectoryFileSystem(IWritableDargonNode baseNode) { this.baseNode = baseNode; }