Update NXDT part
Add NXDT CLI support Update MessagesConsumer
This commit is contained in:
parent
6100a721af
commit
96e85056dd
18 changed files with 198 additions and 56 deletions
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM;
|
package nsusbloader.COM;
|
||||||
|
|
||||||
public interface ICommunications extends Runnable {
|
public interface INSTask extends Runnable {
|
||||||
void cancel();
|
void cancel();
|
||||||
boolean isCancelled();
|
boolean isCancelled();
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM.NET;
|
package nsusbloader.COM.NET;
|
||||||
|
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
import nsusbloader.ModelControllers.Log;
|
import nsusbloader.ModelControllers.Log;
|
||||||
|
@ -32,7 +32,7 @@ import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class NETCommunications implements ICommunications { // todo: rewrite
|
public class NETCommunications implements INSTask { // todo: rewrite
|
||||||
|
|
||||||
private ILogPrinter logPrinter;
|
private ILogPrinter logPrinter;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.ICommunications;
|
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -54,7 +53,7 @@ public class GoldLeaf_05 extends TransferModule {
|
||||||
private RandomAccessFile raf; // NSP File
|
private RandomAccessFile raf; // NSP File
|
||||||
private NSSplitReader nsr; // It'a also NSP File
|
private NSSplitReader nsr; // It'a also NSP File
|
||||||
|
|
||||||
GoldLeaf_05(DeviceHandle handler, LinkedHashMap<String, File> nspMap, ICommunications task, ILogPrinter logPrinter){
|
GoldLeaf_05(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter logPrinter){
|
||||||
super(handler, nspMap, task, logPrinter);
|
super(handler, nspMap, task, logPrinter);
|
||||||
status = EFileStatus.FAILED;
|
status = EFileStatus.FAILED;
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,9 @@
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import nsusbloader.COM.Helpers.NSSplitReader;
|
import nsusbloader.COM.Helpers.NSSplitReader;
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.MediatorControl;
|
import nsusbloader.MediatorControl;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -70,7 +69,7 @@ class GoldLeaf_07 extends TransferModule {
|
||||||
// For using in CMD_SelectFile with SPEC:/ prefix
|
// For using in CMD_SelectFile with SPEC:/ prefix
|
||||||
private File selectedFile;
|
private File selectedFile;
|
||||||
|
|
||||||
GoldLeaf_07(DeviceHandle handler, LinkedHashMap<String, File> nspMap, ICommunications task, ILogPrinter logPrinter, boolean nspFilter){
|
GoldLeaf_07(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter logPrinter, boolean nspFilter){
|
||||||
super(handler, nspMap, task, logPrinter);
|
super(handler, nspMap, task, logPrinter);
|
||||||
|
|
||||||
final byte CMD_GetDriveCount = 0x00;
|
final byte CMD_GetDriveCount = 0x00;
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.MediatorControl;
|
import nsusbloader.MediatorControl;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -70,7 +69,7 @@ class GoldLeaf_08 extends TransferModule {
|
||||||
// For using in CMD_SelectFile with SPEC:/ prefix
|
// For using in CMD_SelectFile with SPEC:/ prefix
|
||||||
private File selectedFile;
|
private File selectedFile;
|
||||||
|
|
||||||
GoldLeaf_08(DeviceHandle handler, LinkedHashMap<String, File> nspMap, ICommunications task, ILogPrinter logPrinter, boolean nspFilter){
|
GoldLeaf_08(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter logPrinter, boolean nspFilter){
|
||||||
super(handler, nspMap, task, logPrinter);
|
super(handler, nspMap, task, logPrinter);
|
||||||
|
|
||||||
final byte CMD_GetDriveCount = 1;
|
final byte CMD_GetDriveCount = 1;
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.ICommunications;
|
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -49,7 +48,7 @@ class TinFoil extends TransferModule {
|
||||||
/* byte[] magic = new byte[4];
|
/* byte[] magic = new byte[4];
|
||||||
ByteBuffer bb = StandardCharsets.UTF_8.encode("TUC0").rewind().get(magic); // Let's rephrase this 'string' */
|
ByteBuffer bb = StandardCharsets.UTF_8.encode("TUC0").rewind().get(magic); // Let's rephrase this 'string' */
|
||||||
|
|
||||||
TinFoil(DeviceHandle handler, LinkedHashMap<String, File> nspMap, ICommunications task, ILogPrinter logPrinter){
|
TinFoil(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter logPrinter){
|
||||||
super(handler, nspMap, task, logPrinter);
|
super(handler, nspMap, task, logPrinter);
|
||||||
logPrinter.print("============= Tinfoil =============", EMsgType.INFO);
|
logPrinter.print("============= Tinfoil =============", EMsgType.INFO);
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.ICommunications;
|
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -34,9 +33,9 @@ public abstract class TransferModule {
|
||||||
LinkedHashMap<String, File> nspMap;
|
LinkedHashMap<String, File> nspMap;
|
||||||
ILogPrinter logPrinter;
|
ILogPrinter logPrinter;
|
||||||
DeviceHandle handlerNS;
|
DeviceHandle handlerNS;
|
||||||
ICommunications task;
|
INSTask task;
|
||||||
|
|
||||||
TransferModule(DeviceHandle handler, LinkedHashMap<String, File> nspMap, ICommunications task, ILogPrinter printer){
|
TransferModule(DeviceHandle handler, LinkedHashMap<String, File> nspMap, INSTask task, ILogPrinter printer){
|
||||||
this.handlerNS = handler;
|
this.handlerNS = handler;
|
||||||
this.nspMap = nspMap;
|
this.nspMap = nspMap;
|
||||||
this.task = task;
|
this.task = task;
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.COM.USB;
|
package nsusbloader.COM.USB;
|
||||||
|
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.ModelControllers.Log;
|
import nsusbloader.ModelControllers.Log;
|
||||||
import nsusbloader.NSLDataTypes.EFileStatus;
|
import nsusbloader.NSLDataTypes.EFileStatus;
|
||||||
|
@ -31,7 +31,7 @@ import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
// TODO: add filter option to show only NSP files
|
// TODO: add filter option to show only NSP files
|
||||||
public class UsbCommunications implements ICommunications {
|
public class UsbCommunications implements INSTask {
|
||||||
|
|
||||||
private ILogPrinter logPrinter;
|
private ILogPrinter logPrinter;
|
||||||
private LinkedHashMap<String, File> nspMap;
|
private LinkedHashMap<String, File> nspMap;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import javafx.scene.layout.Region;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import nsusbloader.AppPreferences;
|
import nsusbloader.AppPreferences;
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.NET.NETCommunications;
|
import nsusbloader.COM.NET.NETCommunications;
|
||||||
import nsusbloader.COM.USB.UsbCommunications;
|
import nsusbloader.COM.USB.UsbCommunications;
|
||||||
import nsusbloader.MediatorControl;
|
import nsusbloader.MediatorControl;
|
||||||
|
@ -63,7 +63,7 @@ public class FrontController implements Initializable {
|
||||||
private String previouslyOpenedPath;
|
private String previouslyOpenedPath;
|
||||||
private Region btnUpStopImage;
|
private Region btnUpStopImage;
|
||||||
private ResourceBundle resourceBundle;
|
private ResourceBundle resourceBundle;
|
||||||
private ICommunications usbNetCommunications;
|
private INSTask usbNetCommunications;
|
||||||
private Thread workThread;
|
private Thread workThread;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.Controllers;
|
package nsusbloader.Controllers;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
@ -26,6 +25,7 @@ import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import nsusbloader.AppPreferences;
|
import nsusbloader.AppPreferences;
|
||||||
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.MediatorControl;
|
import nsusbloader.MediatorControl;
|
||||||
import nsusbloader.NSLDataTypes.EModule;
|
import nsusbloader.NSLDataTypes.EModule;
|
||||||
import nsusbloader.Utilities.nxdumptool.NxdtTask;
|
import nsusbloader.Utilities.nxdumptool.NxdtTask;
|
||||||
|
@ -45,7 +45,7 @@ public class NxdtController implements Initializable {
|
||||||
|
|
||||||
private Region btnDumpStopImage;
|
private Region btnDumpStopImage;
|
||||||
|
|
||||||
private Task<Boolean> NxdtTask;
|
private INSTask NxdtTask;
|
||||||
private Thread workThread;
|
private Thread workThread;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,13 +84,6 @@ public class NxdtController implements Initializable {
|
||||||
MediatorControl.getInstance().getContoller().logArea.clear();
|
MediatorControl.getInstance().getContoller().logArea.clear();
|
||||||
|
|
||||||
NxdtTask = new NxdtTask(saveToLocationLbl.getText());
|
NxdtTask = new NxdtTask(saveToLocationLbl.getText());
|
||||||
NxdtTask.setOnSucceeded(event -> {
|
|
||||||
if (NxdtTask.getValue())
|
|
||||||
statusLbl.setText(rb.getString("done_txt"));
|
|
||||||
else
|
|
||||||
statusLbl.setText(rb.getString("failure_txt"));
|
|
||||||
});
|
|
||||||
|
|
||||||
workThread = new Thread(NxdtTask);
|
workThread = new Thread(NxdtTask);
|
||||||
workThread.setDaemon(true);
|
workThread.setDaemon(true);
|
||||||
workThread.start();
|
workThread.start();
|
||||||
|
@ -102,7 +95,7 @@ public class NxdtController implements Initializable {
|
||||||
* */
|
* */
|
||||||
private void stopBtnAction(){
|
private void stopBtnAction(){
|
||||||
if (workThread != null && workThread.isAlive()){
|
if (workThread != null && workThread.isAlive()){
|
||||||
NxdtTask.cancel(false);
|
NxdtTask.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +123,12 @@ public class NxdtController implements Initializable {
|
||||||
injectPldBtn.getStyleClass().remove("buttonStop");
|
injectPldBtn.getStyleClass().remove("buttonStop");
|
||||||
injectPldBtn.getStyleClass().add("buttonUp");
|
injectPldBtn.getStyleClass().add("buttonUp");
|
||||||
}
|
}
|
||||||
|
public void setOneLineStatus(boolean status){
|
||||||
|
if (status)
|
||||||
|
statusLbl.setText(rb.getString("done_txt"));
|
||||||
|
else
|
||||||
|
statusLbl.setText(rb.getString("failure_txt"));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Save application settings on exit
|
* Save application settings on exit
|
||||||
* */
|
* */
|
||||||
|
|
|
@ -98,9 +98,14 @@ public class MessagesConsumer extends AnimationTimer {
|
||||||
for (String key : statusMap.keySet())
|
for (String key : statusMap.keySet())
|
||||||
tableViewController.setFileStatus(key, statusMap.get(key));
|
tableViewController.setFileStatus(key, statusMap.get(key));
|
||||||
}
|
}
|
||||||
//TODO: rewrite
|
|
||||||
if (appModuleType.equals(EModule.RCM)){
|
switch (appModuleType){
|
||||||
MediatorControl.getInstance().getContoller().getRcmCtrlr().setOneLineStatus(oneLinerStatus.get());
|
case RCM:
|
||||||
|
MediatorControl.getInstance().getContoller().getRcmCtrlr().setOneLineStatus(oneLinerStatus.get());
|
||||||
|
break;
|
||||||
|
case NXDT:
|
||||||
|
MediatorControl.getInstance().getContoller().getNXDTabController().setOneLineStatus(oneLinerStatus.get());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.Utilities.nxdumptool;
|
package nsusbloader.Utilities.nxdumptool;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.USB.UsbConnect;
|
import nsusbloader.COM.USB.UsbConnect;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.ModelControllers.Log;
|
import nsusbloader.ModelControllers.Log;
|
||||||
|
@ -26,18 +26,20 @@ import nsusbloader.NSLDataTypes.EModule;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
import org.usb4java.DeviceHandle;
|
import org.usb4java.DeviceHandle;
|
||||||
|
|
||||||
public class NxdtTask extends Task<Boolean> {
|
public class NxdtTask implements INSTask {
|
||||||
|
|
||||||
private ILogPrinter logPrinter;
|
private ILogPrinter logPrinter;
|
||||||
private String saveToLocation;
|
private String saveToLocation;
|
||||||
|
|
||||||
|
private volatile boolean cancel;
|
||||||
|
|
||||||
public NxdtTask(String saveToLocation){
|
public NxdtTask(String saveToLocation){
|
||||||
this.logPrinter = Log.getPrinter(EModule.NXDT);
|
this.logPrinter = Log.getPrinter(EModule.NXDT);
|
||||||
this.saveToLocation = saveToLocation;
|
this.saveToLocation = saveToLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean call() {
|
public void run() {
|
||||||
logPrinter.print("Save to location: "+ saveToLocation, EMsgType.INFO);
|
logPrinter.print("Save to location: "+ saveToLocation, EMsgType.INFO);
|
||||||
logPrinter.print("=============== nxdumptool ===============", EMsgType.INFO);
|
logPrinter.print("=============== nxdumptool ===============", EMsgType.INFO);
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ public class NxdtTask extends Task<Boolean> {
|
||||||
|
|
||||||
if (! usbConnect.isConnected()){
|
if (! usbConnect.isConnected()){
|
||||||
logPrinter.close();
|
logPrinter.close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceHandle handler = usbConnect.getNsHandler();
|
DeviceHandle handler = usbConnect.getNsHandler();
|
||||||
|
@ -55,7 +57,18 @@ public class NxdtTask extends Task<Boolean> {
|
||||||
logPrinter.print(".:: Complete ::.", EMsgType.PASS);
|
logPrinter.print(".:: Complete ::.", EMsgType.PASS);
|
||||||
|
|
||||||
usbConnect.close();
|
usbConnect.close();
|
||||||
|
logPrinter.updateOneLinerStatus(true);
|
||||||
logPrinter.close();
|
logPrinter.close();
|
||||||
return true;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel() {
|
||||||
|
cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package nsusbloader.Utilities.nxdumptool;
|
package nsusbloader.Utilities.nxdumptool;
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.USB.UsbErrorCodes;
|
import nsusbloader.COM.USB.UsbErrorCodes;
|
||||||
import nsusbloader.ModelControllers.ILogPrinter;
|
import nsusbloader.ModelControllers.ILogPrinter;
|
||||||
import nsusbloader.NSLDataTypes.EMsgType;
|
import nsusbloader.NSLDataTypes.EMsgType;
|
||||||
|
@ -35,7 +35,7 @@ import java.util.Arrays;
|
||||||
class NxdtUsbAbi1 {
|
class NxdtUsbAbi1 {
|
||||||
private ILogPrinter logPrinter;
|
private ILogPrinter logPrinter;
|
||||||
private DeviceHandle handlerNS;
|
private DeviceHandle handlerNS;
|
||||||
private Task<Boolean> task;
|
private INSTask task;
|
||||||
private String saveToPath;
|
private String saveToPath;
|
||||||
|
|
||||||
private boolean isWindows;
|
private boolean isWindows;
|
||||||
|
@ -79,7 +79,7 @@ class NxdtUsbAbi1 {
|
||||||
0x00, 0x00, 0x00, 0x00 };
|
0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
public NxdtUsbAbi1(DeviceHandle handler,
|
public NxdtUsbAbi1(DeviceHandle handler,
|
||||||
Task<Boolean> task,
|
INSTask task,
|
||||||
ILogPrinter logPrinter,
|
ILogPrinter logPrinter,
|
||||||
String saveToPath
|
String saveToPath
|
||||||
){
|
){
|
||||||
|
|
|
@ -57,19 +57,27 @@ public class CommandLineInterface {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cli.hasOption("n") || cli.hasOption("tfn")){
|
if (cli.hasOption("n") || cli.hasOption("tfn")){
|
||||||
final String[] tfnArguments = cli.getOptionValues("tfn");
|
final String[] arguments = cli.getOptionValues("tfn");
|
||||||
new TinfoilNet(tfnArguments);
|
new TinfoilNet(arguments);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cli.hasOption("t") || cli.hasOption("tinfoil")){
|
if (cli.hasOption("t") || cli.hasOption("tinfoil")){
|
||||||
final String[] tfArguments = cli.getOptionValues("tinfoil");
|
final String[] arguments = cli.getOptionValues("tinfoil");
|
||||||
new TinfoilUsb(tfArguments);
|
new TinfoilUsb(arguments);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cli.hasOption("g") || cli.hasOption("goldleaf")){
|
if (cli.hasOption("g") || cli.hasOption("goldleaf")){
|
||||||
final String[] glArguments = cli.getOptionValues("goldleaf");
|
final String[] arguments = cli.getOptionValues("goldleaf");
|
||||||
new GoldLeaf(glArguments);
|
new GoldLeaf(arguments);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
if (cli.hasOption("x") || cli.hasOption("nxdt")){
|
||||||
|
final String[] arguments = cli.getOptionValues("nxdt");
|
||||||
|
new NXDT(arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
catch (ParseException pe){
|
catch (ParseException pe){
|
||||||
System.out.println(pe.getLocalizedMessage() +
|
System.out.println(pe.getLocalizedMessage() +
|
||||||
|
@ -139,6 +147,15 @@ public class CommandLineInterface {
|
||||||
.hasArgs()
|
.hasArgs()
|
||||||
.argName("...")
|
.argName("...")
|
||||||
.build();
|
.build();
|
||||||
|
/* nxdumptool */
|
||||||
|
/*
|
||||||
|
final Option nxdtOption = Option.builder("x")
|
||||||
|
.longOpt("nxdt")
|
||||||
|
.desc("Handle nxdumptool connections.")
|
||||||
|
.hasArg()
|
||||||
|
.argName("DIRECTORY")
|
||||||
|
.build();
|
||||||
|
*/
|
||||||
|
|
||||||
final OptionGroup group = new OptionGroup();
|
final OptionGroup group = new OptionGroup();
|
||||||
group.addOption(rcmOption);
|
group.addOption(rcmOption);
|
||||||
|
@ -148,6 +165,7 @@ public class CommandLineInterface {
|
||||||
group.addOption(helpOption);
|
group.addOption(helpOption);
|
||||||
group.addOption(tinfoilOption);
|
group.addOption(tinfoilOption);
|
||||||
group.addOption(glOption);
|
group.addOption(glOption);
|
||||||
|
//group.addOption(nxdtOption);
|
||||||
|
|
||||||
options.addOptionGroup(group);
|
options.addOptionGroup(group);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,24 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019-2020 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of NS-USBloader.
|
||||||
|
|
||||||
|
NS-USBloader is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
NS-USBloader is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package nsusbloader.cli;
|
package nsusbloader.cli;
|
||||||
|
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.USB.UsbCommunications;
|
import nsusbloader.COM.USB.UsbCommunications;
|
||||||
import nsusbloader.Controllers.SettingsController;
|
import nsusbloader.Controllers.SettingsController;
|
||||||
|
|
||||||
|
@ -51,8 +69,8 @@ public class GoldLeaf {
|
||||||
+ "\tns-usbloader -g ver=<arg1> [filter] FILE1 ...\n"
|
+ "\tns-usbloader -g ver=<arg1> [filter] FILE1 ...\n"
|
||||||
+ "\tns-usbloader --goldleaf ver=<arg1> [filter] FILE1 ..."
|
+ "\tns-usbloader --goldleaf ver=<arg1> [filter] FILE1 ..."
|
||||||
+ "\n\nOption:"
|
+ "\n\nOption:"
|
||||||
+ "\n\tver=<goldleaf_version>\tDefine GoldLeaf version (mandatory)\n\n"
|
+ "\n\tver=<goldleaf_version>\tDefine GoldLeaf version (mandatory)"
|
||||||
+ "\n\tfilter\t\nShow only *.nsp in GoldLeaf (optional)\n\n"
|
+ "\n\tfilter\t\t\tShow only *.nsp in GoldLeaf (optional)\n\n"
|
||||||
+ getGlSupportedVersions());
|
+ getGlSupportedVersions());
|
||||||
}
|
}
|
||||||
private String getGlSupportedVersions(){
|
private String getGlSupportedVersions(){
|
||||||
|
@ -107,7 +125,7 @@ public class GoldLeaf {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runGoldLeafBackend() throws InterruptedException {
|
public void runGoldLeafBackend() throws InterruptedException {
|
||||||
ICommunications task = new UsbCommunications(filesList,
|
INSTask task = new UsbCommunications(filesList,
|
||||||
"GoldLeaf"+goldLeafVersion,
|
"GoldLeaf"+goldLeafVersion,
|
||||||
filterForNsp);
|
filterForNsp);
|
||||||
Thread thread = new Thread(task);
|
Thread thread = new Thread(task);
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019-2020 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of NS-USBloader.
|
||||||
|
|
||||||
|
NS-USBloader is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
NS-USBloader is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package nsusbloader.cli;
|
package nsusbloader.cli;
|
||||||
|
|
||||||
public class IncorrectSetupException extends Exception {
|
public class IncorrectSetupException extends Exception {
|
||||||
|
|
58
src/main/java/nsusbloader/cli/NXDT.java
Normal file
58
src/main/java/nsusbloader/cli/NXDT.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019-2020 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of NS-USBloader.
|
||||||
|
|
||||||
|
NS-USBloader is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
NS-USBloader is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package nsusbloader.cli;
|
||||||
|
|
||||||
|
import nsusbloader.Utilities.nxdumptool.NxdtTask;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class NXDT {
|
||||||
|
|
||||||
|
private final String[] arguments;
|
||||||
|
private String saveTo;
|
||||||
|
|
||||||
|
public NXDT(String[] arguments) throws InterruptedException, IncorrectSetupException{
|
||||||
|
this.arguments = arguments;
|
||||||
|
parseArgument();
|
||||||
|
runBackend();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseArgument() throws IncorrectSetupException{
|
||||||
|
final File file = new File(arguments[0]);
|
||||||
|
|
||||||
|
if (! file.exists()){
|
||||||
|
throw new IncorrectSetupException("Directory does not exist.\n" +
|
||||||
|
"Try 'ns-usbloader -h' for more information.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.isFile()){
|
||||||
|
throw new IncorrectSetupException("Argument is file while directory expected.\n" +
|
||||||
|
"Try 'ns-usbloader -h' for more information.");
|
||||||
|
}
|
||||||
|
|
||||||
|
saveTo = arguments[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runBackend() throws InterruptedException{
|
||||||
|
NxdtTask nxdtTask = new NxdtTask(saveTo);
|
||||||
|
Thread thread = new Thread(nxdtTask);
|
||||||
|
thread.start();
|
||||||
|
thread.join();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,24 @@
|
||||||
|
/*
|
||||||
|
Copyright 2019-2020 Dmitry Isaenko
|
||||||
|
|
||||||
|
This file is part of NS-USBloader.
|
||||||
|
|
||||||
|
NS-USBloader is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
NS-USBloader is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with NS-USBloader. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package nsusbloader.cli;
|
package nsusbloader.cli;
|
||||||
|
|
||||||
import nsusbloader.COM.ICommunications;
|
import nsusbloader.COM.INSTask;
|
||||||
import nsusbloader.COM.USB.UsbCommunications;
|
import nsusbloader.COM.USB.UsbCommunications;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -43,7 +61,7 @@ public class TinfoilUsb {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runTinfoilBackend() throws InterruptedException{
|
private void runTinfoilBackend() throws InterruptedException{
|
||||||
ICommunications task = new UsbCommunications(filesList, "TinFoil", false);
|
INSTask task = new UsbCommunications(filesList, "TinFoil", false);
|
||||||
Thread thread = new Thread(task);
|
Thread thread = new Thread(task);
|
||||||
thread.start();
|
thread.start();
|
||||||
thread.join();
|
thread.join();
|
||||||
|
|
Loading…
Reference in a new issue