internal FATX_Browser.FATX.IOWriter GetWriterIO() { if (DriveType == Info.DriveType.HDD) { try { io.Close(); } catch { } try { br.Close(); } catch { } try { bw.Close(); } catch { } io = new IO.HDDFATX(false, null); bw = io.bw_diskWriter(DeviceID); } else if (DriveType == Info.DriveType.Backup) { try { io.Close(); } catch{} try { br.Close(); } catch{} try { bw.Close(); } catch { } io = new IO.HDDFATX(true, DumpPath); bw = io.bw_dumpWriter(); } else if (DriveType == Info.DriveType.USB) { try { io.Close(); } catch { } try { br.Close(); } catch { } try { bw.Close(); } catch { } System.IO.FileInfo[] fi = new System.IO.DirectoryInfo(DumpPath).GetFiles(); string[] FilePaths = new string[fi.Length]; for (int i = 0; i < FilePaths.Length; i++) { FilePaths[i] = fi[i].FullName; } bw = new IOWriter(FilePaths); } return bw; }
/// <summary> /// Total size of the partition (in bytes) /// </summary> public long PartitionSize() { if (Partition.Size == 0) { long psize = 0; Misc m = new Misc(); if (ourDrive.DriveType == Info.DriveType.Backup | ourDrive.DriveType == Info.DriveType.HDD) { switch (Partition.Offset) { case (long)Info.HDDFATX.Partitions.Compatibility: psize = (long)Info.HDDFATX.Lengths.Compatibility; break; case (long)Info.HDDFATX.Partitions.Data: if (ourDrive.DriveType == Info.DriveType.HDD) { FATX.IO.HDDFATX hddio = new IO.HDDFATX(false, null); psize = (ourDrive.DriveSize - Partition.Offset); } else { psize = (ourDrive.DriveSize - Partition.Offset); } break; case (long)Info.HDDFATX.Partitions.GameCache: psize = (long)Info.HDDFATX.Lengths.GameCache; break; case (long)Info.HDDFATX.Partitions.SystemCache: psize = (long)Info.HDDFATX.Lengths.SystemCache; break; } } else { switch (Partition.Offset) { case (long)Info.USBOffsets.Cache: psize = (long)Info.USBPartitionSizes.Cache; break; case (long)Info.USBOffsets.Data: psize = (long)Info.USBOffsets.Data + 0x1000 + FATSize(); break; } } if (psize == 0) { psize = ourDrive.GetIO().BaseStream.Length; } Partition.Size = psize; } return Partition.Size; }