mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-29 11:49:29 +00:00
suppress bxy.gz and bny.gz
This commit is contained in:
parent
2bec5a83f6
commit
13f80145e7
@ -1,6 +1,10 @@
|
|||||||
package com.bytezone.diskbrowser.disk;
|
package com.bytezone.diskbrowser.disk;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
@ -151,7 +155,8 @@ public class DiskFactory
|
|||||||
long length = file.length ();
|
long length = file.length ();
|
||||||
if (length != 143360 && length != 116480)
|
if (length != 143360 && length != 116480)
|
||||||
{
|
{
|
||||||
System.out.printf ("%s: invalid file length : %,d%n", file.getName (), file.length ());
|
System.out.printf ("%s: invalid file length : %,d%n", file.getName (),
|
||||||
|
file.length ());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,9 +167,9 @@ public class DiskFactory
|
|||||||
long checksum = appleDisk.getBootChecksum ();
|
long checksum = appleDisk.getBootChecksum ();
|
||||||
|
|
||||||
if (checksum == 3176296590L || checksum == 108825457L || checksum == 1439356606L
|
if (checksum == 3176296590L || checksum == 108825457L || checksum == 1439356606L
|
||||||
|| checksum == 1550012074L || checksum == 1614602459L || checksum == 940889336L
|
|| checksum == 1550012074L || checksum == 1614602459L || checksum == 940889336L
|
||||||
|| checksum == 990032697 || checksum == 2936955085L || checksum == 1348415927L
|
|| checksum == 990032697 || checksum == 2936955085L || checksum == 1348415927L
|
||||||
|| checksum == 3340889101L || checksum == 18315788L || checksum == 993895235L)
|
|| checksum == 3340889101L || checksum == 18315788L || checksum == 993895235L)
|
||||||
{
|
{
|
||||||
disk = checkDos (file);
|
disk = checkDos (file);
|
||||||
disk2 = checkProdos (file);
|
disk2 = checkProdos (file);
|
||||||
@ -180,8 +185,8 @@ public class DiskFactory
|
|||||||
disk = new DualDosDisk (disk, disk2);
|
disk = new DualDosDisk (disk, disk2);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (checksum == 2803644711L || checksum == 3317783349L || checksum == 1728863694L
|
else if (checksum == 2803644711L || checksum == 3317783349L
|
||||||
|| checksum == 198094178L)
|
|| checksum == 1728863694L || checksum == 198094178L)
|
||||||
disk = checkPascalDisk (file);
|
disk = checkPascalDisk (file);
|
||||||
|
|
||||||
else if (checksum == 3028642627L || checksum == 2070151659L)
|
else if (checksum == 3028642627L || checksum == 2070151659L)
|
||||||
@ -244,7 +249,7 @@ public class DiskFactory
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
System.out.println ("Factory creating disk : "
|
System.out.println ("Factory creating disk : "
|
||||||
+ disk.getDisk ().getFile ().getAbsolutePath ());
|
+ disk.getDisk ().getFile ().getAbsolutePath ());
|
||||||
|
|
||||||
if (disk != null && compressed)
|
if (disk != null && compressed)
|
||||||
disk.setOriginalPath (p);
|
disk.setOriginalPath (p);
|
||||||
@ -333,7 +338,8 @@ public class DiskFactory
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace ();
|
// e.printStackTrace ();
|
||||||
|
System.out.println (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@ -40,8 +40,6 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
|||||||
private int gw = 8;
|
private int gw = 8;
|
||||||
private int gh = 35;
|
private int gh = 35;
|
||||||
|
|
||||||
// private boolean retina;
|
|
||||||
|
|
||||||
public DiskLayoutImage ()
|
public DiskLayoutImage ()
|
||||||
{
|
{
|
||||||
setPreferredSize (new Dimension (240 + 1, 525 + 1));
|
setPreferredSize (new Dimension (240 + 1, 525 + 1));
|
||||||
@ -50,7 +48,6 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
|||||||
setOpaque (true);
|
setOpaque (true);
|
||||||
|
|
||||||
addKeyListener (new MyKeyListener ());
|
addKeyListener (new MyKeyListener ());
|
||||||
// setFocusable (true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisk (FormattedDisk disk, LayoutDetails details)
|
public void setDisk (FormattedDisk disk, LayoutDetails details)
|
||||||
@ -84,12 +81,6 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
|||||||
repaint ();
|
repaint ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setRetina (boolean value)
|
|
||||||
// {
|
|
||||||
// retina = value;
|
|
||||||
// repaint ();
|
|
||||||
// }
|
|
||||||
|
|
||||||
void setSelection (List<DiskAddress> sectors)
|
void setSelection (List<DiskAddress> sectors)
|
||||||
{
|
{
|
||||||
selectionHandler.setSelection (sectors);
|
selectionHandler.setSelection (sectors);
|
||||||
@ -147,24 +138,23 @@ class DiskLayoutImage extends JPanel implements Scrollable, RedoListener
|
|||||||
|
|
||||||
Rectangle rect = new Rectangle (x, y, bw, bh);
|
Rectangle rect = new Rectangle (x, y, bw, bh);
|
||||||
|
|
||||||
|
int width = rect.width - (retinaTest ? 2 : 3);
|
||||||
|
int height = rect.height - (retinaTest ? 2 : 3);
|
||||||
|
int offset2 = retinaTest ? 1 : 2;
|
||||||
|
|
||||||
// draw frame
|
// draw frame
|
||||||
if (true) // this needs to draw the outside rectangle, and show less white space
|
if (true)
|
||||||
// between blocks
|
|
||||||
{
|
{
|
||||||
g.setColor (Color.GRAY);
|
g.setColor (Color.GRAY);
|
||||||
g.drawRect (rect.x, rect.y, rect.width, rect.height);
|
// g.drawRect (rect.x, rect.y, rect.width, rect.height);
|
||||||
|
g.draw (rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw coloured block
|
// draw coloured block
|
||||||
if (type.colour != Color.WHITE)
|
if (type.colour != Color.WHITE)
|
||||||
{
|
{
|
||||||
g.setColor (type.colour);
|
g.setColor (type.colour);
|
||||||
// this is weird, the retina OSX screen needs the second fillRect
|
g.fillRect (rect.x + offset2, rect.y + offset2, width, height);
|
||||||
// see also DiskLegendPanel.paint()
|
|
||||||
if (retinaTest)
|
|
||||||
g.fillRect (rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2);
|
|
||||||
else
|
|
||||||
g.fillRect (rect.x + 2, rect.y + 2, rect.width - 3, rect.height - 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw an indicator in free blocks
|
// draw an indicator in free blocks
|
||||||
|
@ -15,7 +15,6 @@ import com.bytezone.common.Platform.FontType;
|
|||||||
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
import com.bytezone.diskbrowser.disk.FormattedDisk;
|
||||||
import com.bytezone.diskbrowser.disk.SectorType;
|
import com.bytezone.diskbrowser.disk.SectorType;
|
||||||
import com.bytezone.diskbrowser.gui.DiskLayoutPanel.LayoutDetails;
|
import com.bytezone.diskbrowser.gui.DiskLayoutPanel.LayoutDetails;
|
||||||
import com.bytezone.diskbrowser.utilities.Utility;
|
|
||||||
|
|
||||||
class DiskLegendPanel extends JPanel
|
class DiskLegendPanel extends JPanel
|
||||||
{
|
{
|
||||||
@ -25,7 +24,6 @@ class DiskLegendPanel extends JPanel
|
|||||||
private FormattedDisk disk;
|
private FormattedDisk disk;
|
||||||
private LayoutDetails layoutDetails;
|
private LayoutDetails layoutDetails;
|
||||||
private final Font font;
|
private final Font font;
|
||||||
// private boolean retina;
|
|
||||||
private boolean retinaTest;
|
private boolean retinaTest;
|
||||||
|
|
||||||
public DiskLegendPanel ()
|
public DiskLegendPanel ()
|
||||||
@ -46,12 +44,6 @@ class DiskLegendPanel extends JPanel
|
|||||||
repaint ();
|
repaint ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void setRetina (boolean value)
|
|
||||||
// {
|
|
||||||
// retina = value;
|
|
||||||
// repaint ();
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension getPreferredSize ()
|
public Dimension getPreferredSize ()
|
||||||
{
|
{
|
||||||
@ -70,7 +62,9 @@ class DiskLegendPanel extends JPanel
|
|||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int lineHeight = 20;
|
int lineHeight = 20;
|
||||||
System.out.println (Utility.test ((Graphics2D) g));
|
int width = layoutDetails.block.width - (retinaTest ? 2 : 3);
|
||||||
|
int height = layoutDetails.block.height - (retinaTest ? 2 : 3);
|
||||||
|
int offset = retinaTest ? 1 : 2;
|
||||||
|
|
||||||
for (SectorType type : disk.getSectorTypeList ())
|
for (SectorType type : disk.getSectorTypeList ())
|
||||||
{
|
{
|
||||||
@ -83,12 +77,7 @@ class DiskLegendPanel extends JPanel
|
|||||||
|
|
||||||
// draw the colour
|
// draw the colour
|
||||||
g.setColor (type.colour);
|
g.setColor (type.colour);
|
||||||
if (retinaTest)
|
g.fillRect (x + offset, y + offset, width, height);
|
||||||
g.fillRect (x + 1, y + 1, layoutDetails.block.width - 2,
|
|
||||||
layoutDetails.block.height - 2);
|
|
||||||
else
|
|
||||||
g.fillRect (x + 2, y + 2, layoutDetails.block.width - 3,
|
|
||||||
layoutDetails.block.height - 3);
|
|
||||||
|
|
||||||
// draw the text
|
// draw the text
|
||||||
g.setColor (Color.BLACK);
|
g.setColor (Color.BLACK);
|
||||||
|
@ -45,8 +45,6 @@ public class TreeBuilder
|
|||||||
assert (folder.exists ());
|
assert (folder.exists ());
|
||||||
assert (folder.isDirectory ());
|
assert (folder.isDirectory ());
|
||||||
|
|
||||||
// long start = System.currentTimeMillis ();
|
|
||||||
|
|
||||||
FileNode fn = new FileNode (folder);
|
FileNode fn = new FileNode (folder);
|
||||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode (fn);
|
DefaultMutableTreeNode root = new DefaultMutableTreeNode (fn);
|
||||||
fn.setTreeNode (root);
|
fn.setTreeNode (root);
|
||||||
@ -54,14 +52,7 @@ public class TreeBuilder
|
|||||||
DefaultTreeModel treeModel = new DefaultTreeModel (root);
|
DefaultTreeModel treeModel = new DefaultTreeModel (root);
|
||||||
tree = new JTree (treeModel);
|
tree = new JTree (treeModel);
|
||||||
|
|
||||||
// long duration = System.currentTimeMillis () - start;
|
treeModel.setAsksAllowsChildren (true); // allows empty nodes to appear as folders
|
||||||
// System.out.printf (
|
|
||||||
// "Tree building took %,d milliseconds for "
|
|
||||||
// + "%,d disk%s and %,d folder%s%n",
|
|
||||||
// duration, totalDisks, (totalDisks == 1 ? "" : "s"), totalFolders,
|
|
||||||
// (totalFolders == 1 ? "" : "s"));
|
|
||||||
|
|
||||||
treeModel.setAsksAllowsChildren (true);// allows empty nodes to appear as folders
|
|
||||||
setDiskIcon ("/com/bytezone/diskbrowser/icons/disk.png");
|
setDiskIcon ("/com/bytezone/diskbrowser/icons/disk.png");
|
||||||
((FileNode) root.getUserObject ()).disks = totalDisks;
|
((FileNode) root.getUserObject ()).disks = totalDisks;
|
||||||
|
|
||||||
@ -104,7 +95,7 @@ public class TreeBuilder
|
|||||||
totalFolders++;
|
totalFolders++;
|
||||||
|
|
||||||
if (FULL_TREE)
|
if (FULL_TREE)
|
||||||
addFiles (newNode, file);// recursion!
|
addFiles (newNode, file); // recursion!
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +135,7 @@ public class TreeBuilder
|
|||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
checkDuplicates (file);
|
checkDuplicates (file);
|
||||||
|
|
||||||
totalDisks++;
|
totalDisks++;
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
@ -196,6 +188,15 @@ public class TreeBuilder
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
String suffix = filename.substring (dotPos + 1).toLowerCase ();
|
String suffix = filename.substring (dotPos + 1).toLowerCase ();
|
||||||
|
|
||||||
|
int dotPos2 = filename.lastIndexOf ('.', dotPos - 1);
|
||||||
|
if (dotPos2 > 0)
|
||||||
|
{
|
||||||
|
String suffix2 = filename.substring (dotPos2 + 1, dotPos).toLowerCase ();
|
||||||
|
if (suffix.equals ("gz") && (suffix2.equals ("bxy") || suffix2.equals ("bny")))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return suffixes.contains (suffix);
|
return suffixes.contains (suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user