This commit is contained in:
Denis Molony 2023-04-07 19:50:02 +10:00
parent 0af6714119
commit fd5bee6e5c
3 changed files with 32 additions and 28 deletions

View File

@ -17,7 +17,8 @@ public class Binary2
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
{ {
private static final String UNDERLINE = private static final String UNDERLINE =
"------------------------------------------------------" + "-----------------------"; "------------------------------------------------------"
+ "-----------------------";
private Binary2Header binary2Header; private Binary2Header binary2Header;
private byte[] buffer; private byte[] buffer;
@ -54,8 +55,8 @@ public class Binary2
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
public byte[] getDiskBuffer () public byte[] getDiskBuffer () throws DiskFullException, VolumeCatalogFullException,
throws DiskFullException, VolumeCatalogFullException, FileAlreadyExistsException, IOException FileAlreadyExistsException, IOException
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
ProdosDisk disk = new ProdosDisk (800, "DiskBrowser"); ProdosDisk disk = new ProdosDisk (800, "DiskBrowser");
@ -72,8 +73,8 @@ public class Binary2
Squeeze squeeze = new Squeeze (); Squeeze squeeze = new Squeeze ();
byte[] tmp = squeeze.unSqueeze (dataBuffer); byte[] tmp = squeeze.unSqueeze (dataBuffer);
disk.addFile (name, header.fileType, header.auxType, header.created, header.modified, tmp, disk.addFile (name, header.fileType, header.auxType, header.created,
tmp.length); header.modified, tmp, tmp.length);
} }
else else
disk.addFile (header.fileName, header.fileType, header.auxType, header.created, disk.addFile (header.fileName, header.fileType, header.auxType, header.created,
@ -91,12 +92,12 @@ public class Binary2
{ {
StringBuilder text = new StringBuilder (); StringBuilder text = new StringBuilder ();
text.append ( text.append (String.format (
String.format (" %-15.15s Files:%5d%n%n", " %-15.15s Files:%5d%n%n",
fileName, headers.size ())); fileName, headers.size ()));
text.append ( text.append (" Name Type Auxtyp Modified"
" Name Type Auxtyp Modified" + " Fmat Length\n"); + " Fmat Length\n");
text.append (String.format ("%s%n", UNDERLINE)); text.append (String.format ("%s%n", UNDERLINE));

View File

@ -15,8 +15,8 @@ import com.bytezone.diskbrowser.utilities.Utility;
abstract class CatalogEntry implements AppleFileSource abstract class CatalogEntry implements AppleFileSource
// -----------------------------------------------------------------------------------// // -----------------------------------------------------------------------------------//
{ {
static String[] storageTypes = static String[] storageTypes = { "Del", "Sdl", "Sap", "Tre", "Pas", "Ext", "", "", "",
{ "Del", "Sdl", "Sap", "Tre", "Pas", "Ext", "", "", "", "", "", "", "", "DIR", "SDH", "VDH" }; "", "", "", "", "DIR", "SDH", "VDH" };
Disk disk; Disk disk;
ProdosDisk parentDisk; ProdosDisk parentDisk;

View File

@ -72,8 +72,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
private FileEntry link; private FileEntry link;
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent, int parentBlock, FileEntry (ProdosDisk fDisk, byte[] entryBuffer, DirectoryHeader parent,
int entryNo) int parentBlock, int entryNo)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
super (fDisk, entryBuffer, parentBlock, entryNo); super (fDisk, entryBuffer, parentBlock, entryNo);
@ -101,7 +101,6 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case GSOS_EXTENDED_FILE: case GSOS_EXTENDED_FILE:
readForks (); readForks ();
// System.out.printf ("%s has forks%n", getUniqueName ());
break; break;
case SUBDIRECTORY: case SUBDIRECTORY:
@ -351,7 +350,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
file = new DoubleHiResImage (name, outBuffer); file = new DoubleHiResImage (name, outBuffer);
break; break;
case 0x8000: case 0x8000:
file = new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000); file =
new SHRPictureFile2 (name, outBuffer, FILE_TYPE_PIC, 0x2000, 0x8000);
break; break;
default: default:
file = new AssemblerProgram (name, exactBuffer, auxType); file = new AssemblerProgram (name, exactBuffer, auxType);
@ -371,8 +371,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
} }
// else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC // else if (name.endsWith (".PIC")) // 0091 X-BASIC../../XBASIC.PIC
// file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile); // file = new SHRPictureFile2 (name, exactBuffer, fileType, auxType, endOfFile);
else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3")) && endOfFile == 0x2800 else if ((name.equals ("DOS.3.3") || name.equals ("DDOS.3.3"))
&& DosMasterFile.isDos33 (parentDisk, exactBuffer)) && endOfFile == 0x2800 && DosMasterFile.isDos33 (parentDisk, exactBuffer))
{ {
file = new DosMasterFile (name, exactBuffer); file = new DosMasterFile (name, exactBuffer);
} }
@ -415,8 +415,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
case FILE_TYPE_DIRECTORY: case FILE_TYPE_DIRECTORY:
VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader (); VolumeDirectoryHeader vdh = parentDisk.getVolumeDirectoryHeader ();
file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks, vdh.freeBlocks, file = new ProdosDirectory (parentDisk, name, buffer, vdh.totalBlocks,
vdh.usedBlocks); vdh.freeBlocks, vdh.usedBlocks);
break; break;
case FILE_TYPE_APPLESOFT_BASIC_VARS: case FILE_TYPE_APPLESOFT_BASIC_VARS:
@ -627,7 +627,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
if (addresses.size () > 0) if (addresses.size () > 0)
{ {
byte[] tempBuffer = disk.readBlocks (addresses); byte[] tempBuffer = disk.readBlocks (addresses);
buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ())); buffers.add (
new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
addresses.clear (); addresses.clear ();
} }
logicalBlock += 256; logicalBlock += 256;
@ -727,8 +728,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
} }
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
private int readIndexBlock (int indexBlock, List<DiskAddress> addresses, List<TextBuffer> buffers, private int readIndexBlock (int indexBlock, List<DiskAddress> addresses,
int logicalBlock) List<TextBuffer> buffers, int logicalBlock)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
byte[] indexBuffer = disk.readBlock (indexBlock); byte[] indexBuffer = disk.readBlock (indexBlock);
@ -740,7 +741,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
else if (addresses.size () > 0) else if (addresses.size () > 0)
{ {
byte[] tempBuffer = disk.readBlocks (addresses); byte[] tempBuffer = disk.readBlocks (addresses);
buffers.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ())); buffers
.add (new TextBuffer (tempBuffer, auxType, logicalBlock - addresses.size ()));
addresses.clear (); addresses.clear ();
} }
logicalBlock++; logicalBlock++;
@ -811,13 +813,14 @@ class FileEntry extends CatalogEntry implements ProdosConstants
String locked = (access == 0x00) ? "*" : " "; String locked = (access == 0x00) ? "*" : " ";
if (true) if (true)
return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType], blocksUsed, locked) return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType],
+ name; blocksUsed, locked) + name;
String timeC = created == null ? "" : created.format (ProdosDisk.df); String timeC = created == null ? "" : created.format (ProdosDisk.df);
String timeF = modified == null ? "" : modified.format (ProdosDisk.df); String timeF = modified == null ? "" : modified.format (ProdosDisk.df);
return String.format ("%s %s%-30s %3d %,10d %15s %15s", ProdosConstants.fileTypes[fileType], return String.format ("%s %s%-30s %3d %,10d %15s %15s",
locked, parentDirectory.name + "/" + name, blocksUsed, endOfFile, timeC, timeF); ProdosConstants.fileTypes[fileType], locked, parentDirectory.name + "/" + name,
blocksUsed, endOfFile, timeC, timeF);
} }
} }