public static List <int> Parse(byte[] data, List <int> sec_ids, CFBHeader header) { uint SecSize = header.SectorSize; List <int> sectors = new List <int>(); foreach (int sec in sec_ids) { if (sec < 0) { if (sec == -2) { Console.WriteLine("Found EoC while reading SAT"); break; } } else { int pos = GetSecPos(sec, header.SectorSize); byte[] bytes = new byte[SecSize]; for (int i = pos; i < pos + SecSize; i++) { bytes[i - pos] = data[i]; } for (int i = 0; i < bytes.Length; i += 4) { sectors.Add(BitConverter.ToInt32(bytes, i)); } } } return(sectors); }
public static List <CFBMasterSector> ParseMSAT(byte[] data, CFBHeader header) { List <CFBMasterSector> msat = new List <CFBMasterSector>(); uint nSec = header.MasterSectorCount; CFBMasterSector currentSector; int nextSector = 0; if (header.FirstExternalMasterSector >= 0) { nextSector = header.FirstExternalMasterSector; do { currentSector = new CFBMasterSector(data, nextSector, header.SectorSize); nextSector = currentSector.NextSector; } while (nextSector > 0); } Console.WriteLine("Found {0} tokens in the MSAT, expected {1}", msat.Count, nSec); return(msat); }
public static List <int> Parse(byte[] data, CFBHeader header) { return(null); }