Compare commits

..

No commits in common. "dc995e1bae2fffd995309b5227d8f940e3ddf888" and "3690c63399172dc9d254942d0cd6fea6eff6c189" have entirely different histories.

3 changed files with 6 additions and 70 deletions

View file

@ -61,11 +61,6 @@ public class CommandLineInterface {
new TinfoilNet(tfnArguments);
return;
}
if (cli.hasOption("t") || cli.hasOption("tinfoil")){
final String[] tfArguments = cli.getOptionValues("tinfoil");
new TinfoilUsb(tfArguments);
return;
}
}
catch (ParseException pe){
System.out.println(pe.getLocalizedMessage() +
@ -121,13 +116,6 @@ public class CommandLineInterface {
.hasArgs()
.argName("...")
.build();
/* Tinfoil/Awoo USB */
final Option tinfoilOption = Option.builder("t")
.longOpt("tinfoil")
.desc("Install via Tinfoil/Awoo USB mode.")
.hasArgs()
.argName("FILE1 ...")
.build();
final OptionGroup group = new OptionGroup();
@ -136,7 +124,6 @@ public class CommandLineInterface {
group.addOption(cleanSettingsOption);
group.addOption(versionOption);
group.addOption(helpOption);
group.addOption(tinfoilOption);
options.addOptionGroup(group);

View file

@ -27,7 +27,7 @@ import java.util.List;
// TODO: Add 'don't serve requests' option
public class TinfoilNet {
private final String[] arguments;
private String[] arguments;
private String nsIp;
@ -43,7 +43,7 @@ public class TinfoilNet {
this.arguments = arguments;
checkArguments();
parseNsIP();
parseHostSettings();
parseHostIPAndExtras();
parseFilesArguments();
runTinfoilNetBackend();
}
@ -73,8 +73,8 @@ public class TinfoilNet {
private boolean isHelpDirective(String argument){
return argument.equals("help");
}
private void showHelp() throws IncorrectSetupException{
throw new IncorrectSetupException("Usage:\n"
private void showHelp(){
System.out.println("Usage:\n"
+ "\tns-usbloader -n nsip=<arg1> [hostip=<arg2>] FILE1 ...\n"
+ "\tns-usbloader --tfn nsip=<arg1> [hostip=<arg2>] FILE1 ..."
+ "\n\nOptions:"
@ -96,7 +96,7 @@ public class TinfoilNet {
"Try 'ns-usbloader -n help' for more information.");
}
private void parseHostSettings(){
private void parseHostIPAndExtras(){
String argument2 = arguments[1];
if (! argument2.startsWith("hostip="))
@ -123,7 +123,7 @@ public class TinfoilNet {
}
if (filesList.size() == 0) {
throw new IncorrectSetupException("File(s) doesn't exist.\n" +
throw new IncorrectSetupException("File(s) doesn't exists.\n" +
"Try 'ns-usbloader -n help' for more information.");
}
}

View file

@ -1,51 +0,0 @@
package nsusbloader.cli;
import nsusbloader.COM.ICommunications;
import nsusbloader.COM.USB.UsbCommunications;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class TinfoilUsb {
private final String[] arguments;
private List<File> filesList;
public TinfoilUsb(String[] arguments) throws InterruptedException, IncorrectSetupException{
this.arguments = arguments;
checkArguments();
parseFilesArguments();
runTinfoilBackend();
}
private void checkArguments() throws IncorrectSetupException{
if (arguments == null || arguments.length == 0) {
throw new IncorrectSetupException("No files?\n" +
"Try 'ns-usbloader -h' for more information.");
}
}
private void parseFilesArguments() throws IncorrectSetupException{
filesList = new ArrayList<>();
File file;
for (String arg : arguments) {
file = new File(arg);
if (file.exists())
filesList.add(file);
}
if (filesList.size() == 0) {
throw new IncorrectSetupException("File(s) doesn't exist.\n" +
"Try 'ns-usbloader -n help' for more information.");
}
}
private void runTinfoilBackend() throws InterruptedException{
ICommunications task = new UsbCommunications(filesList, "TinFoil", false);
Thread thread = new Thread(task);
thread.start();
thread.join();
}
}