mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2025-02-16 08:31:56 +00:00
new disk list image
This commit is contained in:
parent
9dddd2be3e
commit
b45e7d7e54
Binary file not shown.
Before Width: | Height: | Size: 784 KiB After Width: | Height: | Size: 1.1 MiB |
@ -120,7 +120,7 @@ public class DisksWindow extends JFrame
|
||||
}
|
||||
});
|
||||
|
||||
scrollPane.setPreferredSize (new Dimension (1200, 700));
|
||||
scrollPane.setPreferredSize (new Dimension (1200, 693));
|
||||
setDefaultCloseOperation (HIDE_ON_CLOSE);
|
||||
|
||||
deleteWindow = new DeleteWindow (rootFolderData);
|
||||
|
@ -43,55 +43,26 @@ public abstract class AbstractSaveAction extends DefaultAction
|
||||
void saveBuffer (byte[] buffer)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
if (fileChooser.showSaveDialog (null) == JFileChooser.APPROVE_OPTION)
|
||||
if (fileChooser.showSaveDialog (null) != JFileChooser.APPROVE_OPTION)
|
||||
return;
|
||||
|
||||
File file = fileChooser.getSelectedFile ();
|
||||
try
|
||||
{
|
||||
File file = fileChooser.getSelectedFile ();
|
||||
try
|
||||
{
|
||||
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
|
||||
JOptionPane.showMessageDialog (null,
|
||||
String.format ("File %s saved", file.getName ()));
|
||||
}
|
||||
catch (FileAlreadyExistsException e)
|
||||
{
|
||||
JOptionPane.showMessageDialog (null,
|
||||
"File " + file.getName () + " already exists", "Failed",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace ();
|
||||
JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
|
||||
"Failed", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
Files.write (file.toPath (), buffer, StandardOpenOption.CREATE_NEW);
|
||||
JOptionPane.showMessageDialog (null,
|
||||
String.format ("File %s saved", file.getName ()));
|
||||
}
|
||||
catch (FileAlreadyExistsException e)
|
||||
{
|
||||
JOptionPane.showMessageDialog (null, "File " + file.getName () + " already exists",
|
||||
"Failed", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace ();
|
||||
JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
|
||||
"Failed", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
// void saveFile (Path sourcePath)
|
||||
// // ---------------------------------------------------------------------------------//
|
||||
// {
|
||||
// if (fileChooser.showSaveDialog (null) == JFileChooser.APPROVE_OPTION)
|
||||
// {
|
||||
// File file = fileChooser.getSelectedFile ();
|
||||
// try
|
||||
// {
|
||||
// Files.copy (sourcePath, file.toPath ());
|
||||
// JOptionPane.showMessageDialog (null,
|
||||
// String.format ("File %s saved", file.getName ()));
|
||||
// }
|
||||
// catch (FileAlreadyExistsException e)
|
||||
// {
|
||||
// JOptionPane.showMessageDialog (null,
|
||||
// "File " + file.getName () + " already exists", "Failed",
|
||||
// JOptionPane.ERROR_MESSAGE);
|
||||
// }
|
||||
// catch (IOException e)
|
||||
// {
|
||||
// e.printStackTrace ();
|
||||
// JOptionPane.showMessageDialog (null, "File failed to save - " + e.getMessage (),
|
||||
// "Failed", JOptionPane.ERROR_MESSAGE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -40,11 +40,10 @@ class SaveDiskAction extends AbstractSaveAction implements DiskSelectionListener
|
||||
String suffix = blocks <= 560 ? ".dsk" : ".hdv";
|
||||
|
||||
setSelectedFile (new File (formattedDisk.getName () + suffix));
|
||||
// saveFile (disk.getFile ().toPath ());
|
||||
saveBuffer (appleDisk.getBuffer ());
|
||||
}
|
||||
else
|
||||
System.out.println ("Not an AppleDisk");
|
||||
System.out.println ("Not an AppleDisk"); // impossible
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -34,7 +34,7 @@ public final class Utility
|
||||
public static final byte ASCII_CARET = 0x5E;
|
||||
|
||||
private static final List<String> suffixes = Arrays.asList ("po", "dsk", "do", "hdv",
|
||||
"2mg", "v2d", "d13", "sdk", "shk", "bxy", "bny", "woz", "img", "dimg");
|
||||
"2mg", "d13", "sdk", "shk", "bxy", "bny", "woz", "img", "dimg");
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
private Utility ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user