parent
ca70940fcf
commit
c83f3233d1
|
@ -89,16 +89,21 @@
|
||||||
<children>
|
<children>
|
||||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||||
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||||
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="314.0" prefWidth="267.0" AnchorPane.bottomAnchor="67.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="290.0" prefWidth="267.0" AnchorPane.bottomAnchor="91.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
||||||
<content>
|
<content>
|
||||||
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
||||||
</content>
|
</content>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="510.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="510.0">
|
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="479.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="45.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="479.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
|
<Label fx:id="helpLabel" layoutX="436.0" layoutY="538.0" prefHeight="17.0" prefWidth="267.0" text="please help me improving this! click me!">
|
||||||
|
<font>
|
||||||
|
<Font size="14.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
||||||
<font>
|
<font>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -89,16 +89,21 @@
|
||||||
<children>
|
<children>
|
||||||
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||||
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||||
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="314.0" prefWidth="267.0" AnchorPane.bottomAnchor="67.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="290.0" prefWidth="267.0" AnchorPane.bottomAnchor="91.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
|
||||||
<content>
|
<content>
|
||||||
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
|
||||||
</content>
|
</content>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="510.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="510.0">
|
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="479.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="45.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="479.0">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="14.0" />
|
<Font name="System Bold" size="14.0" />
|
||||||
</font>
|
</font>
|
||||||
</JFXButton>
|
</JFXButton>
|
||||||
|
<Label fx:id="helpLabel" layoutX="436.0" layoutY="538.0" prefHeight="17.0" prefWidth="267.0" text="please help me improving this! click me!">
|
||||||
|
<font>
|
||||||
|
<Font size="14.0" />
|
||||||
|
</font>
|
||||||
|
</Label>
|
||||||
</children></AnchorPane>
|
</children></AnchorPane>
|
||||||
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
<JFXButton fx:id="playBtn" buttonType="RAISED" maxHeight="38.0" maxWidth="100.0" onAction="#playBtnAction" ripplerFill="#c92a2a" text="play" visible="false" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="396.0" AnchorPane.rightAnchor="396.0" AnchorPane.topAnchor="555.0">
|
||||||
<font>
|
<font>
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
*/
|
*/
|
||||||
package application;
|
package application;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
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.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -25,6 +25,7 @@ import java.io.OutputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
@ -39,8 +40,6 @@ import javax.swing.ProgressMonitor;
|
||||||
import javax.swing.ProgressMonitorInputStream;
|
import javax.swing.ProgressMonitorInputStream;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.vfs2.tasks.MkdirTask;
|
|
||||||
|
|
||||||
import com.github.junrar.Archive;
|
import com.github.junrar.Archive;
|
||||||
import com.github.junrar.exception.RarException;
|
import com.github.junrar.exception.RarException;
|
||||||
import com.github.junrar.impl.FileVolumeManager;
|
import com.github.junrar.impl.FileVolumeManager;
|
||||||
|
@ -79,6 +78,7 @@ import javafx.scene.control.TextInputDialog;
|
||||||
import javafx.scene.control.TreeItem;
|
import javafx.scene.control.TreeItem;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.input.MouseButton;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import javafx.scene.layout.AnchorPane;
|
import javafx.scene.layout.AnchorPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
|
@ -173,6 +173,9 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private ImageView smmdbImageView;
|
private ImageView smmdbImageView;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Label helpLabel;
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
|
private JFXTreeTableView<CourseTableDataType> courseTreeTable = new JFXTreeTableView<CourseTableDataType>();
|
||||||
|
@ -209,10 +212,9 @@ public class MainWindowController {
|
||||||
private String selectedGameTitleID;
|
private String selectedGameTitleID;
|
||||||
private String selectedGameTitle;
|
private String selectedGameTitle;
|
||||||
private String color;
|
private String color;
|
||||||
private String smmID;
|
private String version = "0.1.6";
|
||||||
private String version = "0.1.5";
|
private String buildNumber = "027";
|
||||||
private String buildNumber = "021";
|
private String versionName = "Throwback Galaxy";
|
||||||
private String versionName = "Gusty Garden";
|
|
||||||
private int xPos = -200;
|
private int xPos = -200;
|
||||||
private int yPos = 17;
|
private int yPos = 17;
|
||||||
private int xPosHelper;
|
private int xPosHelper;
|
||||||
|
@ -226,6 +228,7 @@ public class MainWindowController {
|
||||||
private File fileLinux = new File(dirLinux + "/config.xml");
|
private File fileLinux = new File(dirLinux + "/config.xml");
|
||||||
File pictureCacheWin = new File(dirWin+"/picture_cache");
|
File pictureCacheWin = new File(dirWin+"/picture_cache");
|
||||||
File pictureCacheLinux = new File(dirLinux+"/picture_cache");
|
File pictureCacheLinux = new File(dirLinux+"/picture_cache");
|
||||||
|
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2"); //TODO add more IDs
|
||||||
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
|
||||||
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
|
||||||
ArrayList<Text> courseText = new ArrayList<Text>();
|
ArrayList<Text> courseText = new ArrayList<Text>();
|
||||||
|
@ -545,6 +548,21 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
helpLabel.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||||
|
@Override
|
||||||
|
public void handle(MouseEvent mouseEvent) {
|
||||||
|
if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){
|
||||||
|
System.out.println("I'll help you");
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI("https://github.com/Seil0/cemu_UI/issues/3"));
|
||||||
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
System.out.println("initializing Actions done!");
|
System.out.println("initializing Actions done!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,8 +690,8 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
void smmdbDownloadBtnAction(ActionEvent event){
|
void smmdbDownloadBtnAction(ActionEvent event){
|
||||||
String downloadUrl = "http://smmdb.ddns.net/courses/" + id;
|
String downloadUrl = "http://smmdb.ddns.net/courses/" + id;
|
||||||
String downloadFile = getCemuPath() + "/" + id + ".rar"; //getCemuPath() + "/" + smmID + "/" + id + ".rar"
|
String downloadFileURL = getCemuPath() + "/" + id + ".rar"; //getCemuPath() + "/" + smmID + "/" + id + ".rar"
|
||||||
String outputFile = getCemuPath() + "\\";
|
String outputFile = getCemuPath() + "/";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
HttpURLConnection conn = (HttpURLConnection) new URL(downloadUrl).openConnection();
|
HttpURLConnection conn = (HttpURLConnection) new URL(downloadUrl).openConnection();
|
||||||
|
@ -683,50 +701,50 @@ public class MainWindowController {
|
||||||
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); // 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.setMaximum(conn.getContentLength()); // tell the progress bar the total number of bytes we are going to read.
|
||||||
FileUtils.copyInputStreamToFile(pmis, new File(downloadFile)); //download file + "/mlc01/emulatorSave"
|
FileUtils.copyInputStreamToFile(pmis, new File(downloadFileURL)); //download file + "/mlc01/emulatorSave"
|
||||||
System.out.println((getCemuPath() + "/" + smmID + "/" + id + ".rar"));
|
pmis.close();
|
||||||
System.out.println("downloaded successfull");
|
System.out.println("downloaded successfull");
|
||||||
|
|
||||||
//TODO place file into the right directory
|
File downloadFile = new File(downloadFileURL);
|
||||||
File f = new File(downloadFile);
|
|
||||||
Archive a = null;
|
Archive a = null;
|
||||||
try {
|
try {
|
||||||
a = new Archive(new FileVolumeManager(f));
|
a = new Archive(new FileVolumeManager(downloadFile));
|
||||||
} catch (RarException e) {
|
} catch (RarException | IOException e) {
|
||||||
// Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Auto-generated catch block
|
// Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
a.getMainHeader().print();
|
a.getMainHeader().print();
|
||||||
FileHeader fh = a.nextFileHeader();
|
FileHeader fh = a.nextFileHeader();
|
||||||
File courseDirectory = new File(outputFile + fh.getFileNameString().substring(0, fh.getFileNameString().indexOf('\\')));
|
|
||||||
while (fh != null) {
|
for (int i = 0; i < smmIDs.size(); i++) {
|
||||||
try {
|
if (new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i)).exists()) {
|
||||||
|
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(0) + "/" + fh.getFileNameString().substring(0, fh.getFileNameString().indexOf('\\')));
|
||||||
|
System.out.println("Path: " + courseDirectory.getAbsolutePath());
|
||||||
if (!courseDirectory.exists()) {
|
if (!courseDirectory.exists()) {
|
||||||
courseDirectory.mkdir();
|
courseDirectory.mkdir();
|
||||||
}
|
}
|
||||||
File out = new File(outputFile + fh.getFileNameString().trim());
|
while (fh != null) {
|
||||||
System.out.println(out.getAbsolutePath());
|
try {
|
||||||
FileOutputStream os = new FileOutputStream(out);
|
File out = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(0) + "/" + fh.getFileNameString().trim());
|
||||||
a.extractFile(fh, os);
|
if (!out.getAbsolutePath().equals(courseDirectory.getAbsolutePath())) {
|
||||||
os.close();
|
System.out.println(out.getAbsolutePath());
|
||||||
} catch (FileNotFoundException e) {
|
FileOutputStream os = new FileOutputStream(out);
|
||||||
// Auto-generated catch block
|
a.extractFile(fh, os);
|
||||||
e.printStackTrace();
|
os.close();
|
||||||
} catch (RarException e) {
|
}
|
||||||
// Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
} catch (RarException | IOException e) {
|
||||||
} catch (IOException e) {
|
// Auto-generated catch block
|
||||||
// Auto-generated catch block
|
e.printStackTrace();
|
||||||
e.printStackTrace();
|
}
|
||||||
|
fh = a.nextFileHeader();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fh = a.nextFileHeader();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
a.close();
|
||||||
|
downloadFile.delete();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("something went wrong during downloading the course");
|
System.err.println("something went wrong during downloading the course");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue