mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-14 15:15:05 -04:00
Add Split and Merge functions to CLI
Create CanellableRunnable abstraction Change Split/Merge implementation to CanellableRunnable
This commit is contained in:
parent
3592c9086b
commit
dbb7c8e2e1
19 changed files with 358 additions and 65 deletions
|
@ -21,6 +21,7 @@ package nsusbloader.COM.USB;
|
|||
import javafx.application.Platform;
|
||||
import javafx.stage.FileChooser;
|
||||
import nsusbloader.MediatorControl;
|
||||
import nsusbloader.ModelControllers.CancellableRunnable;
|
||||
import nsusbloader.ModelControllers.ILogPrinter;
|
||||
import nsusbloader.NSLDataTypes.EMsgType;
|
||||
import nsusbloader.COM.Helpers.NSSplitReader;
|
||||
|
@ -68,9 +69,13 @@ class GoldLeaf_08 extends TransferModule {
|
|||
// For using in CMD_SelectFile with SPEC:/ prefix
|
||||
private File selectedFile;
|
||||
|
||||
GoldLeaf_08(DeviceHandle handler, LinkedHashMap<String, File> nspMap, Runnable task, ILogPrinter logPrinter, boolean nspFilter){
|
||||
private CancellableRunnable task;
|
||||
|
||||
GoldLeaf_08(DeviceHandle handler, LinkedHashMap<String, File> nspMap, CancellableRunnable task, ILogPrinter logPrinter, boolean nspFilter){
|
||||
super(handler, nspMap, task, logPrinter);
|
||||
|
||||
this.task = task;
|
||||
|
||||
final byte CMD_GetDriveCount = 1;
|
||||
final byte CMD_GetDriveInfo = 2;
|
||||
final byte CMD_StatPath = 3;
|
||||
|
@ -1011,7 +1016,7 @@ class GoldLeaf_08 extends TransferModule {
|
|||
|
||||
int result;
|
||||
|
||||
while (! Thread.interrupted()) {
|
||||
while (! task.isCancelled()) {
|
||||
result = LibUsb.bulkTransfer(handlerNS, (byte) 0x81, readBuffer, readBufTransferred, 1000); // last one is TIMEOUT. 0 stands for unlimited. Endpoint IN = 0x81
|
||||
|
||||
switch (result) {
|
||||
|
@ -1041,7 +1046,7 @@ class GoldLeaf_08 extends TransferModule {
|
|||
|
||||
int result;
|
||||
|
||||
while (! Thread.interrupted() ) {
|
||||
while (! task.isCancelled() ) {
|
||||
result = LibUsb.bulkTransfer(handlerNS, (byte) 0x81, readBuffer, readBufTransferred, 1000); // last one is TIMEOUT. 0 stands for unlimited. Endpoint IN = 0x81
|
||||
|
||||
switch (result) {
|
||||
|
@ -1101,7 +1106,7 @@ class GoldLeaf_08 extends TransferModule {
|
|||
IntBuffer writeBufTransferred = IntBuffer.allocate(1);
|
||||
int result;
|
||||
|
||||
while (! Thread.interrupted()) {
|
||||
while (! task.isCancelled()) {
|
||||
result = LibUsb.bulkTransfer(handlerNS, (byte) 0x01, writeBuffer, writeBufTransferred, 1000); // last one is TIMEOUT. 0 stands for unlimited. Endpoint OUT = 0x01
|
||||
|
||||
switch (result){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue