Skip to content

Commit

Permalink
Added Close program and Launch Game feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jani-e committed Dec 17, 2022
1 parent 96d3548 commit e0723c5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/main/java/com/gw2/arcdpsdownloadergw2/Downloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/
package com.gw2.arcdpsdownloadergw2;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/gw2/arcdpsdownloadergw2/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package com.gw2.arcdpsdownloadergw2;

import java.io.IOException;
import java.util.Scanner;

/**
Expand All @@ -25,6 +26,7 @@ public void start() {
System.out.println("\n--------\nOptions\n--------");
System.out.println("1 - Download latest Arcdps");
System.out.println("2 - Remove Arcdps");
System.out.println("3 - Close and Launch Guild Wars 2");
System.out.println("0 - Close program");
System.out.print("\nOption: ");
int input = Integer.parseInt(this.scanner.nextLine());
Expand All @@ -35,9 +37,23 @@ public void start() {
case 2:
this.fileHandler.removeFile();
break;
case 3:
closeAndLaunch();
return;
default:
return;
}
}
}

public void closeAndLaunch() {
String programPath = "C:\\Program Files\\Guild Wars 2\\Gw2-64.exe";
String args = "-clientport 443 -autologin -bmp";
ProcessBuilder builder = new ProcessBuilder(programPath, args);
try {
builder.start();
} catch (IOException ex) {
System.out.println(ex);
}
}
}

0 comments on commit e0723c5

Please sign in to comment.