mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 16:09:18 +01:00
Return false instead of throwing an exception while trying to extract missing files
This commit is contained in:
parent
a521b045ab
commit
73440af121
@ -117,23 +117,30 @@ public final class ExtractionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void extractTMDTo(String output) throws IOException {
|
public boolean extractTMDTo(String output) throws IOException {
|
||||||
Utils.createDir(output);
|
Utils.createDir(output);
|
||||||
|
|
||||||
byte[] rawTMD = getDataProvider().getRawTMD().orElseThrow(() -> new FileNotFoundException("TMD not found"));
|
Optional<byte[]> rawTMD = getDataProvider().getRawTMD();
|
||||||
|
if (!rawTMD.isPresent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String tmd_path = output + File.separator + Settings.TMD_FILENAME;
|
String tmd_path = output + File.separator + Settings.TMD_FILENAME;
|
||||||
log.info("Extracting TMD to: " + tmd_path);
|
log.info("Extracting TMD to: " + tmd_path);
|
||||||
FileUtils.saveByteArrayToFile(tmd_path, rawTMD);
|
return FileUtils.saveByteArrayToFile(tmd_path, rawTMD.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extractTicketTo(String output) throws IOException {
|
public boolean extractTicketTo(String output) throws IOException {
|
||||||
Utils.createDir(output);
|
Utils.createDir(output);
|
||||||
|
|
||||||
byte[] rawTicket = getDataProvider().getRawTicket().orElseThrow(() -> new FileNotFoundException("Ticket not found"));
|
Optional<byte[]> rawTicket = getDataProvider().getRawTicket();
|
||||||
|
if (!rawTicket.isPresent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
String ticket_path = output + File.separator + Settings.TICKET_FILENAME;
|
String ticket_path = output + File.separator + Settings.TICKET_FILENAME;
|
||||||
log.info("Extracting Ticket to: " + ticket_path);
|
log.info("Extracting Ticket to: " + ticket_path);
|
||||||
return FileUtils.saveByteArrayToFile(ticket_path, rawTicket);
|
return FileUtils.saveByteArrayToFile(ticket_path, rawTicket.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean extractCertTo(String output) throws IOException {
|
public boolean extractCertTo(String output) throws IOException {
|
||||||
@ -160,5 +167,4 @@ public final class ExtractionService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user