Made physical size be an indicator of DOS vs ProDOS formats.

This commit is contained in:
Robert Greene 2003-12-28 20:42:51 +00:00
parent c45ecdd56b
commit 7915d468da

View File

@ -79,6 +79,7 @@ public class Disk {
private static FilenameFilter[] filenameFilters; private static FilenameFilter[] filenameFilters;
private String filename; private String filename;
private boolean newImage = false; private boolean newImage = false;
private ByteArrayImageLayout diskImageManager;
private ImageOrder imageOrder; private ImageOrder imageOrder;
/** /**
@ -147,17 +148,16 @@ public class Disk {
} }
input.close(); input.close();
byte[] diskImage = diskImageByteArray.toByteArray(); byte[] diskImage = diskImageByteArray.toByteArray();
ByteArrayImageLayout diskImageManager = null;
if (diskImage.length >= APPLE_800KB_2IMG_DISK if (diskImage.length >= APPLE_800KB_2IMG_DISK
&& diskImage.length <= APPLE_800KB_2IMG_DISK + 10) { && diskImage.length <= APPLE_800KB_2IMG_DISK + 10) {
diskImageManager = new UniversalDiskImageLayout(diskImage); diskImageManager = new UniversalDiskImageLayout(diskImage);
} else { } else {
diskImageManager = new ByteArrayImageLayout(diskImage); diskImageManager = new ByteArrayImageLayout(diskImage);
} }
if (isDosOrder()) { if (isProdosOrder()) {
imageOrder = new DosOrder(diskImageManager);
} else if (isProdosOrder()) {
imageOrder = new ProdosOrder(diskImageManager); imageOrder = new ProdosOrder(diskImageManager);
} else if (isDosOrder()) {
imageOrder = new DosOrder(diskImageManager);
} else if (isNibbleOrder()) { } else if (isNibbleOrder()) {
imageOrder = new NibbleOrder(diskImageManager); imageOrder = new NibbleOrder(diskImageManager);
} }
@ -231,7 +231,11 @@ public class Disk {
* @return byte[] * @return byte[]
*/ */
public ByteArrayImageLayout getDiskImageManager() { public ByteArrayImageLayout getDiskImageManager() {
return imageOrder.getDiskImageManager(); if (imageOrder != null) {
return imageOrder.getDiskImageManager();
} else {
return diskImageManager;
}
} }
/** /**
@ -256,7 +260,8 @@ public class Disk {
return filename.toLowerCase().endsWith(".po") return filename.toLowerCase().endsWith(".po")
|| filename.toLowerCase().endsWith(".po.gz") || filename.toLowerCase().endsWith(".po.gz")
|| is2ImgOrder() || is2ImgOrder()
|| filename.toLowerCase().endsWith(".hdv"); || filename.toLowerCase().endsWith(".hdv")
|| getPhysicalSize() >= APPLE_800KB_DISK;
} }
/** /**
@ -292,7 +297,11 @@ public class Disk {
* Identify the size of this disk. * Identify the size of this disk.
*/ */
public int getPhysicalSize() { public int getPhysicalSize() {
return getDiskImageManager().getPhysicalSize(); if (getDiskImageManager() != null) {
return getDiskImageManager().getPhysicalSize();
} else {
return getImageOrder().getPhysicalSize();
}
} }
/** /**