public void Format(string label, uint clustersize) { BootSectorFAT32 BootSector = new BootSectorFAT32(p); BootSector.TotalSectors32 = (uint)p.BlockCount; BootSector.BytesPerSec = (ushort)p.BlockSize; BootSector.SectorsPerCluster = (byte)(clustersize / p.BlockSize); BootSector.BPB_FATSz32 = (BootSector.TotalSectors32 * 512 * 4 / clustersize + p.BlockSize - 1) / p.BlockSize; BootSector.ReservedSectorCount = 32; BootSector.Media = 0xf8; BootSector.NumberFATs = 2; BootSector.Signature = 0xaa55; this.BootSector = BootSector; FileAllocationTable = new FileAllocationTableFAT32(this, p, BootSector.ReservedSectorCount, (uint)(BootSector.ReservedSectorCount + BootSector.FATsz16)); FileSystemInfo32 = new FileSystemInfo32(p, 1); BootSector.BPB_FSInfo = 1; FileSystemInfo32.Free_Count = (BootSector.TotalSectors32 / BootSector.SectorsPerCluster -2); FileSystemInfo32.LeadSig = 0x41615252; FileSystemInfo32.Nxt_Free = 0x2; FileSystemInfo32.StrucSig = 0x61417272; FileSystemInfo32.TrailSig = 0xaa550000; BootSector.Save(); FileSystemInfo32.Save(); FileAllocationTable.Format(); CalcOffsets(); }
public void Format(string label, uint clustersize) { BootSectorFAT32 BootSector = new BootSectorFAT32(p); BootSector.TotalSectors32 = (uint)p.BlockCount; BootSector.BytesPerSec = (ushort)p.BlockSize; BootSector.SectorsPerCluster = (byte)(clustersize / p.BlockSize); BootSector.BPB_FATSz32 = (BootSector.TotalSectors32 * 512 * 4 / clustersize + p.BlockSize - 1) / p.BlockSize; BootSector.ReservedSectorCount = 32; BootSector.Media = 0xf8; BootSector.NumberFATs = 2; BootSector.Signature = 0xaa55; this.BootSector = BootSector; FileAllocationTable = new FileAllocationTableFAT32(this, p, BootSector.ReservedSectorCount, (uint)(BootSector.ReservedSectorCount + BootSector.FATsz16)); FileSystemInfo32 = new FileSystemInfo32(p, 1); BootSector.BPB_FSInfo = 1; FileSystemInfo32.Free_Count = (BootSector.TotalSectors32 / BootSector.SectorsPerCluster - 2); FileSystemInfo32.LeadSig = 0x41615252; FileSystemInfo32.Nxt_Free = 0x2; FileSystemInfo32.StrucSig = 0x61417272; FileSystemInfo32.TrailSig = 0xaa550000; BootSector.Save(); FileSystemInfo32.Save(); FileAllocationTable.Format(); CalcOffsets(); }
public FAT32(Partition p) : base(p) { BootSector = new BootSectorFAT32(p); BootSector.Refresh(); if ((BootSector as BootSectorFAT32).BPB_FSInfo != 0x0) FileSystemInfo32 = new FileSystemInfo32(p, (BootSector as BootSectorFAT32).BPB_FSInfo); else FileSystemInfo32 = null; FileAllocationTable = new FileAllocationTableFAT32(this, p, BootSector.ReservedSectorCount, (uint)(BootSector.ReservedSectorCount + BootSector.FATsz16)); CalcOffsets(); }
public FAT32(Partition p) : base(p) { BootSector = new BootSectorFAT32(p); BootSector.Refresh(); if ((BootSector as BootSectorFAT32).BPB_FSInfo != 0x0) { FileSystemInfo32 = new FileSystemInfo32(p, (BootSector as BootSectorFAT32).BPB_FSInfo); } else { FileSystemInfo32 = null; } FileAllocationTable = new FileAllocationTableFAT32(this, p, BootSector.ReservedSectorCount, (uint)(BootSector.ReservedSectorCount + BootSector.FATsz16)); CalcOffsets(); }