Display correct case in disk table

This commit is contained in:
Denis Molony 2016-12-16 12:19:59 +11:00
parent 4c0494410e
commit ee3496309b
4 changed files with 29 additions and 11 deletions

View File

@ -21,6 +21,8 @@ public class CPMTextFile extends AbstractFile
String line = getLine (ptr);
text.append (line + "\n");
ptr += line.length () + 2;
while (ptr < buffer.length && buffer[ptr] == 0)
++ptr;
}
if (text.length () > 0)

View File

@ -41,10 +41,16 @@ public class CPMDisk extends AbstractFormattedDisk
setEmptyByte ((byte) 0xE5);
byte[] buffer = disk.readSector (0, 8);
String text = new String (buffer, 16, 24);
if ("DIR ERA TYPESAVEREN USER".equals (text))
version = buffer[41] & 0xFF;
for (int i = 8; i >= 4; i -= 2)
{
byte[] buffer = disk.readSector (0, i);
String text = new String (buffer, 16, 24);
if ("DIR ERA TYPESAVEREN USER".equals (text))
{
version = buffer[41] & 0xFF;
break;
}
}
DefaultMutableTreeNode root = getCatalogTreeRoot ();
@ -55,7 +61,7 @@ public class CPMDisk extends AbstractFormattedDisk
break;
sectorTypes[da.getBlock ()] = catalogSector;
buffer = disk.readSector (da);
byte[] buffer = disk.readSector (da);
for (int i = 0; i < buffer.length; i += 32)
{
@ -166,7 +172,11 @@ public class CPMDisk extends AbstractFormattedDisk
byte[] buffer = disk.readSector (0, i);
String text = new String (buffer, 16, 24);
if ("DIR ERA TYPESAVEREN USER".equals (text))
{
int version = buffer[41] & 0xFF;
System.out.printf ("CPM version %d%n", version);
return true;
}
}
for (int sector = 0; sector < 8; sector++)
@ -177,14 +187,13 @@ public class CPMDisk extends AbstractFormattedDisk
if (bufferContainsAll (buffer, (byte) 0xE5))
break;
// System.out.println (HexFormatter.format (buffer));
for (int i = 0; i < buffer.length; i += 32)
{
int val = buffer[i] & 0xFF;
// System.out.printf ("%02X%n", val);
// if (val == 0xE5)
// break;
if (val > 31 && val != 0xE5)
if (val == 0xE5)
break;
if (val > 31) // && val != 0xE5)
return false;
for (int j = 1; j <= 8; j++)

View File

@ -84,6 +84,11 @@ public class DiskDetails
return shortName;
}
public String getFileName ()
{
return file.getName ();
}
public long calculateChecksum ()
{
checksum = ComputeCRC32.getChecksumValue (file);

View File

@ -70,7 +70,7 @@ public class DiskTableModel extends AbstractTableModel
case 0:
return line.path;
case 1:
return line.shortName;
return line.fileName;
case 2:
return line.type;
case 3:
@ -104,6 +104,7 @@ public class DiskTableModel extends AbstractTableModel
class TableLine
{
private final String shortName;
private final String fileName;
private final String path;
private long checksum;
private final int duplicateNames;
@ -116,6 +117,7 @@ public class DiskTableModel extends AbstractTableModel
{
this.diskDetails = diskDetails;
shortName = diskDetails.getShortName ();
fileName = diskDetails.getFileName ();
checksum = diskDetails.getChecksum ();
type = Utility.getSuffix (shortName);
size = diskDetails.getFile ().length ();