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

View File

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

View File

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