private ForkData(byte[] bytes, int offset, string volumeName, uint blockSize) { VolumeName = volumeName; LogicalSize = Helper.SwapEndianness(BitConverter.ToUInt64(bytes, offset)); ClumpSize = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x08)); TotalBlocks = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x0C)); Extents = ExtentDescriptor.GetInstances(bytes, offset + 0x10, volumeName, blockSize); }
private ExtentsOverflowRecord(byte[] bytes, int offset, string volumeName, string fileName) { VolumeHeader volHeader = VolumeHeader.Get(volumeName); VolumeName = volumeName; FileName = fileName; KeyLength = Helper.SwapEndianness(BitConverter.ToUInt16(bytes, offset + 0x00)); ForkType = (FORK_TYPE)bytes[offset + 0x02]; CatalogNodeId = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x04)); RelativeStartBlock = Helper.SwapEndianness(BitConverter.ToUInt32(bytes, offset + 0x08)); Extents = ExtentDescriptor.GetInstances(bytes, offset + 0x0C, volumeName, volHeader.BlockSize); }
internal static ExtentDescriptor[] GetInstances(byte[] bytes, int offset, string volumeName, uint blockSize) { List <ExtentDescriptor> extentList = new List <ExtentDescriptor>(); for (int i = 0; i < 0x08; i++) { ExtentDescriptor extent = Get(bytes, offset + (i * 0x08), volumeName, blockSize); if (extent.BlockCount != 0) { extentList.Add(extent); } } return(extentList.ToArray()); }
/// <summary> /// /// </summary> /// <returns></returns> public byte[] GetSlack() { List <byte> byteList = new List <byte>(); uint extentBlocks = 0; foreach (ExtentDescriptor extent in Extents) { extentBlocks += extent.BlockCount; byteList.AddRange(extent.GetContent()); } if (TotalBlocks == extentBlocks) { ExtentDescriptor extent = Extents[Extents.Length - 1]; byte[] bytes = extent.GetContent(); return(null); //Helper.GetSubArray(bytes, , ); } else { // Need to get some stuff from Extent Overflow File Console.WriteLine("Portion of extents exist in Extent Overflow file"); return(null); } }