From b2544e77929de2b043986cea7a78d84a203928ce Mon Sep 17 00:00:00 2001 From: Downforce Agent Date: Fri, 9 Aug 2024 01:34:32 -0500 Subject: [PATCH] initial structuring --- .gitignore | 35 +++++++++++++++ .idea/gradle.xml | 4 ++ June.java | 3 ++ Scotty.java | 113 +++++++++++++++++++++++++++++++++++++++++++++++ standalone.java | 10 +++++ 5 files changed, 165 insertions(+) create mode 100644 .idea/gradle.xml create mode 100644 June.java create mode 100644 Scotty.java create mode 100644 standalone.java diff --git a/.gitignore b/.gitignore index 9154f4c..2501eef 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,38 @@ hs_err_pid* replay_pid* + +# Ignore Gradle project-specific cache directory +.gradle + +# Ignore Gradle build output directory +build +/.gitattributes +/.idea/.gitignore +/app/src/main/java/org/example/app/App.java +/app/build.gradle.kts +/buildSrc/build.gradle.kts +/list/build.gradle.kts +/utilities/build.gradle.kts +/buildSrc/src/main/kotlin/buildlogic.java-application-conventions.gradle.kts +/buildSrc/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts +/buildSrc/src/main/kotlin/buildlogic.java-library-conventions.gradle.kts +/gradle/wrapper/gradle-wrapper.properties +/gradlew +/gradlew.bat +/utilities/src/main/java/org/example/utilities/JoinUtils.java +/gradle/libs.versions.toml +/list/src/main/java/org/example/list/LinkedList.java +/list/src/test/java/org/example/list/LinkedListTest.java +/.idea/material_theme_project_new.xml +/app/src/main/java/org/example/app/MessageUtils.java +/app/src/test/java/org/example/app/MessageUtilsTest.java +/.idea/misc.xml +/.idea/modules.xml +/buildSrc/settings.gradle.kts +/settings.gradle.kts +/utilities/src/main/java/org/example/utilities/SplitUtils.java +/utilities/src/main/java/org/example/utilities/StringUtils.java +/.idea/uiDesigner.xml +/.idea/vcs.xml +/.idea/vitality4j.iml diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..3e3960b --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/June.java b/June.java new file mode 100644 index 0000000..8895302 --- /dev/null +++ b/June.java @@ -0,0 +1,3 @@ +public class June { + // todo +} diff --git a/Scotty.java b/Scotty.java new file mode 100644 index 0000000..6dcf6fd --- /dev/null +++ b/Scotty.java @@ -0,0 +1,113 @@ +import java.io.File; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.zip.Deflater; +import java.io.RandomAccessFile; + +public class Scotty { + public enum CompressionFormats { + NONE(0), + ZLIB(1), + LZMA(2); + + private final int value; + CompressionFormats(final int value) {this.value = value;} + + public int getValue() { + return value; + } + } + + public enum PathModes { + RELATIVE(0), + ABSOLUTE(1); + + private final int value; + PathModes(final int value) {this.value = value;} + + public int getValue() { + return value; + } + } + + public class CompressedFile { + private final PSARC container; + private final String path; + public CompressionFormats algorithm = null; // if NULL then it inherits the value from the entire PSARC file + + public CompressedFile(PSARC container, String path) { + this.container = container; + this.path = path; + } + + public PSARC getContainer() { + return container; + } + + public String getLocationInArchive() { + return path; + } + + public InputStream getIOStream() { + throw new UnsupportedOperationException(); + } + } + + public class PSARC { + public CompressionFormats algorithm = CompressionFormats.ZLIB; // the algorithm used to compress the files + public byte strength = 9; // intensity of the compression algorithm from 0 to 9 + public long blockSize = 65536; + private File fromDisk = null; + private List files = new ArrayList(); + + public PSARC() { // new w/ defaults + // use defaults, do nothing + } + + public PSARC(File location) { // existing + // todo: read psarc and set vars above + } + + public PSARC(CompressionFormats algorithm, byte strength) { // new + this.algorithm = algorithm; + this.strength = strength; + } + + public PSARC(CompressionFormats algorithm, byte strength, long blockSize) { // new + this.algorithm = algorithm; + this.strength = strength; + this.blockSize = blockSize; + } + + public List listAllFiles() { + return files; + } + + public String[] listAllFilePaths() { + throw new UnsupportedOperationException(); + } + + public boolean addFile(File input) { + throw new UnsupportedOperationException(); + } + + public boolean writeOut(File destination) { + throw new UnsupportedOperationException(); + } + + public boolean extractAll(File destination) { + throw new UnsupportedOperationException(); + } + + public boolean extractSingleFile(CompressedFile target, File destination) { + throw new UnsupportedOperationException(); + } + + public boolean extractMultipleFiles(List targets, File directory) { + throw new UnsupportedOperationException(); + } + } + + +} diff --git a/standalone.java b/standalone.java new file mode 100644 index 0000000..ab8cf08 --- /dev/null +++ b/standalone.java @@ -0,0 +1,10 @@ +public class standalone { + // This is used when Vitality4J is run from the terminal. + // Don't make calls to anything in the standalone class when using Vitality4j as a library. + // + // This is useful incase the user wants a standalone psarc.exe replacement + // and/or for debugging purposes without another Java project as the interface. + public static void main (String[] args) { + System.out.println("Command line unimplemented."); // todo + } +}