Updated to support raw file filter import and fixed a raw file export bug.

This commit is contained in:
Robert Greene 2004-06-23 03:47:12 +00:00
parent 8519134bb1
commit 3f1fa1cfb2

View File

@ -896,9 +896,12 @@ public class DiskExplorerTab {
} }
filename = fileDialog.open(); filename = fileDialog.open();
directory = fileDialog.getFilterPath(); directory = fileDialog.getFilterPath();
} else { } else if (fileFilter != null) {
filename = directory + File.separator + AppleUtil. filename = directory + File.separator + AppleUtil.
getNiceFilename(fileFilter.getSuggestedFileName(fileEntry)); getNiceFilename(fileFilter.getSuggestedFileName(fileEntry));
} else {
filename = directory + File.separator + AppleUtil.
getNiceFilename(fileEntry.getFilename());
} }
if (filename != null) { if (filename != null) {
userPreferences.setExportDirectory(directory); userPreferences.setExportDirectory(directory);
@ -1108,26 +1111,30 @@ public class DiskExplorerTab {
FileEntry fileEntry = directory.createFile(); FileEntry fileEntry = directory.createFile();
fileEntry.setFilename(spec.getTargetFilename()); fileEntry.setFilename(spec.getTargetFilename());
fileEntry.setFiletype(spec.getFiletype()); fileEntry.setFiletype(spec.getFiletype());
if (fileEntry.needsAddress()) { if (spec.isRawFileImport()) {
fileEntry.setAddress(spec.getAddress()); disks[0].setFileData(fileEntry, buffer.toByteArray());
} } else {
try { if (fileEntry.needsAddress()) {
fileEntry.setFileData(buffer.toByteArray()); fileEntry.setAddress(spec.getAddress());
} catch (ProdosDiskSizeDoesNotMatchException ex) { }
MessageBox yesNoPrompt = new MessageBox(shell, try {
SWT.ICON_QUESTION | SWT.YES | SWT.NO);
yesNoPrompt.setText("Resize disk?");
yesNoPrompt.setMessage("This disk needs to be resized to match "
+ "the formatted capacity. This should be an "
+ "ApplePC HDV disk iamge - they typically start "
+ "at 0 bytes and grow to the maximum capacity "
+ "(32MB). Resize the disk?");
int answer = yesNoPrompt.open();
if (answer == SWT.YES) {
ProdosFormatDisk prodosDisk = (ProdosFormatDisk)
fileEntry.getFormattedDisk();
prodosDisk.resizeDiskImage();
fileEntry.setFileData(buffer.toByteArray()); fileEntry.setFileData(buffer.toByteArray());
} catch (ProdosDiskSizeDoesNotMatchException ex) {
MessageBox yesNoPrompt = new MessageBox(shell,
SWT.ICON_QUESTION | SWT.YES | SWT.NO);
yesNoPrompt.setText("Resize disk?");
yesNoPrompt.setMessage("This disk needs to be resized to match "
+ "the formatted capacity. This should be an "
+ "ApplePC HDV disk iamge - they typically start "
+ "at 0 bytes and grow to the maximum capacity "
+ "(32MB). Resize the disk?");
int answer = yesNoPrompt.open();
if (answer == SWT.YES) {
ProdosFormatDisk prodosDisk = (ProdosFormatDisk)
fileEntry.getFormattedDisk();
prodosDisk.resizeDiskImage();
fileEntry.setFileData(buffer.toByteArray());
}
} }
} }
} }