code clean up

This commit is contained in:
Jannik 2017-12-26 17:33:14 +01:00
parent de2c8d76ea
commit d3acf387d9
5 changed files with 9 additions and 15 deletions

View File

@ -4,7 +4,7 @@
<groupId>com</groupId>
<artifactId>cemu_UI</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>0.2.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cemu_UI</name>

View File

@ -168,9 +168,6 @@ public class Main extends Application {
}
}
// loading settings and initialize UI, dbController.main() loads all databases
mainWindowController.init();
mainWindowController.dbController.init();

View File

@ -559,7 +559,7 @@ public class MainWindowController {
LOGGER.info("copying the content of " + updatePath + " to " + destDir.toString());
playBtn.setText(playBtnUpdating);
playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
FileUtils.copyDirectory(srcDir, destDir);
playBtn.setText(playBtnPlay);
playBtn.setDisable(false);
LOGGER.info("copying files done!");
@ -610,7 +610,7 @@ public class MainWindowController {
LOGGER.info("copying the content of " + dlcPath + " to " + destDir.toString());
playBtn.setText(playBtnCopyingFiles);
playBtn.setDisable(true);
FileUtils.copyDirectory(srcDir, destDir); // TODO progress indicator
FileUtils.copyDirectory(srcDir, destDir);
playBtn.setText(playBtnPlay);
playBtn.setDisable(false);
LOGGER.info("copying files done!");

View File

@ -143,7 +143,7 @@ public class CloudController {
LOGGER.info("synchronization successful!");
} 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()) {
// System.out.println("+" + zipEntryName);
for (File file : fileToZip.listFiles()) {
addDirToZipArchive(zos, file, zipEntryName);
}
} else {
// System.out.println(" " + zipEntryName);
byte[] buffer = new byte[1024];
FileInputStream fis = new FileInputStream(fileToZip);
zos.putNextEntry(new ZipEntry(zipEntryName));

View File

@ -40,7 +40,6 @@ import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import javafx.application.Platform;
public class UpdateController implements Runnable {
@ -140,15 +139,15 @@ public class UpdateController implements Runnable {
LOGGER.info("download link: " + browserDownloadUrl);
try {
// open new Http connection, ProgressMonitorInputStream for downloading the data
HttpURLConnection conn = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
HttpURLConnection connection = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", connection.getInputStream());
ProgressMonitor pm = pmis.getProgressMonitor();
pm.setMillisToDecideToPopup(0);
pm.setMillisToPopup(0);
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
pm.setMinimum(0);// set beginning of the progress bar to 0
pm.setMaximum(connection.getContentLength());// set the end to the file length
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
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); // start again
System.exit(0); // finishes itself