initial structuring
This commit is contained in:
parent
f6856dbf34
commit
b2544e7792
35
.gitignore
vendored
35
.gitignore
vendored
|
@ -24,3 +24,38 @@
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_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
|
||||||
|
|
4
.idea/gradle.xml
Normal file
4
.idea/gradle.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
|
</project>
|
113
Scotty.java
Normal file
113
Scotty.java
Normal file
|
@ -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<CompressedFile> files = new ArrayList<CompressedFile>();
|
||||||
|
|
||||||
|
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<CompressedFile> 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<CompressedFile> targets, File directory) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
10
standalone.java
Normal file
10
standalone.java
Normal file
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user