/// <summary> /// Number of File Allocation Tables /// </summary> public uint FATCopies() { uint rVal = 0; Misc m = new Misc(); //Open our binary reader FATX_Browser.FATX.IOReader br = ourDrive.GetIO(); //Seek to the data partition offset + 0xC (where the FATCopies int is) br.BaseStream.Position = Partition.Offset; //Create our mem reader / buffer FATX_Browser.FATX.IOReader mem = new FATX_Browser.FATX.IOReader(new System.IO.MemoryStream(br.ReadBytes(0x200))); br.Close(); mem.BaseStream.Position = 0xC; //Get our value (uses outside class for bigendian) rVal = m.ReadUInt32(ref mem); mem.Close(); return rVal; }
/// <summary> /// Partition ID /// </summary> public uint PartitionID() { uint rVal = 0; Misc m = new Misc(); //Open our binary reader FATX_Browser.FATX.IOReader br = ourDrive.GetIO(); //Seek to the data partition offset br.BaseStream.Position = Partition.Offset; //Read our buffer FATX_Browser.FATX.IOReader mem = new FATX_Browser.FATX.IOReader(new System.IO.MemoryStream(br.ReadBytes(0x200))); br.Close(); mem.BaseStream.Position = 0x4; rVal = m.ReadUInt32(ref mem); mem.Close(); return rVal; }
/// <summary> /// Returns EntryData for an entry in a block /// </summary> /// <param name="br">The binary reader to use</param> /// <param name="EntryBlock">The entry in the block to read</param> /// <param name="Block">The block to read from</param> internal EntryData GetEData(long originalOffset, FATX_Browser.FATX.IOReader br, uint EntryBlock, uint Block) { Misc r = new Misc(); //br.BaseStream.Position = 0x131229000;//(r.GetBlockOffset(Block, Partition, DeviceID)) + (0x40 * EntryBlock); //Create our return EntryData data = new EntryData(); //Read our variables data.EntryOffset = originalOffset + br.BaseStream.Position; data.FileNameSize = br.ReadByte(); data.Flags = br.ReadByte(); data.FileName = Encoding.ASCII.GetString(br.ReadBytes((int)data.FileNameSize)); //Go to the end of the name to continue reading the variables br.BaseStream.Position += (0x2A - (int)data.FileNameSize); data.StartingCluster = r.ReadUInt32(ref br); data.Size = r.ReadUInt32(ref br); data.CreationDate = r.ReadUInt16(ref br); data.CreationTime = r.ReadUInt16(ref br); data.AccessDate = r.ReadUInt16(ref br); data.AccessTime = r.ReadUInt16(ref br); data.ModifiedDate = r.ReadUInt16(ref br); data.ModifiedTime = r.ReadUInt16(ref br); //br.BaseStream.Position += 0xC; br.Close(); return data; //TODO: Datetime conversion from FAT to DateTime }