private ObservableCollection <PackageItem> BuildDirectoryTree(string path) { var items = new ObservableCollection <PackageItem>(); var dirInfo = new DirectoryInfo(path); foreach (var directory in dirInfo.GetDirectories()) { var item = new PackageDirectory { ItemName = directory.Name, WindowsPath = directory.FullName, PackageItems = BuildDirectoryTree(directory.FullName) }; items.Add(item); } foreach (var file in dirInfo.GetFiles()) { var item = new PackageFile { ItemName = file.Name, WindowsPath = file.FullName }; items.Add(item); } return(items); }
// For creating a file in the Package. public PackageFile(string packageID, PackageDirectory parentPackageFile, FileInfo _windowsFileInfo) { windowsFileInfo = _windowsFileInfo; ParentItem = parentPackageFile; // GenerateMetadata(packageID); }