public CatalogEntry Get(CatalogCode code) { if (codePrefix.Equals(code)) { return(this); } CatalogCode rel = CatalogCode.Relative(codePrefix, code); int ID = rel.CodePattern[0]; CatalogEntry child = GetChild(ID); return(child != null?child.Get(code) : null); }
private void Move(CatalogCode a, CatalogCode b) { if (!catalog.Contains(a)) { return; } CatalogEntry entry = catalog.Get(a); string title = entry.name; foreach (CatalogEntry child in entry.children) { Move(child.codePrefix, b + CatalogCode.Relative(a, child.codePrefix)); } if (!Directory.Exists(folder + storage + FolderFor(b))) { Directory.CreateDirectory(folder + storage + FolderFor(b)); } if (IsFile(a, out string oldPath, out bool x)) { SetFileCode(oldPath, b, title); } catalog.Update(b, title); }