mirror of
https://github.com/AppleCommander/AppleCommander.git
synced 2024-06-12 17:32:20 +00:00
Compare commits
5 Commits
57469a57fd
...
c46bead159
Author | SHA1 | Date | |
---|---|---|---|
|
c46bead159 | ||
|
5cd97c6d35 | ||
|
a375e25c66 | ||
|
1c86c39ed2 | ||
|
6fd492e5d0 |
|
@ -19,16 +19,14 @@
|
||||||
*/
|
*/
|
||||||
package io.github.applecommander.acx.command;
|
package io.github.applecommander.acx.command;
|
||||||
|
|
||||||
import java.util.List;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
import java.util.logging.Logger;
|
import com.webcodepro.applecommander.storage.Disk;
|
||||||
import java.util.stream.Collectors;
|
import com.webcodepro.applecommander.storage.DiskException;
|
||||||
|
import com.webcodepro.applecommander.storage.FileEntry;
|
||||||
import com.webcodepro.applecommander.storage.*;
|
|
||||||
import com.webcodepro.applecommander.util.Name;
|
import com.webcodepro.applecommander.util.Name;
|
||||||
import com.webcodepro.applecommander.util.filestreamer.FileStreamer;
|
import com.webcodepro.applecommander.util.filestreamer.FileStreamer;
|
||||||
import com.webcodepro.applecommander.util.filestreamer.FileTuple;
|
import com.webcodepro.applecommander.util.filestreamer.FileTuple;
|
||||||
import com.webcodepro.applecommander.util.filestreamer.TypeOfFile;
|
import com.webcodepro.applecommander.util.filestreamer.TypeOfFile;
|
||||||
|
|
||||||
import io.github.applecommander.acx.base.ReadWriteDiskCommandOptions;
|
import io.github.applecommander.acx.base.ReadWriteDiskCommandOptions;
|
||||||
import io.github.applecommander.acx.converter.DiskConverter;
|
import io.github.applecommander.acx.converter.DiskConverter;
|
||||||
import io.github.applecommander.acx.fileutil.FileUtils;
|
import io.github.applecommander.acx.fileutil.FileUtils;
|
||||||
|
@ -36,6 +34,10 @@ import picocli.CommandLine.Command;
|
||||||
import picocli.CommandLine.Option;
|
import picocli.CommandLine.Option;
|
||||||
import picocli.CommandLine.Parameters;
|
import picocli.CommandLine.Parameters;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Command(name = "copy", description = "Copy files between disks.",
|
@Command(name = "copy", description = "Copy files between disks.",
|
||||||
aliases = { "cp" })
|
aliases = { "cp" })
|
||||||
public class CopyFileCommand extends ReadWriteDiskCommandOptions {
|
public class CopyFileCommand extends ReadWriteDiskCommandOptions {
|
||||||
|
@ -63,7 +65,7 @@ public class CopyFileCommand extends ReadWriteDiskCommandOptions {
|
||||||
List<FileTuple> files = FileStreamer.forDisk(sourceDisk)
|
List<FileTuple> files = FileStreamer.forDisk(sourceDisk)
|
||||||
.ignoreErrors(true)
|
.ignoreErrors(true)
|
||||||
.includeTypeOfFile(TypeOfFile.BOTH)
|
.includeTypeOfFile(TypeOfFile.BOTH)
|
||||||
.recursive(recursiveFlag)
|
.recursive(false) // we handle recursion in the FileUtils
|
||||||
.matchGlobs(globs)
|
.matchGlobs(globs)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -19,17 +19,16 @@
|
||||||
*/
|
*/
|
||||||
package io.github.applecommander.acx.fileutil;
|
package io.github.applecommander.acx.fileutil;
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
import com.webcodepro.applecommander.storage.DiskException;
|
import com.webcodepro.applecommander.storage.DiskException;
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
import com.webcodepro.applecommander.storage.FileEntry;
|
||||||
import com.webcodepro.applecommander.util.readerwriter.FileEntryReader;
|
import com.webcodepro.applecommander.util.readerwriter.FileEntryReader;
|
||||||
import com.webcodepro.applecommander.util.readerwriter.FileEntryWriter;
|
import com.webcodepro.applecommander.util.readerwriter.FileEntryWriter;
|
||||||
|
|
||||||
import io.github.applecommander.acx.command.CopyFileCommand;
|
import io.github.applecommander.acx.command.CopyFileCommand;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class FileUtils {
|
public class FileUtils {
|
||||||
private static Logger LOG = Logger.getLogger(CopyFileCommand.class.getName());
|
private static Logger LOG = Logger.getLogger(CopyFileCommand.class.getName());
|
||||||
|
|
||||||
|
@ -40,7 +39,7 @@ public class FileUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void copy(DirectoryEntry directory, FileEntry file) throws DiskException {
|
public void copy(DirectoryEntry directory, FileEntry file) throws DiskException {
|
||||||
LOG.fine(() -> String.format("Copying '%s'", file.getFilename()));
|
LOG.fine(() -> String.format("Copying '%s' into directory '%s'", file.getFilename(), directory.getDirname()));
|
||||||
if (file.isDeleted()) {
|
if (file.isDeleted()) {
|
||||||
// Skip deleted files
|
// Skip deleted files
|
||||||
}
|
}
|
||||||
|
@ -112,13 +111,15 @@ public class FileUtils {
|
||||||
source.getBinaryAddress().ifPresent(target::setBinaryAddress);
|
source.getBinaryAddress().ifPresent(target::setBinaryAddress);
|
||||||
source.getBinaryLength().ifPresent(target::setBinaryLength);
|
source.getBinaryLength().ifPresent(target::setBinaryLength);
|
||||||
source.getAuxiliaryType().ifPresent(target::setAuxiliaryType);
|
source.getAuxiliaryType().ifPresent(target::setAuxiliaryType);
|
||||||
source.getCreationDate().ifPresent(target::setCreationDate);
|
source.getCreationDate().ifPresent(target::setCreationDate);
|
||||||
source.getLastModificationDate().ifPresent(target::setLastModificationDate);
|
|
||||||
|
|
||||||
if (source.getFileData().isPresent() && source.getResourceData().isPresent()) {
|
if (source.getFileData().isPresent() && source.getResourceData().isPresent()) {
|
||||||
target.setFileData(source.getFileData().get(), source.getResourceData().get());
|
target.setFileData(source.getFileData().get(), source.getResourceData().get());
|
||||||
} else {
|
} else {
|
||||||
source.getFileData().ifPresent(target::setFileData);
|
source.getFileData().ifPresent(target::setFileData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Modification date needs to be done last since writing file data/attributes are likely to change it
|
||||||
|
source.getLastModificationDate().ifPresent(target::setLastModificationDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,11 @@ asVersion=1.2.1
|
||||||
btVersion=0.3.1
|
btVersion=0.3.1
|
||||||
swtVersion=3.123.0
|
swtVersion=3.123.0
|
||||||
piSwtVersion=3.8.2
|
piSwtVersion=3.8.2
|
||||||
junitVersion=4.12
|
junitVersion=4.13.1
|
||||||
antVersion=1.8.2
|
antVersion=1.9.16
|
||||||
commonsLang3Version=3.7
|
commonsLang3Version=3.7
|
||||||
commonsCsvVersion=1.8
|
commonsCsvVersion=1.8
|
||||||
gsonVersion=2.8.6
|
gsonVersion=2.8.9
|
||||||
picocliVersion=4.6.2
|
picocliVersion=4.6.2
|
||||||
springBoot=2.6.1
|
springBoot=3.1.0
|
||||||
acdasmVersion=0.4.0
|
acdasmVersion=0.4.0
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
25
gradlew
vendored
25
gradlew
vendored
|
@ -55,7 +55,7 @@
|
||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
@ -80,13 +80,10 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -143,12 +140,16 @@ fi
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command;
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
@ -205,6 +210,12 @@ set -- \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|
15
gradlew.bat
vendored
15
gradlew.bat
vendored
|
@ -14,7 +14,7 @@
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
|
@ -41,12 +41,12 @@ javadoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
archiveClassifier = 'javadoc'
|
||||||
from javadoc
|
from javadoc
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
classifier = 'sources'
|
archiveClassifier = 'sources'
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,11 @@ import java.util.List;
|
||||||
* @author Lisias Toledo
|
* @author Lisias Toledo
|
||||||
*/
|
*/
|
||||||
public interface DirectoryEntry {
|
public interface DirectoryEntry {
|
||||||
|
/**
|
||||||
|
* Return a name for this directory.
|
||||||
|
*/
|
||||||
|
public String getDirname();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of files in this directory.
|
* Retrieve the list of files in this directory.
|
||||||
* Note that if this is not a directory, the return
|
* Note that if this is not a directory, the return
|
||||||
|
|
|
@ -19,14 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage;
|
package com.webcodepro.applecommander.storage;
|
||||||
|
|
||||||
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract representation of a formatted Apple2 disk (floppy, 800k, hard disk).
|
* Abstract representation of a formatted Apple2 disk (floppy, 800k, hard disk).
|
||||||
|
@ -140,6 +141,13 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
||||||
*/
|
*/
|
||||||
public abstract String getDiskName();
|
public abstract String getDiskName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a name for this directory.
|
||||||
|
*/
|
||||||
|
public String getDirname(){
|
||||||
|
return getDiskName();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the name of the disk to volumeName.
|
* Set the name of the disk to volumeName.
|
||||||
*/
|
*/
|
||||||
|
@ -404,4 +412,15 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
|
||||||
* Gives an indication on how this disk's geometry should be handled.
|
* Gives an indication on how this disk's geometry should be handled.
|
||||||
*/
|
*/
|
||||||
public abstract DiskGeometry getDiskGeometry();
|
public abstract DiskGeometry getDiskGeometry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
public abstract String fromProdosFiletype(String prodosFiletype);
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
public abstract String toProdosFiletype(String nativeFiletype);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.cpm;
|
package com.webcodepro.applecommander.storage.os.cpm;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in the Apple CP/M format.
|
* Manages a disk that is in the Apple CP/M format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -565,4 +556,29 @@ public class CpmFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.TRACK_SECTOR;
|
return DiskGeometry.TRACK_SECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
if ("TXT".equalsIgnoreCase(prodosFiletype)) {
|
||||||
|
return "TXT";
|
||||||
|
}
|
||||||
|
return "BIN";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
for (String textFiletype : CpmFileEntry.TEXT_FILETYPES) {
|
||||||
|
if (textFiletype.equalsIgnoreCase(nativeFiletype)) {
|
||||||
|
return "TXT";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "BIN";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,23 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.dos33;
|
package com.webcodepro.applecommander.storage.os.dos33;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskCorruptException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in Apple DOS 3.3 format.
|
* Manages a disk that is in Apple DOS 3.3 format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -70,11 +60,20 @@ public class DosFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* The list of filetypes available.
|
* The list of filetypes available.
|
||||||
*/
|
*/
|
||||||
private static final String[] filetypes = {
|
private static final String[] FILE_TYPES = {
|
||||||
"T", "A", "I", "B", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
"T", "A", "I", "B",
|
||||||
"S", "R", "a", "b" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
"S", "R", "a", "b"
|
||||||
};
|
};
|
||||||
|
private static final Map<String,String> FILE_TYPE_MAPPING = Map.of(
|
||||||
|
"T", "TXT",
|
||||||
|
"I", "INT",
|
||||||
|
"A", "BAS",
|
||||||
|
"B", "BIN",
|
||||||
|
"S", "$F1",
|
||||||
|
"R", "REL",
|
||||||
|
"a", "$F2",
|
||||||
|
"b", "$F3"
|
||||||
|
);
|
||||||
/**
|
/**
|
||||||
* Use this inner interface for managing the disk usage data.
|
* Use this inner interface for managing the disk usage data.
|
||||||
* This off-loads format-specific implementation to the implementing class.
|
* This off-loads format-specific implementation to the implementing class.
|
||||||
|
@ -739,7 +738,7 @@ public class DosFormatDisk extends FormattedDisk {
|
||||||
* specific to each operating system, a simple String is used.
|
* specific to each operating system, a simple String is used.
|
||||||
*/
|
*/
|
||||||
public String[] getFiletypes() {
|
public String[] getFiletypes() {
|
||||||
return filetypes;
|
return FILE_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -781,4 +780,26 @@ public class DosFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.TRACK_SECTOR;
|
return DiskGeometry.TRACK_SECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return FILE_TYPE_MAPPING.entrySet()
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.getValue().equals(prodosFiletype))
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.findFirst()
|
||||||
|
.orElse("B");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return FILE_TYPE_MAPPING.getOrDefault(nativeFiletype, "BIN");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,14 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.gutenberg;
|
package com.webcodepro.applecommander.storage.os.gutenberg;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in Gutenberg Word Processor format.
|
* Manages a disk that is in Gutenberg Word Processor format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -707,4 +702,21 @@ public class GutenbergFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.TRACK_SECTOR;
|
return DiskGeometry.TRACK_SECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return "T";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return "TXT";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,19 +19,14 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.nakedos;
|
package com.webcodepro.applecommander.storage.os.nakedos;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in NakedOS format.
|
* Manages a disk that is in NakedOS format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -545,4 +540,21 @@ public class NakedosFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.TRACK_SECTOR;
|
return DiskGeometry.TRACK_SECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return "B";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return "BIN";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,21 +21,13 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.pascal;
|
package com.webcodepro.applecommander.storage.os.pascal;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in the Pascal format.
|
* Manages a disk that is in the Pascal format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -58,15 +50,31 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* The known filetypes for a Pascal disk.
|
* The known filetypes for a Pascal disk.
|
||||||
*/
|
*/
|
||||||
private static final String[] filetypes = {
|
private static final String[] FILE_TYPES = {
|
||||||
"xdskfile", //$NON-NLS-1$
|
"xdskfile",
|
||||||
CODEFILE,
|
CODEFILE,
|
||||||
TEXTFILE,
|
TEXTFILE,
|
||||||
"INFO", //$NON-NLS-1$
|
"INFO",
|
||||||
DATAFILE,
|
DATAFILE,
|
||||||
"GRAF", //$NON-NLS-1$
|
"GRAF",
|
||||||
"FOTO", //$NON-NLS-1$
|
"FOTO",
|
||||||
"securedir" }; //$NON-NLS-1$
|
"securedir"
|
||||||
|
};
|
||||||
|
private static final Map<String,String> FILE_TYPE_MAP = Map.of(
|
||||||
|
// Pascal => Prodos
|
||||||
|
"xdskfile", "BAD",
|
||||||
|
CODEFILE, "BIN",
|
||||||
|
TEXTFILE, "TXT",
|
||||||
|
"INFO", "TXT",
|
||||||
|
DATAFILE, "BIN",
|
||||||
|
"GRAF", "BIN",
|
||||||
|
"FOTO", "BIN",
|
||||||
|
"securedir", "BIN",
|
||||||
|
|
||||||
|
// Prodos => Pascal
|
||||||
|
"BIN", DATAFILE,
|
||||||
|
"TXT", TEXTFILE
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this inner interface for managing the disk usage data.
|
* Use this inner interface for managing the disk usage data.
|
||||||
|
@ -624,7 +632,7 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
* specific to each operating system, a simple String is used.
|
* specific to each operating system, a simple String is used.
|
||||||
*/
|
*/
|
||||||
public String[] getFiletypes() {
|
public String[] getFiletypes() {
|
||||||
return filetypes;
|
return FILE_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -675,4 +683,21 @@ public class PascalFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.BLOCK;
|
return DiskGeometry.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return FILE_TYPE_MAP.getOrDefault(prodosFiletype, DATAFILE);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return FILE_TYPE_MAP.getOrDefault(nativeFiletype, "BIN");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.prodos;
|
package com.webcodepro.applecommander.storage.os.prodos;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
||||||
import com.webcodepro.applecommander.storage.DiskException;
|
import com.webcodepro.applecommander.storage.DiskException;
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
import com.webcodepro.applecommander.storage.FileEntry;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement directory functionality.
|
* Implement directory functionality.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -55,6 +55,13 @@ public class ProdosDirectoryEntry extends ProdosFileEntry implements DirectoryEn
|
||||||
return this.subdirectoryHeader;
|
return this.subdirectoryHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a name for this directory.
|
||||||
|
*/
|
||||||
|
public String getDirname(){
|
||||||
|
return getFilename();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of files in this directory.
|
* Retrieve the list of files in this directory.
|
||||||
* Note that if this is not a directory, the return
|
* Note that if this is not a directory, the return
|
||||||
|
|
|
@ -19,27 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.prodos;
|
package com.webcodepro.applecommander.storage.os.prodos;
|
||||||
|
|
||||||
import java.io.IOException;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskCorruptException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in the ProDOS format.
|
* Manages a disk that is in the ProDOS format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -1469,4 +1457,21 @@ public class ProdosFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.BLOCK;
|
return DiskGeometry.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return prodosFiletype;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return nativeFiletype;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,21 +19,17 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.storage.os.rdos;
|
package com.webcodepro.applecommander.storage.os.rdos;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.webcodepro.applecommander.storage.*;
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DirectoryEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
|
||||||
import com.webcodepro.applecommander.storage.DiskGeometry;
|
|
||||||
import com.webcodepro.applecommander.storage.FileEntry;
|
|
||||||
import com.webcodepro.applecommander.storage.FormattedDisk;
|
|
||||||
import com.webcodepro.applecommander.storage.StorageBundle;
|
|
||||||
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
import com.webcodepro.applecommander.storage.physical.ImageOrder;
|
||||||
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
|
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
import com.webcodepro.applecommander.util.TextBundle;
|
import com.webcodepro.applecommander.util.TextBundle;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.BitSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages a disk that is in the RDOS format.
|
* Manages a disk that is in the RDOS format.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -79,7 +75,12 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
/**
|
/**
|
||||||
* The known filetypes for a RDOS disk.
|
* The known filetypes for a RDOS disk.
|
||||||
*/
|
*/
|
||||||
public static final String[] filetypes = { "B", "A", "T" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
public static final String[] FILE_TYPES = { "B", "A", "T" };
|
||||||
|
private static final Map<String,String> FILE_TYPE_MAPPING = Map.of(
|
||||||
|
"T", "TXT",
|
||||||
|
"A", "BAS",
|
||||||
|
"B", "BIN"
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 13 sectors for RDOS 2.1/3.2, native sectoring (16) for RDOS 3.3
|
* 13 sectors for RDOS 2.1/3.2, native sectoring (16) for RDOS 3.3
|
||||||
|
@ -517,7 +518,7 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
* specific to each operating system, a simple String is used.
|
* specific to each operating system, a simple String is used.
|
||||||
*/
|
*/
|
||||||
public String[] getFiletypes() {
|
public String[] getFiletypes() {
|
||||||
return filetypes;
|
return FILE_TYPES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -570,4 +571,26 @@ public class RdosFormatDisk extends FormattedDisk {
|
||||||
public DiskGeometry getDiskGeometry() {
|
public DiskGeometry getDiskGeometry() {
|
||||||
return DiskGeometry.TRACK_SECTOR;
|
return DiskGeometry.TRACK_SECTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides conversation from a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String fromProdosFiletype(String prodosFiletype) {
|
||||||
|
return FILE_TYPE_MAPPING.entrySet()
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.getValue().equals(prodosFiletype))
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.findFirst()
|
||||||
|
.orElse("B");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Provides conversation to a given ProDOS file type since as it is common across
|
||||||
|
* many archiving tools.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toProdosFiletype(String nativeFiletype) {
|
||||||
|
return FILE_TYPE_MAPPING.getOrDefault(nativeFiletype, "BIN");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,29 +19,14 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.util.readerwriter;
|
package com.webcodepro.applecommander.util.readerwriter;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
import com.webcodepro.applecommander.storage.os.dos33.DosFileEntry;
|
import com.webcodepro.applecommander.storage.os.dos33.DosFileEntry;
|
||||||
import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk;
|
import com.webcodepro.applecommander.storage.os.dos33.DosFormatDisk;
|
||||||
import com.webcodepro.applecommander.util.AppleUtil;
|
import com.webcodepro.applecommander.util.AppleUtil;
|
||||||
|
|
||||||
public class DosFileEntryReaderWriter implements FileEntryReader, FileEntryWriter {
|
import java.util.Optional;
|
||||||
private static final Map<String,String> FILE_TYPES;
|
|
||||||
static {
|
|
||||||
FILE_TYPES = Map.of(
|
|
||||||
"T", "TXT",
|
|
||||||
"I", "INT",
|
|
||||||
"A", "BAS",
|
|
||||||
"B", "BIN",
|
|
||||||
"S", "$F1",
|
|
||||||
"R", "REL",
|
|
||||||
"a", "$F2",
|
|
||||||
"b", "$F3"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class DosFileEntryReaderWriter implements FileEntryReader, FileEntryWriter {
|
||||||
private DosFileEntry fileEntry;
|
private DosFileEntry fileEntry;
|
||||||
|
|
||||||
public DosFileEntryReaderWriter(DosFileEntry fileEntry) {
|
public DosFileEntryReaderWriter(DosFileEntry fileEntry) {
|
||||||
|
@ -62,17 +47,13 @@ public class DosFileEntryReaderWriter implements FileEntryReader, FileEntryWrite
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<String> getProdosFiletype() {
|
public Optional<String> getProdosFiletype() {
|
||||||
return Optional.ofNullable(FILE_TYPES.get(fileEntry.getFiletype()));
|
String prodosFiletype = fileEntry.getFormattedDisk().toProdosFiletype(fileEntry.getFiletype());
|
||||||
|
return Optional.ofNullable(prodosFiletype);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setProdosFiletype(String filetype) {
|
public void setProdosFiletype(String filetype) {
|
||||||
String dosFileType = FILE_TYPES.entrySet()
|
String dosFiletype = fileEntry.getFormattedDisk().fromProdosFiletype(filetype);
|
||||||
.stream()
|
fileEntry.setFiletype(dosFiletype);
|
||||||
.filter(e -> e.getValue().equals(filetype))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.findFirst()
|
|
||||||
.orElse("B");
|
|
||||||
fileEntry.setFiletype(dosFileType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,34 +19,15 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.util.readerwriter;
|
package com.webcodepro.applecommander.util.readerwriter;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.DiskFullException;
|
import com.webcodepro.applecommander.storage.DiskFullException;
|
||||||
import com.webcodepro.applecommander.storage.filters.PascalTextFileFilter;
|
import com.webcodepro.applecommander.storage.filters.PascalTextFileFilter;
|
||||||
import com.webcodepro.applecommander.storage.os.pascal.PascalFileEntry;
|
import com.webcodepro.applecommander.storage.os.pascal.PascalFileEntry;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class PascalFileEntryReaderWriter implements FileEntryReader, FileEntryWriter {
|
public class PascalFileEntryReaderWriter implements FileEntryReader, FileEntryWriter {
|
||||||
private static final PascalTextFileFilter TEXT_FILTER = new PascalTextFileFilter();
|
private static final PascalTextFileFilter TEXT_FILTER = new PascalTextFileFilter();
|
||||||
private static final Map<String,String> FILE_TYPES;
|
|
||||||
static {
|
|
||||||
FILE_TYPES = Map.of(
|
|
||||||
// Pascal => Prodos
|
|
||||||
"xdskfile", "BAD", // TODO we should skip bad block files
|
|
||||||
"CODE", "BIN", // TODO is there an address?
|
|
||||||
"TEXT", "TXT",
|
|
||||||
"INFO", "TXT", // TODO We should skip debugger info
|
|
||||||
"DATA", "BIN",
|
|
||||||
"GRAF", "BIN", // TODO compressed graphics image
|
|
||||||
"FOTO", "BIN", // TODO screen image
|
|
||||||
"securedir", "BIN", // TODO is this even implemented
|
|
||||||
|
|
||||||
// Prodos => Pascal
|
|
||||||
"BIN", "DATA",
|
|
||||||
"TXT", "TEXT"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private PascalFileEntry fileEntry;
|
private PascalFileEntry fileEntry;
|
||||||
|
|
||||||
|
@ -65,11 +46,11 @@ public class PascalFileEntryReaderWriter implements FileEntryReader, FileEntryWr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<String> getProdosFiletype() {
|
public Optional<String> getProdosFiletype() {
|
||||||
return Optional.ofNullable(FILE_TYPES.get(fileEntry.getFiletype()));
|
return Optional.ofNullable(fileEntry.getFormattedDisk().toProdosFiletype(fileEntry.getFiletype()));
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void setProdosFiletype(String filetype) {
|
public void setProdosFiletype(String filetype) {
|
||||||
fileEntry.setFiletype(FILE_TYPES.getOrDefault(filetype, "DATA"));
|
fileEntry.setFiletype(fileEntry.getFormattedDisk().fromProdosFiletype(filetype));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,21 +19,11 @@
|
||||||
*/
|
*/
|
||||||
package com.webcodepro.applecommander.util.readerwriter;
|
package com.webcodepro.applecommander.util.readerwriter;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import com.webcodepro.applecommander.storage.os.rdos.RdosFileEntry;
|
import com.webcodepro.applecommander.storage.os.rdos.RdosFileEntry;
|
||||||
|
|
||||||
public class RdosFileEntryReader implements FileEntryReader {
|
import java.util.Optional;
|
||||||
private static final Map<String,String> FILE_TYPES;
|
|
||||||
static {
|
|
||||||
FILE_TYPES = Map.of(
|
|
||||||
"T", "TXT",
|
|
||||||
"A", "BAS",
|
|
||||||
"B", "BIN"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class RdosFileEntryReader implements FileEntryReader {
|
||||||
private RdosFileEntry fileEntry;
|
private RdosFileEntry fileEntry;
|
||||||
|
|
||||||
public RdosFileEntryReader(RdosFileEntry fileEntry) {
|
public RdosFileEntryReader(RdosFileEntry fileEntry) {
|
||||||
|
@ -52,7 +42,7 @@ public class RdosFileEntryReader implements FileEntryReader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<String> getProdosFiletype() {
|
public Optional<String> getProdosFiletype() {
|
||||||
return Optional.ofNullable(FILE_TYPES.get(fileEntry.getFiletype()));
|
return Optional.ofNullable(fileEntry.getFormattedDisk().toProdosFiletype(fileEntry.getFiletype()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -211,7 +211,8 @@ public class ImportSelectFilesWizardPane extends WizardPane {
|
||||||
AppleSingle as = AppleSingle.read(data);
|
AppleSingle as = AppleSingle.read(data);
|
||||||
suggestedFilename = Optional.ofNullable(as.getRealName())
|
suggestedFilename = Optional.ofNullable(as.getRealName())
|
||||||
.orElse(suggestedFilename);
|
.orElse(suggestedFilename);
|
||||||
suggestedFiletype = ProdosFormatDisk.getFiletype(as.getProdosFileInfo().getFileType());
|
suggestedFiletype = wizard.getDisk().fromProdosFiletype(
|
||||||
|
ProdosFormatDisk.getFiletype(as.getProdosFileInfo().getFileType()));
|
||||||
suggestedAddress = Optional.ofNullable(as.getProdosFileInfo())
|
suggestedAddress = Optional.ofNullable(as.getProdosFileInfo())
|
||||||
.map(ProdosFileInfo::getAuxType)
|
.map(ProdosFileInfo::getAuxType)
|
||||||
.orElse(suggestedAddress);
|
.orElse(suggestedAddress);
|
||||||
|
@ -285,7 +286,7 @@ public class ImportSelectFilesWizardPane extends WizardPane {
|
||||||
label.setText(textBundle.get("FiletypeLabel")); //$NON-NLS-1$
|
label.setText(textBundle.get("FiletypeLabel")); //$NON-NLS-1$
|
||||||
final Combo filetypes = new Combo(dialog, SWT.BORDER | SWT.READ_ONLY);
|
final Combo filetypes = new Combo(dialog, SWT.BORDER | SWT.READ_ONLY);
|
||||||
filetypes.setItems(wizard.getDisk().getFiletypes());
|
filetypes.setItems(wizard.getDisk().getFiletypes());
|
||||||
if (spec.hasFiletype()) {
|
if (spec.hasFiletype() && filetypes.indexOf(spec.getFiletype()) != -1) {
|
||||||
filetypes.select(filetypes.indexOf(spec.getFiletype()));
|
filetypes.select(filetypes.indexOf(spec.getFiletype()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user