mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-12-26 21:30:09 +00:00
tidying
This commit is contained in:
parent
22dfaf65c6
commit
0af6714119
@ -21,7 +21,8 @@ public class NuFX
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final String UNDERLINE =
|
||||
"------------------------------------------------------" + "-----------------------";
|
||||
"------------------------------------------------------"
|
||||
+ "-----------------------";
|
||||
private MasterHeader masterHeader;
|
||||
private final byte[] buffer;
|
||||
private final boolean debug = false;
|
||||
@ -39,6 +40,7 @@ public class NuFX
|
||||
{
|
||||
buffer = Files.readAllBytes (path);
|
||||
volumeName = new VolumeName (path.getFileName ().toString ());
|
||||
|
||||
read (buffer);
|
||||
}
|
||||
|
||||
@ -94,6 +96,7 @@ public class NuFX
|
||||
if (record.hasDisk ())
|
||||
++totalDisks;
|
||||
}
|
||||
System.out.println (toString ());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -181,14 +184,14 @@ public class NuFX
|
||||
}
|
||||
|
||||
if (debug)
|
||||
System.out.printf ("%3d %-35s %02X %,7d %,7d %,7d %s %s%n", ++count, fileName,
|
||||
fileType, auxType, eof, buffer.length, created, modified);
|
||||
System.out.printf ("%3d %-35s %02X %,7d %,7d %,7d %s %s%n", ++count,
|
||||
fileName, fileType, auxType, eof, buffer.length, created, modified);
|
||||
|
||||
FileEntry fileEntry;
|
||||
try
|
||||
{
|
||||
fileEntry =
|
||||
disk.addFile (fileName, fileType, auxType, created, modified, buffer, eof);
|
||||
fileEntry = disk.addFile (fileName, fileType, auxType, created, modified,
|
||||
buffer, eof);
|
||||
}
|
||||
catch (FileAlreadyExistsException e)
|
||||
{
|
||||
@ -266,8 +269,8 @@ public class NuFX
|
||||
volumeName.volumeName, masterHeader.getCreated2 (), masterHeader.getModified2 (),
|
||||
masterHeader.getTotalRecords ()));
|
||||
|
||||
text.append (
|
||||
" Name Type Auxtyp Archived" + " Fmat Size Un-Length\n");
|
||||
text.append (" Name Type Auxtyp Archived"
|
||||
+ " Fmat Size Un-Length\n");
|
||||
|
||||
text.append (String.format ("%s%n", UNDERLINE));
|
||||
|
||||
|
@ -15,13 +15,12 @@ class Record
|
||||
// -----------------------------------------------------------------------------------//
|
||||
{
|
||||
private static final byte[] NuFX = { 0x4E, (byte) 0xF5, 0x46, (byte) 0xD8 };
|
||||
private static String[] fileSystems =
|
||||
{ "", "ProDOS/SOS", "DOS 3.3", "DOS 3.2", "Apple II Pascal", "Macintosh HFS",
|
||||
"Macintosh MFS", "Lisa File System", "Apple CP/M", "", "MS-DOS", "High Sierra",
|
||||
"ISO 9660", "AppleShare" };
|
||||
private static String[] fileSystems = { "", "ProDOS/SOS", "DOS 3.3", "DOS 3.2",
|
||||
"Apple II Pascal", "Macintosh HFS", "Macintosh MFS", "Lisa File System",
|
||||
"Apple CP/M", "", "MS-DOS", "High Sierra", "ISO 9660", "AppleShare" };
|
||||
|
||||
private static String[] storage = { "", "Seedling", "Sapling", "Tree", "", "Extended",
|
||||
"", "", "", "", "", "", "", "Subdirectory" };
|
||||
"", "", "", "", "", "", "", "Subdirectory" };
|
||||
|
||||
private static String[] accessChars = { "D", "R", "B", "", "", "I", "W", "R" };
|
||||
private static String threadFormats[] = { "unc", "sq ", "lz1", "lz2", "", "" };
|
||||
@ -254,6 +253,13 @@ class Record
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
String getThreadFormatText ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return threadFormats[getThreadFormat ()];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
int getUncompressedSize ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -283,6 +289,17 @@ class Record
|
||||
return size;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public float getCompressedPct ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
float pct = 100;
|
||||
if (getUncompressedSize () > 0)
|
||||
pct = getCompressedSize () * 100 / getUncompressedSize ();
|
||||
|
||||
return pct;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
byte[] getData ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -313,9 +330,9 @@ class Record
|
||||
if (name.length () > 27)
|
||||
name = ".." + name.substring (name.length () - 25);
|
||||
|
||||
float pct = 100;
|
||||
if (getUncompressedSize () > 0)
|
||||
pct = getCompressedSize () * 100 / getUncompressedSize ();
|
||||
// float pct = 100;
|
||||
// if (getUncompressedSize () > 0)
|
||||
// pct = getCompressedSize () * 100 / getUncompressedSize ();
|
||||
|
||||
String lockedFlag = (access | 0xC3) == 1 ? "+" : " ";
|
||||
String forkedFlag = hasResource () ? "+" : " ";
|
||||
@ -323,11 +340,11 @@ class Record
|
||||
if (hasDisk ())
|
||||
return String.format ("%s%-27.27s %-4s %-6s %-15s %s %3.0f%% %7d", lockedFlag,
|
||||
name, "Disk", (getUncompressedSize () / 1024) + "k", archived.format2 (),
|
||||
threadFormats[getThreadFormat ()], pct, getUncompressedSize ());
|
||||
getThreadFormatText (), getCompressedPct (), getUncompressedSize ());
|
||||
|
||||
return String.format ("%s%-27.27s %s%s $%04X %-15s %s %3.0f%% %7d", lockedFlag,
|
||||
name, fileTypes[fileType], forkedFlag, auxType, archived.format2 (),
|
||||
threadFormats[getThreadFormat ()], pct, getUncompressedSize ());
|
||||
getThreadFormatText (), getCompressedPct (), getUncompressedSize ());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
Loading…
Reference in New Issue
Block a user