Skip to content

Commit

Permalink
Updater: Fixed confirmation dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
leosarra committed Dec 8, 2017
1 parent 420461f commit 94f1cc4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gw2_launcher_log_op.txt
/out/
/.settings/
*.class
dependency-reduced-pom.xml
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.lithium</groupId>
<artifactId>Guild_Wars_2_Launcher</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>Guild Wars 2 Launcher</name>

<description>Custom launcher for Guild Wars 2 with the purpose to keep ArcDPS up-to-date and fully functional</description>
Expand Down
2 changes: 1 addition & 1 deletion src/launcher/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class Main {
private static final String username="LithiumSR";
private static final String repoName="gw2_launcher";
private static final String version="1.0.2";
private static final String version="1.0.3";

public static void main(String[] args) throws InterruptedException {

Expand Down
6 changes: 3 additions & 3 deletions src/listeners/MyActionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public void actionPerformed(ActionEvent e) {
cf.startwith.setEnabled(true);
}
else {
int dialogButton=0;
JOptionPane.showConfirmDialog(null,"Would you like to remove ArcDPS' settings files too? \n"
int dialogButton=JOptionPane.YES_NO_OPTION;
int dialogResult=JOptionPane.showConfirmDialog(null,"Would you like to remove ArcDPS' settings files too? \n"
+ "If you are going to install ArcDPS in the future press 'No'. ","Remove settings?",dialogButton);
if (dialogButton==0){
if (dialogResult==JOptionPane.YES_OPTION){
Operations.removeArcSetting(cf, path);
}
Operations.removeArc(cf, path);
Expand Down
10 changes: 5 additions & 5 deletions src/updater/CoreUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ else if (!check && old_dll.exists()){


if(!ini.exists() && (cf.getMode().equals("arc_only"))) { //If ini file is not detected ask to the user if he would like to restore it with a default version from the website
int dialogButton = 0;
int dialogButton = JOptionPane.YES_NO_OPTION;
log.log( Level.INFO,"archdps.ini not found");
JOptionPane.showConfirmDialog(null,"ArcDPS configuration file not found. Would you like to download a default configoration?","ArcDPS configuration file not detected",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION){
int dialogResult = JOptionPane.showConfirmDialog(null,"ArcDPS configuration file not found. Would you like to download a default configoration?","ArcDPS configuration file not detected",dialogButton);
if (dialogResult==JOptionPane.YES_OPTION){
Operations.downloadINI(cf,path); //Method used to download the .ini
}

Expand Down Expand Up @@ -138,9 +138,9 @@ public static void runWithoutDPS(String path){
//Error dialog needed for static methods
public static void errorDialog(String path){
int dialogButton = JOptionPane.YES_NO_OPTION;
JOptionPane.showConfirmDialog(null,"Something went wrong. Check your internet connection. Would you like to run GW2 without ArcDPS?",
int dialogResult = JOptionPane.showConfirmDialog(null,"Something went wrong. Check your internet connection. Would you like to run GW2 without ArcDPS?",
"Updater failed",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION) {
if (dialogResult==JOptionPane.YES_OPTION) {
CoreUpdater.runWithoutDPS(path);
}

Expand Down
14 changes: 7 additions & 7 deletions src/updater/FastUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ else if (!check && !old_dll.exists()){
//if there is not d3d9.dll and no backup it means that ArcDPS is not installed
int dialogButton = JOptionPane.YES_NO_OPTION;
//Ask to the user if he would like to install ArcDPS
JOptionPane.showConfirmDialog(null,"ArcDPS not installed. Would you like to install ArcDPS?","ArcDPS not detected",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION){
int dialogResult=JOptionPane.showConfirmDialog(null,"ArcDPS not installed. Would you like to install ArcDPS?","ArcDPS not detected",dialogButton);
if (dialogResult==JOptionPane.YES_OPTION){
try {
dll.createNewFile(); //placeholder that is going to be updated by updateDll()
} catch (IOException e) {
Expand Down Expand Up @@ -130,10 +130,10 @@ else if (!check && !old_dll.exists()){


if(!ini.exists()) { //If ini file is not detected ask to the user if he would like to restore it with a default version from the website
int dialogButton = 0;
int dialogButton = JOptionPane.YES_NO_OPTION;
log.log( Level.INFO,"archdps.ini not found");
JOptionPane.showConfirmDialog(null,"ArcDPS configuration file not found. Would you like to download a default configoration?","ArcDPS configuration file not detected",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION){
int dialogResult=JOptionPane.showConfirmDialog(null,"ArcDPS configuration file not found. Would you like to download a default configoration?","ArcDPS configuration file not detected",dialogButton);
if (dialogResult==JOptionPane.YES_OPTION){
downloadINI(); //Method used to download the .ini
}

Expand Down Expand Up @@ -273,9 +273,9 @@ public static void runWithoutDPS(String path){
//Error dialog needed for static methods
public static void errorDialog(String path){
int dialogButton = JOptionPane.YES_NO_OPTION;
JOptionPane.showConfirmDialog(null,"Something went wrong. Check your internet connection. Would you like to run GW2 without ArcDPS?",
int dialogResult=JOptionPane.showConfirmDialog(null,"Something went wrong. Check your internet connection. Would you like to run GW2 without ArcDPS?",
"Updater failed",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION) {
if (dialogResult==JOptionPane.YES_OPTION) {
log.log( Level.INFO,"Launching gw2 without Arc after error dialog");
FastUpdater.runWithoutDPS(path);
}
Expand Down
6 changes: 3 additions & 3 deletions src/updater/UpdateNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public void run() {
if (sem.isGreaterThan(version)) {
String URI="http://www.github.com/"+username+"/"+repoName+"/releases";
logger.log(Level.SEVERE,"An update is avaiable. Please get the update at "+URI);
int dialogButton=0;
JOptionPane.showConfirmDialog(null,"An update for the launcher is avaiable. Would you like to go to the download page?","An update is avaiable",dialogButton);
if (dialogButton==JOptionPane.YES_OPTION){
int dialogButton=JOptionPane.YES_NO_OPTION;
int dialogResult=JOptionPane.showConfirmDialog(null,"An update for the launcher is avaiable. Would you like to go to the download page?","An update is avaiable",dialogButton);
if (dialogResult==JOptionPane.YES_OPTION){
try {
java.awt.Desktop.getDesktop().browse(new java.net.URI(URI));
} catch (IOException | URISyntaxException e) {
Expand Down

0 comments on commit 94f1cc4

Please sign in to comment.