// Not complete public static byte[] GetBytes(string volume) { Fat.VolumeBootRecord vbr = VolumeBootRecord.Get(volume) as Fat.VolumeBootRecord; ulong DirectoryEntryOffset = (ulong)(vbr.ReservedSectors * vbr.BytesPerSector) + vbr.TotalFats * (vbr.SectorsPerFat * vbr.BytesPerSector); return(Helper.readDrive(volume, DirectoryEntryOffset, 0x1000)); }
public static FileAllocationTableEntry Get(string volume, int sector) { FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord; byte[] bytes = FileAllocationTable.GetBytes(volume, vbr); int endSector = 0; switch (vbr.FatType) { case "FAT12": endSector = parseFat12(bytes, sector); break; case "FAT16": endSector = parseFat16(bytes, sector); break; case "FAT32": endSector = parseFat32(bytes, sector); break; } return(new FileAllocationTableEntry(sector, endSector)); }
private static DirectoryEntry[] GetRootDirectory(string volume) { string volLetter = Helper.GetVolumeLetter(volume); FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord; uint FirstRootDirSecNum = vbr.ReservedSectors + (vbr.BPB_NumberOfFATs * vbr.BPB_FatSize32); byte[] bytes = DD.Get(volume, vbr.BytesPerSector * FirstRootDirSecNum, vbr.BytesPerSector, 2); return(GetInstances(bytes, volume, volLetter)); }
/// <summary> /// /// </summary> /// <returns></returns> public byte[] GetContent() { FatVolumeBootRecord vbr = VolumeBootRecord.Get(this.Volume) as FatVolumeBootRecord; int RootDirSectors = ((vbr.BPB_RootEntryCount * 32) + (vbr.BytesPerSector - 1)) / vbr.BytesPerSector; uint FatSize = 0; if (vbr.BPB_FatSize16 != 0) { FatSize = vbr.BPB_FatSize16; } else { FatSize = vbr.BPB_FatSize32; } uint FirstDataSector = (uint)(vbr.ReservedSectors + (vbr.BPB_NumberOfFATs * FatSize) + RootDirSectors); uint FirstSectorofCluster = ((this.FirstCluster - 2) * vbr.SectorsPerCluster) + FirstDataSector; byte[] bytes = DD.Get(this.Volume, (long)FirstSectorofCluster * (long)vbr.BytesPerSector, vbr.BytesPerSector, 1); if (this.Directory) { return(bytes); } else { if (this.FileSize <= bytes.Length) { return(Helper.GetSubArray(bytes, 0, this.FileSize)); } else { // Need to do more... return(bytes); } } }
public static byte[] GetBytes(string volume) { return(GetBytes(volume, VolumeBootRecord.Get(volume) as FatVolumeBootRecord)); }
public static byte[] GetBytes(string volume) { Fat.VolumeBootRecord vbr = VolumeBootRecord.Get(volume) as Fat.VolumeBootRecord; return(Helper.readDrive(volume, (uint)vbr.LocationOfFsInformationSector * vbr.BytesPerSector, vbr.BytesPerSector)); }
public static FileSystemInformation Get(string volume) { FatVolumeBootRecord vbr = VolumeBootRecord.Get(volume) as FatVolumeBootRecord; return(new FileSystemInformation(DD.Get(volume, (vbr.BytesPerSector * vbr.BPB_FileSytemInfo), vbr.BytesPerSector, 1))); }