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