Fix overwriting existing titles

This commit is contained in:
Maschell 2019-04-26 20:50:44 +02:00
parent 72a43e2820
commit bd0bd2a59c

View File

@ -132,7 +132,7 @@ public class Main {
decryptFile(input, output, regex, overwrite, titlekey); decryptFile(input, output, regex, overwrite, titlekey);
} }
private static NUSTitle getTitle(String input, boolean overwrite, byte[] titlekey) throws IOException, Exception { private static NUSTitle getTitle(String input, byte[] titlekey) throws IOException, Exception {
if (input == null) { if (input == null) {
System.out.println("You need to provide an input file"); System.out.println("You need to provide an input file");
} }
@ -153,7 +153,7 @@ public class Main {
} }
private static void decryptFile(String input, String output, String regex, boolean overwrite, byte[] titlekey) throws Exception { private static void decryptFile(String input, String output, String regex, boolean overwrite, byte[] titlekey) throws Exception {
NUSTitle title = getTitle(input, overwrite, titlekey); NUSTitle title = getTitle(input, titlekey);
if (title == null) { if (title == null) {
System.err.println("Failed to open title."); System.err.println("Failed to open title.");
@ -173,7 +173,7 @@ public class Main {
System.out.println("To the folder: " + outputFolder.getAbsolutePath()); System.out.println("To the folder: " + outputFolder.getAbsolutePath());
DecryptionService decryption = DecryptionService.getInstance(new FSTDataProviderNUSTitle(title)); DecryptionService decryption = DecryptionService.getInstance(new FSTDataProviderNUSTitle(title));
decryption.decryptFSTEntriesTo(regex, outputFolder.getAbsolutePath(), overwrite); decryption.decryptFSTEntriesTo(regex, outputFolder.getAbsolutePath(), !overwrite);
System.out.println("Decryption done"); System.out.println("Decryption done");
} }