code clean up
This commit is contained in:
parent
de2c8d76ea
commit
d3acf387d9
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<groupId>com</groupId>
|
<groupId>com</groupId>
|
||||||
<artifactId>cemu_UI</artifactId>
|
<artifactId>cemu_UI</artifactId>
|
||||||
<version>0.2.2-SNAPSHOT</version>
|
<version>0.2.3-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>cemu_UI</name>
|
<name>cemu_UI</name>
|
||||||
|
|
|
@ -168,9 +168,6 @@ public class Main extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// loading settings and initialize UI, dbController.main() loads all databases
|
// loading settings and initialize UI, dbController.main() loads all databases
|
||||||
mainWindowController.init();
|
mainWindowController.init();
|
||||||
mainWindowController.dbController.init();
|
mainWindowController.dbController.init();
|
||||||
|
|
|
@ -559,7 +559,7 @@ public class MainWindowController {
|
||||||
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
|
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
|
||||||
playBtn.setText(playBtnUpdating);
|
playBtn.setText(playBtnUpdating);
|
||||||
playBtn.setDisable(true);
|
playBtn.setDisable(true);
|
||||||
FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
|
FileUtils.copyDirectory(srcDir, destDir);
|
||||||
playBtn.setText(playBtnPlay);
|
playBtn.setText(playBtnPlay);
|
||||||
playBtn.setDisable(false);
|
playBtn.setDisable(false);
|
||||||
LOGGER.info("copying files done!");
|
LOGGER.info("copying files done!");
|
||||||
|
@ -610,7 +610,7 @@ public class MainWindowController {
|
||||||
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
|
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
|
||||||
playBtn.setText(playBtnCopyingFiles);
|
playBtn.setText(playBtnCopyingFiles);
|
||||||
playBtn.setDisable(true);
|
playBtn.setDisable(true);
|
||||||
FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
|
FileUtils.copyDirectory(srcDir, destDir);
|
||||||
playBtn.setText(playBtnPlay);
|
playBtn.setText(playBtnPlay);
|
||||||
playBtn.setDisable(false);
|
playBtn.setDisable(false);
|
||||||
LOGGER.info("copying files done!");
|
LOGGER.info("copying files done!");
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class CloudController {
|
||||||
|
|
||||||
LOGGER.info("synchronization successful!");
|
LOGGER.info("synchronization successful!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
LOGGER.error("There was an error during syncronisation! Please open a new issue on the cemu_UI github page:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -173,12 +173,10 @@ public class CloudController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileToZip.isDirectory()) {
|
if (fileToZip.isDirectory()) {
|
||||||
// System.out.println("+" + zipEntryName);
|
|
||||||
for (File file : fileToZip.listFiles()) {
|
for (File file : fileToZip.listFiles()) {
|
||||||
addDirToZipArchive(zos, file, zipEntryName);
|
addDirToZipArchive(zos, file, zipEntryName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// System.out.println(" " + zipEntryName);
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
FileInputStream fis = new FileInputStream(fileToZip);
|
FileInputStream fis = new FileInputStream(fileToZip);
|
||||||
zos.putNextEntry(new ZipEntry(zipEntryName));
|
zos.putNextEntry(new ZipEntry(zipEntryName));
|
||||||
|
|
|
@ -40,7 +40,6 @@ import com.eclipsesource.json.Json;
|
||||||
import com.eclipsesource.json.JsonArray;
|
import com.eclipsesource.json.JsonArray;
|
||||||
import com.eclipsesource.json.JsonObject;
|
import com.eclipsesource.json.JsonObject;
|
||||||
import com.eclipsesource.json.JsonValue;
|
import com.eclipsesource.json.JsonValue;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
public class UpdateController implements Runnable {
|
public class UpdateController implements Runnable {
|
||||||
|
@ -140,15 +139,15 @@ public class UpdateController implements Runnable {
|
||||||
LOGGER.info("download link: " + browserDownloadUrl);
|
LOGGER.info("download link: " + browserDownloadUrl);
|
||||||
try {
|
try {
|
||||||
// open new Http connection, ProgressMonitorInputStream for downloading the data
|
// open new Http connection, ProgressMonitorInputStream for downloading the data
|
||||||
HttpURLConnection conn = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
|
||||||
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
|
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", connection.getInputStream());
|
||||||
ProgressMonitor pm = pmis.getProgressMonitor();
|
ProgressMonitor pm = pmis.getProgressMonitor();
|
||||||
pm.setMillisToDecideToPopup(0);
|
pm.setMillisToDecideToPopup(0);
|
||||||
pm.setMillisToPopup(0);
|
pm.setMillisToPopup(0);
|
||||||
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
|
pm.setMinimum(0);// set beginning of the progress bar to 0
|
||||||
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
|
pm.setMaximum(connection.getContentLength());// set the end to the file length
|
||||||
FileUtils.copyInputStreamToFile(pmis, new File("cemu_UI_update.jar")); // download update
|
FileUtils.copyInputStreamToFile(pmis, new File("cemu_UI_update.jar")); // download update
|
||||||
org.apache.commons.io.FileUtils.copyFile(new File("cemu_UI_update.jar"), new File("cemu_UI.jar")); // TODO rename update to old name
|
org.apache.commons.io.FileUtils.copyFile(new File("cemu_UI_update.jar"), new File("cemu_UI.jar"));
|
||||||
org.apache.commons.io.FileUtils.deleteQuietly(new File("cemu_UI_update.jar")); // delete update
|
org.apache.commons.io.FileUtils.deleteQuietly(new File("cemu_UI_update.jar")); // delete update
|
||||||
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again
|
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again
|
||||||
System.exit(0); // finishes itself
|
System.exit(0); // finishes itself
|
||||||
|
|
Loading…
Reference in New Issue