private void button1_Click(object sender, EventArgs e) { if (drivesView.SelectedItems.Count > 0) { byte[] x = new byte[512]; llda.WriteSector(drivesView.SelectedItems[0].SubItems[1].Text, 1, 512, x); UInt64 totalSectors = (UInt64.Parse(drivesView.SelectedItems[0].SubItems[2].Text)); GPT gpt = GPT.FromSectors(llda.ReadSector(drivesView.SelectedItems[0].SubItems[1].Text, 0, 4096 * 5)); GPT gpt2 = GPT.FromSectors(llda.ReadSectors(drivesView.SelectedItems[0].SubItems[1].Text, (long)totalSectors - 2, 512, 2)); llda.refreshDrive(drivesView.SelectedItems[0].SubItems[1].Text); // gpt.gptHeader.UpdateCRC32(CRC.CRC32(gpt.gptPartitionTable.ToByteArray())); } }
public static Boolean IsBFS(string drive) { Boolean test = true; //Check if first Partition is BFS byte[] first; first = llda.ReadSector(drive, 0, 4096 * 5); if (first != null) { gpt = GPT.FromSectors(first); test = test && (gpt.gptPartitionTable.partitions[0].BFSParitionType == new Guid("53525542-4354-494F-4E46-494C45535953")); //Check if BFSTOC v1 exists bfsTOC = BFSTOC.FromSector(llda.ReadSector(drive, 5, 4096)); byte[] version = Encoding.ASCII.GetBytes("BFS1"); test = test && bfsTOC.version.SequenceEqual(version); return(test); } return(false); }