public void AddFileEntry(FileEntry entry) { string[] splt = entry.PathIds.HasUnHashed ? entry.PathIds.UnHashed.Split("/") : null; if (splt != null && splt.Length > (folderLevel + 1)) { string initial_folder = splt[folderLevel]; if (!Children.ContainsKey(initial_folder)) { FolderEntry folder = new FolderEntry(entry, this.folderLevel + 1) { Parent = this, EntryPath = "" }; for (int i = 0; i <= this.folderLevel; i++) { folder.EntryPath = Utils.CombineDir(folder.EntryPath, splt[i]); } //Debug.Print(string.Format("Folder: {0}", folder.Path)); folder.Name = initial_folder; Children.Add(initial_folder, folder); } else { ((FolderEntry)Children[initial_folder]).AddFileEntry(entry); } } else { entry.Parent = this; Children.Add(entry.Name, entry); } }
public void AddToTree(FolderEntry item, Idstring pck = null) { foreach (KeyValuePair <string, IEntry> entry in Children) { if (entry.Value is FolderEntry) { FolderEntry _entry = entry.Value as FolderEntry; if (pck != null && !_entry.ContainsAnyBundleEntries(pck)) { continue; } // item.Children.Add(item); _entry.AddToTree(item, pck); } } }
public bool ContainsAnyBundleEntries(Idstring package = null) { foreach (KeyValuePair <string, IEntry> entry in Children) { if (entry.Value is FolderEntry) { FolderEntry _entry = entry.Value as FolderEntry; if (_entry.ContainsAnyBundleEntries(package)) { return(true); } } else if (entry.Value is FileEntry) { FileEntry _entry = entry.Value as FileEntry; if (_entry.BundleEntries.Count != 0 && (package != null ? _entry.BundleEntries.ContainsKey(package) : true)) { return(true); } } } return(false); }