mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-25 16:34:00 +00:00
tidying
This commit is contained in:
parent
838791ad05
commit
e6100d247a
@ -131,8 +131,8 @@ class LZW
|
||||
int calculatedCrc = Utility.getCRC (buffer, length, crcBase);
|
||||
if (crc != calculatedCrc)
|
||||
{
|
||||
System.out.printf ("%n*** LZW CRC mismatch *** %04X %04X%n", crc, calculatedCrc);
|
||||
// throw new FileFormatException ("File CRC failed");
|
||||
System.out.printf ("%n*** Thread CRC failed *** %04X %04X%n", crc, calculatedCrc);
|
||||
// throw new FileFormatException ("Thread CRC failed");
|
||||
}
|
||||
|
||||
return buffer;
|
||||
|
@ -44,11 +44,6 @@ public class NuFX
|
||||
for (int rec = 0; rec < masterHeader.getTotalRecords (); rec++)
|
||||
{
|
||||
Record record = new Record (buffer, dataPtr);
|
||||
// if (record.getFileSystemID () != 1)
|
||||
// {
|
||||
// System.out.println ("Not Prodos: " + record.getFileSystemID ());
|
||||
// break;
|
||||
// }
|
||||
records.add (record);
|
||||
|
||||
if (debug)
|
||||
@ -131,13 +126,12 @@ public class NuFX
|
||||
}
|
||||
else if (totalFiles > 0)
|
||||
{
|
||||
int[] diskSizes = { 280, 800, 1600, 3200, 6400, 65536 };
|
||||
// System.out.printf ("Files require: %d blocks%n", totalBlocks);
|
||||
|
||||
// choose Volume Name
|
||||
String volumeName = "DiskBrowser";
|
||||
int nameOffset = 0;
|
||||
|
||||
// should check that files are all in prodos format
|
||||
|
||||
if (paths.size () == 1) // exactly one directory path
|
||||
{
|
||||
String onlyPath = paths.get (0);
|
||||
@ -149,9 +143,9 @@ public class NuFX
|
||||
nameOffset = volumeName.length () + 1; // skip volume name in all paths
|
||||
}
|
||||
|
||||
int[] diskSizes = { 280, 800, 1600, 3200, 6400, 65536 };
|
||||
for (int diskSize : diskSizes) // in case we choose a size that is too small
|
||||
{
|
||||
// System.out.printf ("Checking %d %d%n", diskSize, totalBlocks);
|
||||
if (diskSize < (totalBlocks + 10))
|
||||
continue;
|
||||
|
||||
@ -202,19 +196,6 @@ public class NuFX
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public byte[] getFileBuffer (String fileName)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (Record record : records)
|
||||
if (record.hasFile (fileName))
|
||||
for (Thread thread : record.threads)
|
||||
if (thread.hasFile ())
|
||||
return thread.getData ();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public int getTotalFiles ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -70,8 +70,8 @@ class Record
|
||||
|
||||
if (crc != Utility.getCRC (crcBuffer, crcBuffer.length, 0))
|
||||
{
|
||||
System.out.println ("***** Header CRC mismatch *****");
|
||||
throw new FileFormatException ("Header CRC failed");
|
||||
System.out.println ("***** Record CRC mismatch *****");
|
||||
throw new FileFormatException ("Record CRC failed");
|
||||
}
|
||||
|
||||
if (fileNameLength > 0)
|
||||
@ -246,6 +246,7 @@ class Record
|
||||
fileSystems[fileSystemID]));
|
||||
text.append (String.format ("Separator ...... %s%n", separator));
|
||||
text.append (String.format ("Access ......... %s %s%n", bits, decode));
|
||||
|
||||
if (storType < 16)
|
||||
{
|
||||
text.append (String.format ("File type ...... %02X %s%n", fileType,
|
||||
@ -260,6 +261,7 @@ class Record
|
||||
text.append (String.format ("Total blocks ... %,d%n", auxType));
|
||||
text.append (String.format ("Block size ..... %,d%n", storType));
|
||||
}
|
||||
|
||||
text.append (String.format ("Created ........ %s%n", created.format ()));
|
||||
text.append (String.format ("Modified ....... %s%n", modified.format ()));
|
||||
text.append (String.format ("Archived ....... %s%n", archived.format ()));
|
||||
|
@ -50,20 +50,20 @@ class Thread
|
||||
|
||||
switch (threadFormat)
|
||||
{
|
||||
case 0: // uncompressed
|
||||
case 0: // uncompressed
|
||||
break;
|
||||
case 1: // Huffman Squeeze
|
||||
case 1: // Huffman Squeeze
|
||||
break;
|
||||
case 2: // Dynamic LZW/1
|
||||
case 2: // Dynamic LZW/1
|
||||
lzw = new LZW1 (data);
|
||||
break;
|
||||
case 3: // Dynamic LZW/2
|
||||
case 3: // Dynamic LZW/2
|
||||
int crcLength = threadKind == 1 ? 0 : uncompressedEOF;
|
||||
lzw = new LZW2 (data, threadCrc, crcLength);
|
||||
break;
|
||||
case 4: // Unix 12-bit compress
|
||||
case 4: // Unix 12-bit compress
|
||||
break;
|
||||
case 5: // Unix 16-bit compress
|
||||
case 5: // Unix 16-bit compress
|
||||
break;
|
||||
}
|
||||
|
||||
@ -118,6 +118,7 @@ class Thread
|
||||
break;
|
||||
|
||||
case 1: // undefined
|
||||
break;
|
||||
case 2: // undefined
|
||||
break;
|
||||
}
|
||||
@ -223,5 +224,4 @@ class Thread
|
||||
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user