updated some libs, code clean up
* openjfx 11 -> 11.0.1 * jfoenix 9.0.6 -> 9.0.8 * sqlite-jdbc 3.23.2 -> 3.25.2 * google-api-services-drive rev129 -> rev136 * jackson-core 2.9.6 -> 2.9.7
This commit is contained in:
parent
87eaec31ee
commit
3f6eeece7d
62
pom.xml
62
pom.xml
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<groupId>com</groupId>
|
<groupId>com</groupId>
|
||||||
<artifactId>cemu_UI</artifactId>
|
<artifactId>cemu_UI</artifactId>
|
||||||
<version>0.3.1-SNAPSHOT</version>
|
<version>0.3.2-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>cemu_UI</name>
|
<name>cemu_UI</name>
|
||||||
<description>cemu_UI is a simple, material design graphical frontend for cemu, a Wii U emulator</description>
|
<description>cemu_UI is a simple, material design graphical frontend for cemu, a Wii U emulator</description>
|
||||||
|
@ -27,25 +27,25 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-controls</artifactId>
|
<artifactId>javafx-controls</artifactId>
|
||||||
<version>11</version>
|
<version>11.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-fxml</artifactId>
|
<artifactId>javafx-fxml</artifactId>
|
||||||
<version>11</version>
|
<version>11.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjfx</groupId>
|
<groupId>org.openjfx</groupId>
|
||||||
<artifactId>javafx-media</artifactId>
|
<artifactId>javafx-media</artifactId>
|
||||||
<version>11</version>
|
<version>11.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jfoenix</groupId>
|
<groupId>com.jfoenix</groupId>
|
||||||
<artifactId>jfoenix</artifactId>
|
<artifactId>jfoenix</artifactId>
|
||||||
<version>9.0.6</version>
|
<version>9.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.23.1</version>
|
<version>3.25.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -92,14 +92,6 @@
|
||||||
<version>1.11</version>
|
<version>1.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/io.datafx/flow -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.datafx</groupId>
|
|
||||||
<artifactId>flow</artifactId>
|
|
||||||
<version>8.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
|
<!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.lingala.zip4j</groupId>
|
<groupId>net.lingala.zip4j</groupId>
|
||||||
|
@ -115,18 +107,11 @@
|
||||||
<version>1.1.1</version>
|
<version>1.1.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.api-client</groupId>
|
|
||||||
<artifactId>google-api-client</artifactId>
|
|
||||||
<version>1.25.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.apis/google-api-services-drive -->
|
<!-- https://mvnrepository.com/artifact/com.google.apis/google-api-services-drive -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.apis</groupId>
|
<groupId>com.google.apis</groupId>
|
||||||
<artifactId>google-api-services-drive</artifactId>
|
<artifactId>google-api-services-drive</artifactId>
|
||||||
<version>v3-rev129-1.25.0</version>
|
<version>v3-rev136-1.25.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
|
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
|
||||||
|
@ -143,20 +128,6 @@
|
||||||
<version>1.25.0</version>
|
<version>1.25.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.oauth-client</groupId>
|
|
||||||
<artifactId>google-oauth-client</artifactId>
|
|
||||||
<version>1.25.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.oauth-client</groupId>
|
|
||||||
<artifactId>google-oauth-client-java6</artifactId>
|
|
||||||
<version>1.25.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
|
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.oauth-client</groupId>
|
<groupId>com.google.oauth-client</groupId>
|
||||||
|
@ -168,15 +139,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>2.9.6</version>
|
<version>2.9.7</version>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>4.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
|
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
|
||||||
|
@ -186,13 +149,6 @@
|
||||||
<version>6.1.26</version>
|
<version>6.1.26</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mortbay.jetty</groupId>
|
|
||||||
<artifactId>jetty-util</artifactId>
|
|
||||||
<version>6.1.26</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -229,7 +185,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.2.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
|
|
@ -57,6 +57,7 @@ import com.cemu_UI.controller.DBController;
|
||||||
import com.cemu_UI.controller.SmmdbAPIController;
|
import com.cemu_UI.controller.SmmdbAPIController;
|
||||||
import com.cemu_UI.controller.UpdateController;
|
import com.cemu_UI.controller.UpdateController;
|
||||||
import com.cemu_UI.datatypes.CourseTableDataType;
|
import com.cemu_UI.datatypes.CourseTableDataType;
|
||||||
|
import com.cemu_UI.datatypes.GlobalDataTypes.CloudService;
|
||||||
import com.cemu_UI.datatypes.SmmdbApiDataType;
|
import com.cemu_UI.datatypes.SmmdbApiDataType;
|
||||||
import com.cemu_UI.datatypes.UIROMDataType;
|
import com.cemu_UI.datatypes.UIROMDataType;
|
||||||
import com.cemu_UI.uiElements.JFXEditGameDialog;
|
import com.cemu_UI.uiElements.JFXEditGameDialog;
|
||||||
|
@ -109,130 +110,73 @@ import net.lingala.zip4j.exception.ZipException;
|
||||||
|
|
||||||
public class MainWindowController {
|
public class MainWindowController {
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXButton aboutBtn;
|
||||||
private JFXButton aboutBtn;
|
@FXML private JFXButton settingsBtn;
|
||||||
@FXML
|
@FXML private JFXButton addBtn;
|
||||||
private JFXButton settingsBtn;
|
@FXML private JFXButton reloadRomsBtn;
|
||||||
@FXML
|
@FXML private JFXButton smmdbBtn;
|
||||||
private JFXButton addBtn;
|
@FXML private JFXButton cemuTFBtn;
|
||||||
@FXML
|
@FXML private JFXButton romTFBtn;
|
||||||
private JFXButton reloadRomsBtn;
|
@FXML private JFXButton updateBtn;
|
||||||
@FXML
|
@FXML private JFXButton smmdbDownloadBtn;
|
||||||
private JFXButton smmdbBtn;
|
@FXML private JFXButton playBtn;
|
||||||
@FXML
|
@FXML private JFXButton lastTimePlayedBtn;
|
||||||
private JFXButton cemuTFBtn;
|
@FXML JFXButton totalPlaytimeBtn;
|
||||||
@FXML
|
|
||||||
private JFXButton romTFBtn;
|
|
||||||
@FXML
|
|
||||||
private JFXButton updateBtn;
|
|
||||||
@FXML
|
|
||||||
private JFXButton smmdbDownloadBtn;
|
|
||||||
@FXML
|
|
||||||
private JFXButton playBtn;
|
|
||||||
@FXML
|
|
||||||
private JFXButton lastTimePlayedBtn;
|
|
||||||
@FXML
|
|
||||||
JFXButton totalPlaytimeBtn;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXHamburger menuHam;
|
||||||
private JFXHamburger menuHam;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXTextField cemuTextField;
|
||||||
private JFXTextField cemuTextField;
|
@FXML private JFXTextField romTextField;
|
||||||
@FXML
|
@FXML private JFXTextField courseSearchTextFiled;
|
||||||
private JFXTextField romTextField;
|
@FXML private JFXTextField executeCommandTextFiled;
|
||||||
@FXML
|
|
||||||
private JFXTextField courseSearchTextFiled;
|
|
||||||
@FXML
|
|
||||||
private JFXTextField executeCommandTextFiled;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private TextFlow smmdbTextFlow;
|
||||||
private TextFlow smmdbTextFlow;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXColorPicker colorPicker;
|
||||||
private JFXColorPicker colorPicker;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXToggleButton cloudSyncToggleBtn;
|
||||||
private JFXToggleButton cloudSyncToggleBtn;
|
@FXML private JFXToggleButton autoUpdateToggleBtn;
|
||||||
@FXML
|
@FXML private JFXToggleButton fullscreenToggleBtn;
|
||||||
private JFXToggleButton autoUpdateToggleBtn;
|
|
||||||
@FXML
|
|
||||||
private JFXToggleButton fullscreenToggleBtn;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private ChoiceBox<String> languageChoisBox;
|
||||||
private ChoiceBox<String> languageChoisBox;
|
@FXML private ChoiceBox<String> branchChoisBox;
|
||||||
@FXML
|
|
||||||
private ChoiceBox<String> branchChoisBox;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private AnchorPane mainAnchorPane;
|
||||||
private AnchorPane mainAnchorPane;
|
@FXML private AnchorPane gamesAnchorPane;
|
||||||
@FXML
|
@FXML private AnchorPane settingsAnchorPane;
|
||||||
private AnchorPane gamesAnchorPane;
|
@FXML private AnchorPane smmdbAnchorPane;
|
||||||
@FXML
|
|
||||||
private AnchorPane settingsAnchorPane;
|
|
||||||
@FXML
|
|
||||||
private AnchorPane smmdbAnchorPane;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private ScrollPane mainScrollPane;
|
||||||
private ScrollPane mainScrollPane;
|
@FXML private ScrollPane settingsScrollPane;
|
||||||
@FXML
|
@FXML private ScrollPane smmdbScrollPane;
|
||||||
private ScrollPane settingsScrollPane;
|
@FXML private ScrollPane smmdbImageViewScrollPane;
|
||||||
@FXML
|
|
||||||
private ScrollPane smmdbScrollPane;
|
|
||||||
@FXML
|
|
||||||
private ScrollPane smmdbImageViewScrollPane;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private VBox sideMenuVBox;
|
||||||
private VBox sideMenuVBox;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private HBox topHBox;
|
||||||
private HBox topHBox;
|
@FXML private HBox bottomHBox;
|
||||||
@FXML
|
|
||||||
private HBox bottomHBox;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private ImageView smmdbImageView;
|
||||||
private ImageView smmdbImageView;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private Label helpLbl;
|
||||||
private Label helpLbl;
|
@FXML private Label cemu_UISettingsLbl;
|
||||||
@FXML
|
@FXML private Label cemuDirectoryLbl;
|
||||||
private Label cemu_UISettingsLbl;
|
@FXML private Label romDirectoryLbl;
|
||||||
@FXML
|
@FXML private Label mainColorLbl;
|
||||||
private Label cemuDirectoryLbl;
|
@FXML private Label languageLbl;
|
||||||
@FXML
|
@FXML private Label updateLbl;
|
||||||
private Label romDirectoryLbl;
|
@FXML private Label branchLbl;
|
||||||
@FXML
|
@FXML private Label cemuSettingsLbl;
|
||||||
private Label mainColorLbl;
|
@FXML private Label licensesLbl;
|
||||||
@FXML
|
|
||||||
private Label languageLbl;
|
|
||||||
@FXML
|
|
||||||
private Label updateLbl;
|
|
||||||
@FXML
|
|
||||||
private Label branchLbl;
|
|
||||||
@FXML
|
|
||||||
private Label cemuSettingsLbl;
|
|
||||||
@FXML
|
|
||||||
private Label licensesLbl;
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
|
||||||
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
|
|
||||||
|
|
||||||
@FXML
|
@FXML private TreeItem<CourseTableDataType> root = new TreeItem<>(new CourseTableDataType("", "", 0, 0));
|
||||||
private TreeItem<CourseTableDataType> root = new TreeItem<>(new CourseTableDataType("", "", 0, 0));
|
|
||||||
|
|
||||||
@FXML
|
@FXML private JFXTreeTableColumn<CourseTableDataType, String> titleColumn = new JFXTreeTableColumn<>("title");
|
||||||
private JFXTreeTableColumn<CourseTableDataType, String> titleColumn = new JFXTreeTableColumn<>("title");
|
@FXML private JFXTreeTableColumn<CourseTableDataType, String> idColumn = new JFXTreeTableColumn<>("id");
|
||||||
@FXML
|
@FXML private JFXTreeTableColumn<CourseTableDataType, Integer> starsColumn = new JFXTreeTableColumn<>("stars");
|
||||||
private JFXTreeTableColumn<CourseTableDataType, String> idColumn = new JFXTreeTableColumn<>("id");
|
@FXML private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
|
||||||
@FXML
|
|
||||||
private JFXTreeTableColumn<CourseTableDataType, Integer> starsColumn = new JFXTreeTableColumn<>("stars");
|
|
||||||
@FXML
|
|
||||||
private JFXTreeTableColumn<CourseTableDataType, Integer> timeColumn = new JFXTreeTableColumn<>("time");
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private enum CloudService {
|
|
||||||
GoogleDrive, Dropbox
|
|
||||||
}
|
|
||||||
|
|
||||||
private Main main;
|
private Main main;
|
||||||
private DBController dbController;
|
private DBController dbController;
|
||||||
|
@ -248,7 +192,7 @@ public class MainWindowController {
|
||||||
private boolean useBeta = false;
|
private boolean useBeta = false;
|
||||||
private boolean fullscreen;
|
private boolean fullscreen;
|
||||||
private boolean cloudSync;
|
private boolean cloudSync;
|
||||||
private String cloudService = ""; // set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
|
private CloudService cloudService;
|
||||||
private String cemuPath;
|
private String cemuPath;
|
||||||
private String romDirectoryPath;
|
private String romDirectoryPath;
|
||||||
private String gameExecutePath;
|
private String gameExecutePath;
|
||||||
|
@ -257,8 +201,8 @@ public class MainWindowController {
|
||||||
private String selectedGameTitleID;
|
private String selectedGameTitleID;
|
||||||
private String selectedGameTitle;
|
private String selectedGameTitle;
|
||||||
private String id;
|
private String id;
|
||||||
private String version = "0.3.1";
|
private String version = "0.3.2";
|
||||||
private String buildNumber = "081";
|
private String buildNumber = "085";
|
||||||
private String versionName = "Purple Comet";
|
private String versionName = "Purple Comet";
|
||||||
private int xPos = -200;
|
private int xPos = -200;
|
||||||
private int yPos = 17;
|
private int yPos = 17;
|
||||||
|
@ -1020,7 +964,7 @@ public class MainWindowController {
|
||||||
cloudSync = true;
|
cloudSync = true;
|
||||||
//TODO rework for other cloud services
|
//TODO rework for other cloud services
|
||||||
// CloudService service = CloudService.GoogleDrive;
|
// CloudService service = CloudService.GoogleDrive;
|
||||||
cloudService = "GoogleDrive";
|
cloudService = CloudService.GoogleDrive;
|
||||||
|
|
||||||
// start cloud sync in new thread
|
// start cloud sync in new thread
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
@ -1606,7 +1550,7 @@ public class MainWindowController {
|
||||||
if (getCloudService() == null) {
|
if (getCloudService() == null) {
|
||||||
props.setProperty("cloudService", "");
|
props.setProperty("cloudService", "");
|
||||||
} else {
|
} else {
|
||||||
props.setProperty("cloudService", getCloudService());
|
props.setProperty("cloudService", getCloudService().toString());
|
||||||
}
|
}
|
||||||
props.setProperty("folderID", main.getCloudController().getFolderID(getCloudService()));
|
props.setProperty("folderID", main.getCloudController().getFolderID(getCloudService()));
|
||||||
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
props.setProperty("lastLocalSync", String.valueOf(getLastLocalSync()));
|
||||||
|
@ -1689,10 +1633,19 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setCloudService(props.getProperty("cloudService"));
|
switch (props.getProperty("cloudService")) {
|
||||||
|
case "GoogleDrive":
|
||||||
|
setCloudService(CloudService.GoogleDrive);
|
||||||
|
break;
|
||||||
|
case "Dropbox":
|
||||||
|
setCloudService(CloudService.Dropbox);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("could not load cloudSync", e);
|
LOGGER.error("could not load cloudSync", e);
|
||||||
setCloudService("");
|
setCloudService(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1920,11 +1873,11 @@ public class MainWindowController {
|
||||||
this.selectedGameTitleID = selectedGameTitleID;
|
this.selectedGameTitleID = selectedGameTitleID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCloudService() {
|
public CloudService getCloudService() {
|
||||||
return cloudService;
|
return cloudService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCloudService(String cloudService) {
|
public void setCloudService(CloudService cloudService) {
|
||||||
this.cloudService = cloudService;
|
this.cloudService = cloudService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import com.cemu_UI.application.MainWindowController;
|
import com.cemu_UI.application.MainWindowController;
|
||||||
|
import com.cemu_UI.datatypes.GlobalDataTypes.CloudService;
|
||||||
import com.cemu_UI.vendorCloudController.GoogleDriveController;
|
import com.cemu_UI.vendorCloudController.GoogleDriveController;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -48,11 +49,11 @@ public class CloudController {
|
||||||
private GoogleDriveController googleDriveController = new GoogleDriveController();
|
private GoogleDriveController googleDriveController = new GoogleDriveController();
|
||||||
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
|
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
|
||||||
|
|
||||||
public boolean initializeConnection(String cloudService, String cemuDirectory) {
|
public boolean initializeConnection(CloudService cloudService, String cemuDirectory) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
LOGGER.info("sartting cloud initialisation ...");
|
LOGGER.info("sartting cloud initialisation ...");
|
||||||
|
|
||||||
if(cloudService.equals("GoogleDrive")) {
|
if(cloudService == CloudService.GoogleDrive) {
|
||||||
LOGGER.info("selected service is Google Drive");
|
LOGGER.info("selected service is Google Drive");
|
||||||
try {
|
try {
|
||||||
googleDriveController.main(cemuDirectory);
|
googleDriveController.main(cemuDirectory);
|
||||||
|
@ -63,7 +64,7 @@ public class CloudController {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cloudService.equals("Dropbox")) {
|
if(cloudService == CloudService.Dropbox) {
|
||||||
LOGGER.info("selected service is Dropbox");
|
LOGGER.info("selected service is Dropbox");
|
||||||
}
|
}
|
||||||
LOGGER.info("cloud initialisation done!");
|
LOGGER.info("cloud initialisation done!");
|
||||||
|
@ -76,7 +77,7 @@ public class CloudController {
|
||||||
* @param cemuDirectory
|
* @param cemuDirectory
|
||||||
* @param cemu_UIDirectory
|
* @param cemu_UIDirectory
|
||||||
*/
|
*/
|
||||||
public void sync(String cloudService, String cemuDirectory, String cemu_UIDirectory) {
|
public void sync(CloudService cloudService, String cemuDirectory, String cemu_UIDirectory) {
|
||||||
|
|
||||||
// running sync in a new thread, instead of blocking the main thread
|
// running sync in a new thread, instead of blocking the main thread
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
|
@ -88,18 +89,18 @@ public class CloudController {
|
||||||
mwc.getPlayBtn().setText("syncing...");
|
mwc.getPlayBtn().setText("syncing...");
|
||||||
});
|
});
|
||||||
LOGGER.info("starting synchronization in new thread ...");
|
LOGGER.info("starting synchronization in new thread ...");
|
||||||
|
|
||||||
// zip the saves folder
|
// zip the saves folder
|
||||||
File zipFile = zipSavegames(cemu_UIDirectory, cemuDirectory);
|
File zipFile = zipSavegames(cemu_UIDirectory, cemuDirectory);
|
||||||
|
|
||||||
// upload the zip
|
// upload the zip
|
||||||
switch (cloudService) {
|
switch (cloudService) {
|
||||||
|
|
||||||
// use GoogleDriveController
|
// use GoogleDriveController
|
||||||
case "GoogleDrive":
|
case GoogleDrive:
|
||||||
LOGGER.info("using GoogleDriveController");
|
LOGGER.info("using GoogleDriveController");
|
||||||
long lastCloudSync = googleDriveController.getLastCloudSync();
|
long lastCloudSync = googleDriveController.getLastCloudSync();
|
||||||
|
|
||||||
if (!googleDriveController.checkFolder()) {
|
if (!googleDriveController.checkFolder()) {
|
||||||
LOGGER.info("cloud sync folder dosen't exist, creating one!");
|
LOGGER.info("cloud sync folder dosen't exist, creating one!");
|
||||||
googleDriveController.creatFolder();
|
googleDriveController.creatFolder();
|
||||||
|
@ -107,7 +108,7 @@ public class CloudController {
|
||||||
} else if (mwc.getLastLocalSync() > lastCloudSync) {
|
} else if (mwc.getLastLocalSync() > lastCloudSync) {
|
||||||
LOGGER.info("local is new, going to upload zip");
|
LOGGER.info("local is new, going to upload zip");
|
||||||
googleDriveController.uploadZipFile(zipFile);
|
googleDriveController.uploadZipFile(zipFile);
|
||||||
} else if(mwc.getLastLocalSync() < lastCloudSync) {
|
} else if (mwc.getLastLocalSync() < lastCloudSync) {
|
||||||
LOGGER.info("cloud is new, going to download zip");
|
LOGGER.info("cloud is new, going to download zip");
|
||||||
unzipSavegames(cemuDirectory, googleDriveController.downloadZipFile(cemu_UIDirectory));
|
unzipSavegames(cemuDirectory, googleDriveController.downloadZipFile(cemu_UIDirectory));
|
||||||
mwc.setLastLocalSync(lastCloudSync);
|
mwc.setLastLocalSync(lastCloudSync);
|
||||||
|
@ -116,21 +117,18 @@ public class CloudController {
|
||||||
LOGGER.info("nothing to do");
|
LOGGER.info("nothing to do");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mwc.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length()-4))); // set time of last sucessfull sync
|
mwc.setLastLocalSync(Long.parseLong(zipFile.getName().substring(0, zipFile.getName().length() - 4))); // set time of last sucessfull sync
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Dropbox:
|
||||||
|
// do the thing
|
||||||
case "Dropbox":
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOGGER.warn("no cloud vendor found!");
|
LOGGER.warn("no cloud vendor found!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
zipFile.delete(); // delete zipfile in cem_UI directory
|
zipFile.delete(); // delete zipfile in cem_UI directory
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
@ -138,11 +136,12 @@ public class CloudController {
|
||||||
mwc.getPlayBtn().setDisable(false);
|
mwc.getPlayBtn().setDisable(false);
|
||||||
mwc.saveSettings();
|
mwc.saveSettings();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
LOGGER.info("synchronization successful!");
|
LOGGER.info("synchronization successful!");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("There was an error during syncronisation! Please open a new issue on the cemu_UI github page:", e);
|
LOGGER.error(
|
||||||
|
"There was an error during syncronisation! Please open a new issue on the cemu_UI github page:",
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -199,25 +198,25 @@ public class CloudController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFolderID(String cloudService) {
|
public String getFolderID(CloudService cloudService) {
|
||||||
String folderID = "";
|
String folderID = "";
|
||||||
if (cloudService != null) {
|
if (cloudService != null) {
|
||||||
if (cloudService.equals("GoogleDrive")) {
|
if (cloudService == CloudService.GoogleDrive) {
|
||||||
folderID = googleDriveController.getFolderID();
|
folderID = googleDriveController.getFolderID();
|
||||||
}
|
}
|
||||||
if (cloudService.equals("Dropbox")) {
|
if (cloudService == CloudService.Dropbox) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return folderID;
|
return folderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFolderID(String folderID, String cloudService) {
|
public void setFolderID(String folderID, CloudService cloudService) {
|
||||||
if (cloudService != null) {
|
if (cloudService != null) {
|
||||||
if (cloudService.equals("GoogleDrive")) {
|
if (cloudService == CloudService.GoogleDrive) {
|
||||||
googleDriveController.setFolderID(folderID);
|
googleDriveController.setFolderID(folderID);
|
||||||
}
|
}
|
||||||
if (cloudService.equals("Dropbox")) {
|
if (cloudService == CloudService.Dropbox) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
* cemu_UI
|
||||||
|
*
|
||||||
|
* Copyright 2017-2018 <@Seil0>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cemu_UI.datatypes;
|
||||||
|
|
||||||
|
public class GlobalDataTypes {
|
||||||
|
|
||||||
|
public enum CloudService {
|
||||||
|
GoogleDrive, Dropbox
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue