mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-31 23:38:23 -04:00
Merge 9bbe695a03
into d382181700
This commit is contained in:
commit
b45f2135c1
2 changed files with 56 additions and 2 deletions
|
@ -21,8 +21,15 @@ package nsusbloader.cli;
|
|||
import nsusbloader.com.net.NETCommunications;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TinfoilNetCli {
|
||||
|
||||
|
@ -119,8 +126,16 @@ public class TinfoilNetCli {
|
|||
|
||||
for (; parseFileSince < arguments.length; parseFileSince++) {
|
||||
file = new File(arguments[parseFileSince]);
|
||||
if (file.exists())
|
||||
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
filesList.addAll(fillListOfFiles(file));
|
||||
} else {
|
||||
filesList.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (filesList.size() == 0) {
|
||||
|
@ -129,6 +144,19 @@ public class TinfoilNetCli {
|
|||
}
|
||||
}
|
||||
|
||||
public List<File> fillListOfFiles(File rootDir) {
|
||||
try (Stream<Path> stream = Files.walk(rootDir.toPath())) {
|
||||
return stream
|
||||
.map(Path::toFile)
|
||||
.filter(File::isFile)
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void runTinfoilNetBackend() throws InterruptedException{
|
||||
NETCommunications netCommunications = new NETCommunications(
|
||||
filesList,
|
||||
|
|
|
@ -21,8 +21,14 @@ package nsusbloader.cli;
|
|||
import nsusbloader.com.usb.UsbCommunications;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TinfoilUsbCli {
|
||||
|
||||
|
@ -49,8 +55,15 @@ public class TinfoilUsbCli {
|
|||
|
||||
for (String arg : arguments) {
|
||||
file = new File(arg);
|
||||
if (file.exists())
|
||||
if (!file.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file.isDirectory()) {
|
||||
filesList.addAll(fillListOfFiles(file));
|
||||
} else {
|
||||
filesList.add(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (filesList.size() == 0) {
|
||||
|
@ -59,6 +72,19 @@ public class TinfoilUsbCli {
|
|||
}
|
||||
}
|
||||
|
||||
public List<File> fillListOfFiles(File rootDir) {
|
||||
try (Stream<Path> stream = Files.walk(rootDir.toPath())) {
|
||||
return stream
|
||||
.map(Path::toFile)
|
||||
.filter(File::isFile)
|
||||
.collect(Collectors.toList());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void runTinfoilBackend() throws InterruptedException{
|
||||
Runnable task = new UsbCommunications(filesList, "TinFoil", false);
|
||||
Thread thread = new Thread(task);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue