Пример #1
0
        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);
        }
Пример #2
0
 // For creating a file in the Package.
 public PackageFile(string packageID, PackageDirectory parentPackageFile, FileInfo _windowsFileInfo)
 {
     windowsFileInfo = _windowsFileInfo;
     ParentItem      = parentPackageFile;
     // GenerateMetadata(packageID);
 }