removed GregorianCalendar from prodos
This commit is contained in:
parent
1c9cbc4942
commit
49fa2903fc
|
@ -1,7 +1,7 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AppleFileSource;
|
||||
|
@ -9,6 +9,7 @@ import com.bytezone.diskbrowser.disk.Disk;
|
|||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
abstract class CatalogEntry implements AppleFileSource
|
||||
|
@ -18,7 +19,7 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
DirectoryHeader parentDirectory;
|
||||
String name;
|
||||
int storageType;
|
||||
GregorianCalendar created;
|
||||
LocalDateTime created;
|
||||
int version;
|
||||
int minVersion;
|
||||
int access;
|
||||
|
@ -33,7 +34,7 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
this.disk = parentDisk.getDisk ();
|
||||
name = HexFormatter.getString (entryBuffer, 1, entryBuffer[0] & 0x0F);
|
||||
storageType = (entryBuffer[0] & 0xF0) >> 4;
|
||||
created = HexFormatter.getAppleDate (entryBuffer, 24);
|
||||
created = Utility.getAppleDate (entryBuffer, 24);
|
||||
version = entryBuffer[28] & 0xFF;
|
||||
minVersion = entryBuffer[29] & 0xFF;
|
||||
access = entryBuffer[30] & 0xFF;
|
||||
|
@ -78,7 +79,7 @@ abstract class CatalogEntry implements AppleFileSource
|
|||
text.append (String.format ("Name .......... %s%n", name));
|
||||
text.append (String.format ("Storage type... %02X%n", storageType));
|
||||
text.append (String.format ("Created ....... %s%n",
|
||||
created == null ? "" : parentDisk.df.format (created.getTime ())));
|
||||
created == null ? "" : created.format (ProdosDisk.df)));
|
||||
text.append (String.format ("Version ....... %d%n", version));
|
||||
|
||||
return text.toString ();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.ApplesoftBasicProgram;
|
||||
|
@ -41,7 +41,6 @@ import com.bytezone.diskbrowser.appleworks.AppleworksSSFile;
|
|||
import com.bytezone.diskbrowser.appleworks.AppleworksWPFile;
|
||||
import com.bytezone.diskbrowser.disk.DiskAddress;
|
||||
import com.bytezone.diskbrowser.gui.DataSource;
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;
|
||||
|
||||
// - Set sector types for each used sector
|
||||
|
@ -57,7 +56,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||
private final int blocksUsed;
|
||||
private final int endOfFile;
|
||||
private final int auxType;
|
||||
private final GregorianCalendar modified;
|
||||
private final LocalDateTime modified;
|
||||
private final int headerPointer;
|
||||
private DataSource file;
|
||||
private final DiskAddress catalogBlock;
|
||||
|
@ -85,7 +84,7 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||
endOfFile = Utility.intValue (entryBuffer[21], entryBuffer[22], entryBuffer[23]);
|
||||
|
||||
auxType = Utility.unsignedShort (entryBuffer, 0x1F);
|
||||
modified = HexFormatter.getAppleDate (entryBuffer, 0x21);
|
||||
modified = Utility.getAppleDate (entryBuffer, 0x21);
|
||||
headerPointer = Utility.unsignedShort (entryBuffer, 0x25);
|
||||
|
||||
switch (storageType)
|
||||
|
@ -781,8 +780,8 @@ class FileEntry extends CatalogEntry implements ProdosConstants
|
|||
return String.format ("%s %03d %s", ProdosConstants.fileTypes[fileType],
|
||||
blocksUsed, locked) + name;
|
||||
|
||||
String timeC = created == null ? "" : parentDisk.df.format (created.getTime ());
|
||||
String timeF = modified == null ? "" : parentDisk.df.format (modified.getTime ());
|
||||
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,
|
||||
|
|
|
@ -11,7 +11,7 @@ import static com.bytezone.diskbrowser.prodos.ProdosConstants.SUBDIRECTORY_HEADE
|
|||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.TREE;
|
||||
import static com.bytezone.diskbrowser.prodos.ProdosConstants.VOLUME_HEADER;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.bytezone.diskbrowser.disk.AbstractSector;
|
||||
import com.bytezone.diskbrowser.disk.Disk;
|
||||
|
@ -105,17 +105,21 @@ class ProdosCatalogSector extends AbstractSector
|
|||
addTextAndDecimal (text, buffer, offset + 17, 2, "Key pointer");
|
||||
addTextAndDecimal (text, buffer, offset + 19, 2, "Blocks used");
|
||||
addTextAndDecimal (text, buffer, offset + 21, 3, "EOF");
|
||||
GregorianCalendar created = HexFormatter.getAppleDate (buffer, offset + 24);
|
||||
String dateC = created == null ? "" : parent.df.format (created.getTime ());
|
||||
|
||||
LocalDateTime created = Utility.getAppleDate (buffer, offset + 24);
|
||||
String dateC = created == null ? "" : created.format (ProdosDisk.df);
|
||||
addText (text, buffer, offset + 24, 4, "Creation date : " + dateC);
|
||||
|
||||
addTextAndDecimal (text, buffer, offset + 28, 1, "Version");
|
||||
addText (text, buffer, offset + 29, 1, "Minimum version");
|
||||
addText (text, buffer, offset + 30, 1, "Access");
|
||||
addTextAndDecimal (text, buffer, offset + 31, 2,
|
||||
"Auxilliary type - " + getAuxilliaryText (fileType, auxType));
|
||||
GregorianCalendar modified = HexFormatter.getAppleDate (buffer, offset + 33);
|
||||
String dateM = modified == null ? "" : parent.df.format (modified.getTime ());
|
||||
|
||||
LocalDateTime modified = Utility.getAppleDate (buffer, offset + 33);
|
||||
String dateM = modified == null ? "" : modified.format (ProdosDisk.df);
|
||||
addText (text, buffer, offset + 33, 4, "Modification date : " + dateM);
|
||||
|
||||
addTextAndDecimal (text, buffer, offset + 37, 2, "Header pointer");
|
||||
return text.toString ();
|
||||
}
|
||||
|
@ -157,8 +161,8 @@ class ProdosCatalogSector extends AbstractSector
|
|||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
addText (text, buffer, offset + 20, 4, "Not used");
|
||||
GregorianCalendar created = HexFormatter.getAppleDate (buffer, offset + 24);
|
||||
String dateC = created == null ? "" : parent.df.format (created.getTime ());
|
||||
LocalDateTime created = Utility.getAppleDate (buffer, offset + 24);
|
||||
String dateC = created == null ? "" : created.format (ProdosDisk.df);
|
||||
addText (text, buffer, offset + 24, 4, "Creation date : " + dateC);
|
||||
|
||||
addText (text, buffer, offset + 28, 1, "Prodos version");
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.bytezone.diskbrowser.applefile.AbstractFile;
|
||||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||
|
@ -15,8 +14,6 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
|
|||
private static final String NO_DATE = "<NO DATE>";
|
||||
private static final String newLine = String.format ("%n");
|
||||
private static final String newLine2 = newLine + newLine;
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat ("d-MMM-yy");
|
||||
private static final SimpleDateFormat stf = new SimpleDateFormat ("H:mm");
|
||||
|
||||
private final ProdosDisk parentFD;
|
||||
private final int totalBlocks;
|
||||
|
@ -74,14 +71,17 @@ class ProdosDirectory extends AbstractFile implements ProdosConstants
|
|||
int type = buffer[i + 16] & 0xFF;
|
||||
int blocks = Utility.intValue (buffer[i + 19], buffer[i + 20]);
|
||||
|
||||
GregorianCalendar created = HexFormatter.getAppleDate (buffer, i + 24);
|
||||
String dateC = created == null ? NO_DATE
|
||||
: sdf.format (created.getTime ()).toUpperCase ().replace (".", "");
|
||||
String timeC = created == null ? "" : stf.format (created.getTime ());
|
||||
GregorianCalendar modified = HexFormatter.getAppleDate (buffer, i + 33);
|
||||
String dateM = modified == null ? NO_DATE
|
||||
: sdf.format (modified.getTime ()).toUpperCase ().replace (".", "");
|
||||
String timeM = modified == null ? "" : stf.format (modified.getTime ());
|
||||
LocalDateTime createdDate = Utility.getAppleDate (buffer, i + 24);
|
||||
LocalDateTime modifiedDate = Utility.getAppleDate (buffer, i + 33);
|
||||
|
||||
String dateC = createdDate == null ? NO_DATE
|
||||
: createdDate.format (ProdosDisk.df).toUpperCase ();
|
||||
String dateM = modifiedDate == null ? NO_DATE
|
||||
: modifiedDate.format (ProdosDisk.df).toUpperCase ();
|
||||
|
||||
String timeC = createdDate == null ? "" : createdDate.format (ProdosDisk.tf);
|
||||
String timeM = modifiedDate == null ? "" : modifiedDate.format (ProdosDisk.tf);
|
||||
|
||||
int eof = Utility.intValue (buffer[i + 21], buffer[i + 22], buffer[i + 23]);
|
||||
int fileType = buffer[i + 16] & 0xFF;
|
||||
locked = (buffer[i + 30] & 0xE0) == 0xE0 ? " " : "*";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.bytezone.diskbrowser.prodos;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.text.DateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -29,7 +29,9 @@ public class ProdosDisk extends AbstractFormattedDisk
|
|||
{
|
||||
static ProdosPreferences prodosPreferences; // set by MenuHandler
|
||||
|
||||
final DateFormat df = DateFormat.getInstance ();
|
||||
// final DateFormat df = DateFormat.getInstance ();
|
||||
static final DateTimeFormatter df = DateTimeFormatter.ofPattern ("d-LLL-yy");
|
||||
static final DateTimeFormatter tf = DateTimeFormatter.ofPattern ("H:mm");
|
||||
|
||||
final SectorType dosSector = new SectorType ("Bootstrap Loader", Color.lightGray);
|
||||
final SectorType catalogSector = new SectorType ("Catalog", new Color (0, 200, 0));
|
||||
|
@ -338,7 +340,7 @@ public class ProdosDisk extends AbstractFormattedDisk
|
|||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
String timeC = volumeDirectoryHeader.created == null ? ""
|
||||
: df.format (volumeDirectoryHeader.created.getTime ());
|
||||
: volumeDirectoryHeader.created.format (tf);
|
||||
|
||||
text.append (String.format ("Disk name : %s%n", getDisplayPath ()));
|
||||
text.append (String.format ("Volume name : %s%n", volumeDirectoryHeader.name));
|
||||
|
|
|
@ -53,6 +53,6 @@ class SubDirectoryHeader extends DirectoryHeader
|
|||
{
|
||||
String locked = (access == 0x01) ? "*" : " ";
|
||||
return String.format (" %s%-40s %15s", locked, "/" + name,
|
||||
parentDisk.df.format (created.getTime ()));
|
||||
created.format (ProdosDisk.df));
|
||||
}
|
||||
}
|
|
@ -126,7 +126,7 @@ class VolumeDirectoryHeader extends DirectoryHeader
|
|||
if (false)
|
||||
{
|
||||
String locked = (access == 0x01) ? "*" : " ";
|
||||
String timeC = created == null ? "" : parentDisk.df.format (created.getTime ());
|
||||
String timeC = created == null ? "" : created.format (ProdosDisk.df);
|
||||
return String.format (" %s%-42s %15s", locked, "/" + name, timeC);
|
||||
}
|
||||
return name;
|
||||
|
|
|
@ -389,25 +389,25 @@ public class HexFormatter
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static GregorianCalendar getAppleDate (byte[] buffer, int offset)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int date = Utility.intValue (buffer[offset], buffer[offset + 1]);
|
||||
if (date > 0)
|
||||
{
|
||||
int year = (date & 0xFE00) >> 9;
|
||||
int month = (date & 0x01E0) >> 5;
|
||||
int day = date & 0x001F;
|
||||
int hour = buffer[offset + 3] & 0x1F;
|
||||
int minute = buffer[offset + 2] & 0x3F;
|
||||
if (year < 70)
|
||||
year += 2000;
|
||||
else
|
||||
year += 1900;
|
||||
return new GregorianCalendar (year, month - 1, day, hour, minute);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// public static GregorianCalendar getAppleDate (byte[] buffer, int offset)
|
||||
// // ---------------------------------------------------------------------------------//
|
||||
// {
|
||||
// int date = Utility.intValue (buffer[offset], buffer[offset + 1]);
|
||||
// if (date > 0)
|
||||
// {
|
||||
// int year = (date & 0xFE00) >> 9;
|
||||
// int month = (date & 0x01E0) >> 5;
|
||||
// int day = date & 0x001F;
|
||||
// int hour = buffer[offset + 3] & 0x1F;
|
||||
// int minute = buffer[offset + 2] & 0x3F;
|
||||
// if (year < 70)
|
||||
// year += 2000;
|
||||
// else
|
||||
// year += 1900;
|
||||
// return new GregorianCalendar (year, month - 1, day, hour, minute);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public static GregorianCalendar getPascalDate (byte[] buffer, int offset)
|
||||
|
|
|
@ -15,7 +15,7 @@ class LZW
|
|||
protected byte runLengthChar;
|
||||
protected int crc;
|
||||
protected int crcBase;
|
||||
int v3eof;
|
||||
int v3eof; // LZW/2 calculates the crc sans padding
|
||||
|
||||
private int buffer; // one character buffer
|
||||
private int bitsLeft; // unused bits left in buffer
|
||||
|
|
Loading…
Reference in New Issue