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); }
public static IEnumerable <byte> ParseStream(int SecID, CFBFile File) { List <byte> data = new List <byte>(); int nextSector = SecID; do { data.AddRange(File.Data.Skip(CFBSAT.GetSecPos(nextSector, File.Header.SectorSize)).Take((int)File.Header.SectorSize)); nextSector = File.SAT.Sectors[nextSector]; } while (nextSector >= 0); return(data); }
void Parse(byte[] data, CFBFile file) { this.NameBufferSize = BitConverter.ToUInt16(data, 64); this.Name = Encoding.Unicode.GetString(data.Take(NameBufferSize - 2).ToArray()); this.Type = (EntryType)data[66]; this.NodeColor = data[67]; this.DirIDLeftChild = BitConverter.ToInt32(data, 68); this.DirIDRightChild = BitConverter.ToInt32(data, 72); this.DirIDRoot = BitConverter.ToInt32(data, 76); this.UID = Encoding.Unicode.GetString(data.Skip(80).Take(16).ToArray()); this.Flags = BitConverter.ToUInt32(data, 96); this.CreationTime = BitConverter.ToUInt64(data, 100); this.ModificationTime = BitConverter.ToUInt64(data, 108); this.FirstSecID = BitConverter.ToInt32(data, 116); this.StreamSize = BitConverter.ToUInt32(data, 120); this.File = file; }
public CFBElement(CFBDirectoryEntry Entry, CFBFile File) { Stopwatch sw = new Stopwatch(); sw.Start(); this.Entry = Entry; this.File = File; if (this.Entry.FirstSecID > 0) { if (this.Entry.ShortStream) { } else { this.Data = GetData(this, File).ToList(); } } sw.Stop(); Console.WriteLine("Loaded node {2} ({0}) of {3} bytes in {1}ms {4}kb/s", Entry.DirID, sw.ElapsedMilliseconds, Entry.Name, this.Data.Count, this.Data.Count / (sw.ElapsedMilliseconds > 0?sw.ElapsedMilliseconds:1)); }
public CFBSSAT(byte[] data, CFBFile file) { this.Parent = file; this.Sectors = Parse(data, file.Header); }
public CFBStream(int SecID, CFBFile File, bool ShortStream = false) { this.Data = ShortStream ? ParseShortStream(SecID, File).ToList() : ParseStream(SecID, File).ToList(); }
public void Parse(byte[] data, CFBFile file) { this.HeaderSectors = new List <int>(file.Header.MSAT); this.MasterSectors = ParseMSAT(data, file.Header); }
public CFBMSAT(byte[] data, CFBFile file) { this.Parse(data, file); }
public CFBSAT(byte[] data, List <int> sec_ids, CFBFile file) { this.SecIDs = sec_ids; this.Parent = file; this.Sectors = Parse(data, sec_ids, file.Header); }
public CFBDirectoryEntry(int DirID, CFBFile file) { this.DirID = DirID; this.Parse(file.RootStream.Data.Skip(GetPos(DirID)).ToArray(), file); }
public static IEnumerable <byte> GetData(CFBElement Element, CFBFile File) { return(CFBStream.ParseStream(Element.Entry.FirstSecID, File)); }