updated to 0.4.0

This commit is contained in:
Jannik 2016-11-18 09:41:38 +01:00 committed by GitHub
parent 684fb45df4
commit 1077ff304a
2 changed files with 23 additions and 24 deletions

View File

@ -87,8 +87,8 @@ public class Main extends Application {
mainWindowController.setLoaclUI(local); mainWindowController.setLoaclUI(local);
mainWindowController.setMode(mode); mainWindowController.setMode(mode);
mainWindowController.saveSettings(); mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu um Bugs zu verhindern Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //beendet sich selbst System.exit(0); //finishes itself
}else{ }else{
loadSettings(); loadSettings();
} }
@ -102,8 +102,8 @@ public class Main extends Application {
mainWindowController.setLoaclUI(local); mainWindowController.setLoaclUI(local);
mainWindowController.setMode(mode); mainWindowController.setMode(mode);
mainWindowController.saveSettings(); mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu um Bugs zu verhindern Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again (preventing Bugs)
System.exit(0); //beendet sich selbst System.exit(0); //finishes itself
} }
mainWindowController.loadStreamingSettings(); mainWindowController.loadStreamingSettings();
mainWindowController.applyColor(); //setzt die Theme Farbe mainWindowController.applyColor(); //setzt die Theme Farbe

View File

@ -26,7 +26,6 @@ import java.io.BufferedReader;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
@ -190,9 +189,10 @@ public class MainWindowController {
private boolean menutrue = false; //saves the position of menubtn (opened or closed) private boolean menutrue = false; //saves the position of menubtn (opened or closed)
private boolean settingstrue = false; private boolean settingstrue = false;
private boolean streamingSettingsTrue = false; private boolean streamingSettingsTrue = false;
private String version = "0.3.9"; private String version = "0.4.0";
private String buildNumber = "100";
private String versionName = "glowing bucket"; private String versionName = "glowing bucket";
private String versionURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/version.txt"; private String buildURL = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/buildNumber.txt";
private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt"; private String downloadLink = "https://raw.githubusercontent.com/Seil0/Project-HomeFlix/master/updates/downloadLink.txt";
private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix"); private File dir = new File(System.getProperty("user.home") + "/Documents/HomeFlix");
private File file = new File(dir + "/config.xml"); private File file = new File(dir + "/config.xml");
@ -206,7 +206,7 @@ public class MainWindowController {
private String infoText; private String infoText;
private String linuxBugText; private String linuxBugText;
private String vlcNotInstalled; private String vlcNotInstalled;
private String aktVersion; private String aktBuildNumber;
private String path; private String path;
private String streamingPath; private String streamingPath;
private String color; private String color;
@ -323,7 +323,6 @@ public class MainWindowController {
try { try {
Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad Desktop.getDesktop().open(new File(getPath())); //öffnet den aktuellen Pfad
} catch (IOException e) { } catch (IOException e) {
// Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -505,8 +504,6 @@ public class MainWindowController {
}else{ }else{
autoupdateBtn.setSelected(false); autoupdateBtn.setSelected(false);
} }
versionlbl.setText("Version: "+version);
ta1.setWrapText(true); ta1.setWrapText(true);
ta1.setEditable(false); ta1.setEditable(false);
@ -623,20 +620,22 @@ public class MainWindowController {
//prüft auf Update und fürht es gegebenenfalls aus //prüft auf Update und fürht es gegebenenfalls aus
private void update(){ private void update(){
System.out.println("check for updates ..."); System.out.println("check for updates ...");
try { try {
URL url = new URL(versionURL); //URL der Datei mit aktueller Versionsnummer URL url = new URL(buildURL); //URL der Datei mit aktueller Versionsnummer
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
aktVersion = in.readLine(); //schreibt inputstream in String aktBuildNumber = in.readLine(); //schreibt inputstream in String
in.close(); in.close();
} catch (IOException e1) { } catch (IOException e1) {
showErrorMsg(errorUpdateV, e1); showErrorMsg(errorUpdateV, e1);
} }
System.out.println("Version: "+version+", Update: "+aktVersion); System.out.println("Build: "+buildNumber+", Update: "+aktBuildNumber);
//vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrf�hrt //vergleicht die Versionsnummern, bei aktversion > version wird ein Update durchgrf�hrt
int iversion = Integer.parseInt(version.replace(".", "")); int iversion = Integer.parseInt(buildNumber.replace(".", ""));
int iaktVersion = Integer.parseInt(aktVersion.replace(".", "")); int iaktVersion = Integer.parseInt(aktBuildNumber.replace(".", ""));
if(iversion >= iaktVersion){ if(iversion >= iaktVersion){
updateBtn.setText(bundle.getString("updateBtnNotavail")); updateBtn.setText(bundle.getString("updateBtnNotavail"));
@ -650,12 +649,12 @@ public class MainWindowController {
BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream())); BufferedReader in = new BufferedReader(new InputStreamReader(downloadURL.openStream()));
updateDataURL = in.readLine(); updateDataURL = in.readLine();
website = new URL(updateDataURL); //Update URL website = new URL(updateDataURL); //Update URL
ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //<EFBFBD>ffnet neuen Stream/Channel ReadableByteChannel rbc = Channels.newChannel(website.openStream()); //open new Stream/Channel
FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //neuer fileoutputstram f<EFBFBD>r ProjectHomeFLix.jar FileOutputStream fos = new FileOutputStream("ProjectHomeFlix.jar"); //nea fileoutputstram for ProjectHomeFLix.jar
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //holt datei von 0 bis max gr<EFBFBD><EFBFBD>e fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); //gets file from 0 to max size
fos.close(); //schlie<EFBFBD>t den fos (extrem wichtig!) fos.close(); //close fos (extrem wichtig!)
Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //starte neu Runtime.getRuntime().exec("java -jar ProjectHomeFlix.jar"); //start again
System.exit(0); //beendet sich selbst System.exit(0); //finishes itself
} catch (IOException e) { } catch (IOException e) {
//in case there is an error //in case there is an error
showErrorMsg(errorUpdateD, e); showErrorMsg(errorUpdateD, e);
@ -869,7 +868,7 @@ public class MainWindowController {
streamingDirectoryBtn.setText(bundle.getString("chooseFolder")); streamingDirectoryBtn.setText(bundle.getString("chooseFolder"));
sizelbl.setText(bundle.getString("fontSize")); sizelbl.setText(bundle.getString("fontSize"));
aulbl.setText(bundle.getString("autoUpdate")); aulbl.setText(bundle.getString("autoUpdate"));
versionlbl.setText(bundle.getString("version")+" "+version); versionlbl.setText(bundle.getString("version")+" "+version+" (Build: "+buildNumber+")");
columnTitel.setText(bundle.getString("columnName")); columnTitel.setText(bundle.getString("columnName"));
columnRating.setText(bundle.getString("columnRating")); columnRating.setText(bundle.getString("columnRating"));
columnStreamUrl.setText(bundle.getString("columnStreamUrl")); columnStreamUrl.setText(bundle.getString("columnStreamUrl"));
@ -881,7 +880,7 @@ public class MainWindowController {
errorPlay = bundle.getString("errorPlay"); errorPlay = bundle.getString("errorPlay");
errorOpenStream = bundle.getString("errorOpenStream"); errorOpenStream = bundle.getString("errorOpenStream");
errorMode = bundle.getString("errorMode"); errorMode = bundle.getString("errorMode");
infoText = bundle.getString("version")+" "+version+" "+versionName+bundle.getString("infoText"); infoText = bundle.getString("version")+" "+version+" (Build: "+buildNumber+") "+versionName+bundle.getString("infoText");
linuxBugText = bundle.getString("linuxBug"); linuxBugText = bundle.getString("linuxBug");
vlcNotInstalled = bundle.getString("vlcNotInstalled"); vlcNotInstalled = bundle.getString("vlcNotInstalled");
} }