Update AudioExtractor.java

Updated formatting.
main
Nes370 2024-07-20 06:36:49 -07:00
parent 2b0948f6d5
commit fb9b4276a2
1 changed files with 32 additions and 13 deletions

View File

@ -80,7 +80,8 @@ public class AudioExtractor {
Thread.sleep(500); Thread.sleep(500);
} }
System.out.println("Program:\tRidge Racer 6 Audio Extractor " + Ansi.colorize("v1.0", Attribute.BRIGHT_GREEN_TEXT()) + " by " + Ansi.colorize("Nes", Attribute.TEXT_COLOR(252, 42, 124))); System.out.println("Program:\tRidge Racer 6 Audio Extractor " + Ansi.colorize("v1.0", Attribute.BRIGHT_GREEN_TEXT()) + " by "
+ Ansi.colorize("Nes", Attribute.TEXT_COLOR(252, 42, 124)));
System.out.println("Repository:\t" + Ansi.colorize("https://gitea.goblincave.synology.me/Nes/RR6AudioExtractor", Attribute.CYAN_TEXT())); System.out.println("Repository:\t" + Ansi.colorize("https://gitea.goblincave.synology.me/Nes/RR6AudioExtractor", Attribute.CYAN_TEXT()));
// Used for reading user input // Used for reading user input
@ -97,11 +98,13 @@ public class AudioExtractor {
switch(operation) { switch(operation) {
case "extract": // extract case "extract": // extract
// Determine package directory // Determine package directory
File currentDir = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent()); File currentDir = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI())
.getParent());
boolean packDirFound = false; boolean packDirFound = false;
do { do {
System.out.println(Ansi.colorize("\nPackage Directory:", Attribute.BOLD(), Attribute.CYAN_TEXT())); System.out.println(Ansi.colorize("\nPackage Directory:", Attribute.BOLD(), Attribute.CYAN_TEXT()));
System.out.println("- " + Ansi.colorize("Current", Attribute.BRIGHT_RED_TEXT()) + " directory:\t" + Ansi.colorize(currentDir.getPath(), Attribute.BRIGHT_CYAN_TEXT())); System.out.println("- " + Ansi.colorize("Current", Attribute.BRIGHT_RED_TEXT()) + " directory:\t"
+ Ansi.colorize(currentDir.getPath(), Attribute.BRIGHT_CYAN_TEXT()));
} while(!packDirFound); } while(!packDirFound);
break; break;
@ -171,7 +174,8 @@ public class AudioExtractor {
packDirectory = Path.of(args[1]).toFile(); packDirectory = Path.of(args[1]).toFile();
else packDirectory = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent()); else packDirectory = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent());
if(packMode && !packDirectory.exists() && !packDirectory.mkdir()) { if(packMode && !packDirectory.exists() && !packDirectory.mkdir()) {
System.out.println("Package output directory " + packDirectory + " does not exist, and could not be created. Program execution aborted."); System.out.println("Package output directory " + packDirectory + " does not exist, and could not be created. "
+ "Program execution aborted.");
System.exit(1); System.exit(1);
} else if(!packMode && !packDirectory.exists()) { } else if(!packMode && !packDirectory.exists()) {
System.out.println("Package input directory " + packDirectory + " does not exist. Program execution aborted."); System.out.println("Package input directory " + packDirectory + " does not exist. Program execution aborted.");
@ -184,7 +188,8 @@ public class AudioExtractor {
extractDirectory = Path.of(args[2]).toFile(); extractDirectory = Path.of(args[2]).toFile();
else extractDirectory = packDirectory; else extractDirectory = packDirectory;
if(!packMode && !extractDirectory.exists() && !extractDirectory.mkdir()) { if(!packMode && !extractDirectory.exists() && !extractDirectory.mkdir()) {
System.out.println("Extract output directory " + extractDirectory + " does not exist, and could not be created. Program execution aborted."); System.out.println("Extract output directory " + extractDirectory + " does not exist, and could not be created. "
+ "Program execution aborted.");
System.exit(2); System.exit(2);
} }
@ -271,19 +276,33 @@ public class AudioExtractor {
private static Attribute retrieveColor(BufferedReader reader) { private static Attribute retrieveColor(BufferedReader reader) {
String prompt = "\nCommand parameters: " + Ansi.colorize("Print", Attribute.BRIGHT_BLUE_TEXT()) + Ansi.colorize(" [color]", Attribute.BRIGHT_YELLOW_TEXT()) + Ansi.colorize(" [message]", Attribute.BRIGHT_RED_TEXT()) String prompt = "\nCommand parameters: " + Ansi.colorize("Print", Attribute.BRIGHT_BLUE_TEXT())
+ Ansi.colorize(" [color]", Attribute.BRIGHT_YELLOW_TEXT()) + Ansi.colorize(" [message]", Attribute.BRIGHT_RED_TEXT())
+ "\n" + "\n"
+ "\n" + Ansi.colorize("Colors", Attribute.BRIGHT_YELLOW_TEXT(), Attribute.BOLD()) + ":" + "\n" + Ansi.colorize("Colors", Attribute.BRIGHT_YELLOW_TEXT(), Attribute.BOLD()) + ":"
+ "\n- " + Ansi.colorize("Default", Attribute.CLEAR()) + "\n- " + Ansi.colorize("Default", Attribute.CLEAR())
+ "\n- " + Ansi.colorize("Black", Attribute.BLACK_TEXT()) + ", " + Ansi.colorize("Gray", Attribute.BRIGHT_BLACK_TEXT()) + ", " + Ansi.colorize("White", Attribute.BRIGHT_WHITE_TEXT()) + "\n- " + Ansi.colorize("Black", Attribute.BLACK_TEXT())
+ "\n- " + Ansi.colorize("Indigo", Attribute.TEXT_COLOR(0x7D, 0x1A, 0xFF)) + ", " + Ansi.colorize("Purple", Attribute.BRIGHT_MAGENTA_TEXT()) + ", " + Ansi.colorize("Violet", Attribute.TEXT_COLOR(0xEE, 0x82, 0xEE)) + ", " + Ansi.colorize("Gray", Attribute.BRIGHT_BLACK_TEXT())
+ "\n- " + Ansi.colorize("Red", Attribute.RED_TEXT()) + ", " + Ansi.colorize("Cinnabar", Attribute.BRIGHT_RED_TEXT()) + ", " + Ansi.colorize("Pink", Attribute.TEXT_COLOR(0xFF, 0xC0, 0xCB)) + ", " + Ansi.colorize("White", Attribute.BRIGHT_WHITE_TEXT())
+ "\n- " + Ansi.colorize("Orange", Attribute.TEXT_COLOR(0xFF, 0x68, 0x1F)) + ", " + Ansi.colorize("Gold", Attribute.YELLOW_TEXT()) + ", " + Ansi.colorize("Yellow", Attribute.TEXT_COLOR(0xFF, 0xEA, 0x00)) + "\n- " + Ansi.colorize("Indigo", Attribute.TEXT_COLOR(0x7D, 0x1A, 0xFF))
+ "\n- " + Ansi.colorize("Green", Attribute.BRIGHT_GREEN_TEXT()) + ", " + Ansi.colorize("Chartreuse", Attribute.TEXT_COLOR(0xD1, 0xEB, 0x27)) + ", " + Ansi.colorize("Beige", Attribute.BRIGHT_YELLOW_TEXT()) + ", " + Ansi.colorize("Purple", Attribute.BRIGHT_MAGENTA_TEXT())
+ "\n- " + Ansi.colorize("Blue", Attribute.BRIGHT_BLUE_TEXT()) + ", " + Ansi.colorize("Teal", Attribute.TEXT_COLOR(0x00, 0x93, 0xCF)) + ", " + Ansi.colorize("Cyan", Attribute.BRIGHT_CYAN_TEXT()) + ", " + Ansi.colorize("Violet", Attribute.TEXT_COLOR(0xEE, 0x82, 0xEE))
+ "\n- " + Ansi.colorize("Red", Attribute.RED_TEXT())
+ ", " + Ansi.colorize("Cinnabar", Attribute.BRIGHT_RED_TEXT())
+ ", " + Ansi.colorize("Pink", Attribute.TEXT_COLOR(0xFF, 0xC0, 0xCB))
+ "\n- " + Ansi.colorize("Orange", Attribute.TEXT_COLOR(0xFF, 0x68, 0x1F))
+ ", " + Ansi.colorize("Gold", Attribute.YELLOW_TEXT())
+ ", " + Ansi.colorize("Yellow", Attribute.TEXT_COLOR(0xFF, 0xEA, 0x00))
+ "\n- " + Ansi.colorize("Green", Attribute.BRIGHT_GREEN_TEXT())
+ ", " + Ansi.colorize("Chartreuse", Attribute.TEXT_COLOR(0xD1, 0xEB, 0x27))
+ ", " + Ansi.colorize("Beige", Attribute.BRIGHT_YELLOW_TEXT())
+ "\n- " + Ansi.colorize("Blue", Attribute.BRIGHT_BLUE_TEXT())
+ ", " + Ansi.colorize("Teal", Attribute.TEXT_COLOR(0x00, 0x93, 0xCF))
+ ", " + Ansi.colorize("Cyan", Attribute.BRIGHT_CYAN_TEXT())
+ "\n" + "\n"
+ "\n" + Ansi.colorize("Please select a color:") + PALE_YELLOW + " "; + "\n" + Ansi.colorize("Please select a color:") + PALE_YELLOW + " ";
String[] values = {"Default", "Black", "Gray", "White", "Indigo", "Purple", "Violet", "Red", "Cinnabar", "Pink", "Orange", "Gold", "Yellow", "Green", "Chartreuse", "Beige","Blue", "Teal", "Cyan"}; String[] values = {"Default", "Black", "Gray", "White", "Indigo", "Purple", "Violet", "Red", "Cinnabar", "Pink", "Orange", "Gold",
"Yellow", "Green", "Chartreuse", "Beige","Blue", "Teal", "Cyan"};
String input = retrieveInput(reader, prompt, values); String input = retrieveInput(reader, prompt, values);