public PackageFolderContentItem(string folderName, PackageFolderContentItem parent) { // TODO: Complete member initialization Label = folderName; Parent = parent; Contents = new PackageContentCollection(); }
public PackageViewModel(IPackage package) : base(string.Empty, null) { m_package = package; PackageReferenceCollection references = new PackageReferenceCollection(); foreach (IPackageReference reference in m_package.References) { references.Add(reference); } Imports = references; Label = m_package.Name; Icon = null; // TODO: Initialize to correct icon. // Building package contents hierarchy char[] separators = new char[] { '/', '\\' }; foreach (TraceLabSDK.PackageSystem.IPackageFile file in m_package.Files) { PackageFolderContentItem pkgFolder = this; string[] pathLevels = file.Path.Split(separators, StringSplitOptions.RemoveEmptyEntries); for (int i = 1; i < pathLevels.Length; ++i) { string levelName = pathLevels[i]; if (i < pathLevels.Length - 1) { PackageFolderContentItem folder; if (pkgFolder.Contents.Contains(levelName)) { folder = (PackageFolderContentItem)pkgFolder.Contents[levelName]; } else { folder = new PackageFolderContentItem(levelName, pkgFolder); pkgFolder.Contents.Add(folder); } pkgFolder = folder; } else { if (pkgFolder.Contents.Contains(levelName) == false) { PackageFileContentItem pkgFile = new PackageFileContentItem(levelName, pkgFolder, file.ID); pkgFolder.Contents.Add(pkgFile); } } } } var visibleList = new List <object>(); visibleList.Add(Imports); visibleList.Add(Contents); Visible = visibleList; }
public PackageFileContentItem(string name, PackageFolderContentItem parent, string id) : base() { Label = name; Parent = parent; ID = id; }