public static CFBElement ParseHierarchy(int DirID, CFBFile File, CFBElement Parent = null) { CFBDirectoryEntry Root = new CFBDirectoryEntry(DirID, File); CFBElement Elem = new CFBElement(Root, File); if (Parent != null) { Parent.Children.Add(Elem); } if (Root.DirIDLeftChild >= 0) { ParseHierarchy(Root.DirIDLeftChild, File, Parent); } if (Root.DirIDRightChild >= 0) { ParseHierarchy(Root.DirIDRightChild, File, Parent); } if (Root.DirIDRoot >= 0) { ParseHierarchy(Root.DirIDRoot, File, Elem); } return(Elem); }
void Parse(byte[] data) { this.Data = data; this.Header = new CFBHeader(data); this.MSAT = new CFBMSAT(data, this); this.SAT = new CFBSAT(data, this.MSAT.Sectors, this); this.RootStream = new CFBStream(0, this); this.RootElement = CFBElement.ParseHierarchy(0, this); //Console.WriteLine(CFBElement.PrintableHierarchy(this.RootElement)); Console.WriteLine(this.RootElement.TotalChildrenCount()); //this.SSAT = new CFBSSAT(data, this); }
public static string PrintableHierarchy(CFBElement Elem, string ParentID = "") { string result = ""; string ID = ParentID + "." + Elem.Entry.DirID.ToString(); result = ID + " : " + Elem.Entry.Name + "\n"; foreach (CFBElement Child in Elem.Children) { result += PrintableHierarchy(Child, ID); } return(result); }
public static IEnumerable <byte> GetData(CFBElement Element, CFBFile File) { return(CFBStream.ParseStream(Element.Entry.FirstSecID, File)); }