|
|
|
|
@@ -29,6 +29,8 @@ import java.io.File;
|
|
|
|
|
import java.io.FileWriter;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.net.URI;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
|
import java.nio.file.*;
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
@@ -87,9 +89,10 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
toolsMenu = new JMenu("Tools");
|
|
|
|
|
helpMenu = new JMenu("Help");
|
|
|
|
|
|
|
|
|
|
fileMenu.add(new JMenuItem("Deploy All Mods"));
|
|
|
|
|
fileMenu.add(new JMenuItem("Import Mod..."));
|
|
|
|
|
fileMenu.add(new JMenuItem("Remove All"));
|
|
|
|
|
fileMenu.add(new JMenuItem("Deploy Mods"));
|
|
|
|
|
fileMenu.add(new JMenuItem("Import Mod from File"));
|
|
|
|
|
//fileMenu.add(new JSeparator());
|
|
|
|
|
fileMenu.add(new JMenuItem("Delete All"));
|
|
|
|
|
fileMenu.add(new JSeparator());
|
|
|
|
|
fileMenu.add(new JMenuItem("Options"));
|
|
|
|
|
fileMenu.add(new JMenuItem("Quit"));
|
|
|
|
|
@@ -99,6 +102,9 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
toolsMenu.add(new JMenuItem("Create Soundtrack Mod..."));
|
|
|
|
|
//toolsMenu.add(new JMenuItem("Download Mod from URL")); // TODO: implement. move option to File menu. should be ez
|
|
|
|
|
|
|
|
|
|
helpMenu.add(new JMenuItem("Source Code")); //replace with Website 'screwgravity.net' and 'Issue Tracker' gitea later
|
|
|
|
|
helpMenu.add(new JMenuItem("License"));
|
|
|
|
|
helpMenu.add(new JSeparator());
|
|
|
|
|
helpMenu.add(new JMenuItem("About Firestar"));
|
|
|
|
|
|
|
|
|
|
menuBar.add(fileMenu);
|
|
|
|
|
@@ -119,7 +125,10 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
fileMenu.getItem(5).addActionListener(this);
|
|
|
|
|
toolsMenu.getItem(0).addActionListener(this);
|
|
|
|
|
toolsMenu.getItem(1).addActionListener(this);
|
|
|
|
|
toolsMenu.getItem(2).addActionListener(this);
|
|
|
|
|
helpMenu.getItem(0).addActionListener(this);
|
|
|
|
|
helpMenu.getItem(1).addActionListener(this);
|
|
|
|
|
helpMenu.getItem(3).addActionListener(this);
|
|
|
|
|
|
|
|
|
|
deployButton.addActionListener(this);
|
|
|
|
|
importButton.addActionListener(this);
|
|
|
|
|
@@ -258,18 +267,41 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
if (actionEvent.getSource() == toggleButton) {throwUnimplemented();} else // todo
|
|
|
|
|
if (actionEvent.getSource() == deleteButton1) {deleteSelected();} else
|
|
|
|
|
|
|
|
|
|
if (actionEvent.getSource() == helpMenu.getItem(0)) {new Rowlf().displayAboutScreen();}
|
|
|
|
|
if (actionEvent.getSource() == toolsMenu.getItem(0)) {throwUnimplemented();} else
|
|
|
|
|
if (actionEvent.getSource() == toolsMenu.getItem(1)) {throwUnimplemented();} else
|
|
|
|
|
if (actionEvent.getSource() == toolsMenu.getItem(2)) {throwUnimplemented();} else
|
|
|
|
|
|
|
|
|
|
if (actionEvent.getSource() == helpMenu.getItem(0)) {
|
|
|
|
|
try {
|
|
|
|
|
Desktop.getDesktop().browse(new URI("https://git.worlio.com/bonkmaykr/firestar"));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
JOptionPane.showMessageDialog(frame, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (actionEvent.getSource() == helpMenu.getItem(1)) {
|
|
|
|
|
try {
|
|
|
|
|
Desktop.getDesktop().browse(new URI("https://www.gnu.org/licenses/gpl-3.0.en.html"));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
JOptionPane.showMessageDialog(frame, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
if (actionEvent.getSource() == helpMenu.getItem(3)) {new Rowlf().displayAboutScreen();}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Will likely split the below functions into separate classes to work with intellij GUI designer.
|
|
|
|
|
|
|
|
|
|
public void deployModGUI() {
|
|
|
|
|
// prevent interruptions
|
|
|
|
|
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
|
|
|
|
frame.setEnabled(false);
|
|
|
|
|
int result = JOptionPane.showConfirmDialog(frame, "A new PSARC will be generated. This can take several minutes.\nDuring this time, your computer may be very busy or slow.\n\nAre you sure you want to continue?", "Deploy Mods", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
|
|
|
|
|
if (result == JOptionPane.YES_OPTION) {
|
|
|
|
|
// prevent interruptions
|
|
|
|
|
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
|
|
|
|
frame.setEnabled(false);
|
|
|
|
|
|
|
|
|
|
// start
|
|
|
|
|
new Gonzo().DeployMods(this);
|
|
|
|
|
// start
|
|
|
|
|
new Gonzo().DeployMods(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void wrapUpDeployment() {
|
|
|
|
|
@@ -325,12 +357,13 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
for (Main.Mod entry : Main.Mods) {
|
|
|
|
|
new File(System.getProperty("user.home") + "/.firestar/mods/" + entry.path).delete();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
new File(System.getProperty("user.home") + "/.firestar/mods/index").delete();
|
|
|
|
|
Main.Mods.clear();
|
|
|
|
|
|
|
|
|
|
InitializeModListStructure();
|
|
|
|
|
InitializeModListInGUI();
|
|
|
|
|
new File(System.getProperty("user.home") + "/.firestar/mods/index").delete();
|
|
|
|
|
Main.Mods.clear();
|
|
|
|
|
|
|
|
|
|
InitializeModListStructure();
|
|
|
|
|
InitializeModListInGUI();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void optionsGUI() {
|
|
|
|
|
@@ -339,11 +372,15 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteSelected() {
|
|
|
|
|
File file = new File(System.getProperty("user.home") + "/.firestar/mods/" + Main.Mods.get(modList.getSelectedIndex()).path);
|
|
|
|
|
file.delete();
|
|
|
|
|
System.out.println("Deleted " + Main.Mods.get(modList.getSelectedIndex()).friendlyName); //debug
|
|
|
|
|
Main.Mods.remove(modList.getSelectedIndex());
|
|
|
|
|
regenerateModIndex(true);
|
|
|
|
|
if (modList.getSelectedIndex() >= 0) {
|
|
|
|
|
File file = new File(System.getProperty("user.home") + "/.firestar/mods/" + Main.Mods.get(modList.getSelectedIndex()).path);
|
|
|
|
|
file.delete();
|
|
|
|
|
System.out.println("Deleted " + Main.Mods.get(modList.getSelectedIndex()).friendlyName); //debug
|
|
|
|
|
Main.Mods.remove(modList.getSelectedIndex());
|
|
|
|
|
regenerateModIndex(true);
|
|
|
|
|
} else {
|
|
|
|
|
JOptionPane.showMessageDialog(frame, "Please select a mod to delete first.", "Error", JOptionPane.ERROR_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void generatorGUI() {
|
|
|
|
|
@@ -375,7 +412,7 @@ public class MissPiggy implements ActionListener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void throwUnimplemented() {
|
|
|
|
|
JOptionPane.showMessageDialog(frame, "Unimplemented.\nSee README at https://git.worlio.com/bonkmaykr/firestar", "Unimplemented", JOptionPane.INFORMATION_MESSAGE);
|
|
|
|
|
JOptionPane.showMessageDialog(frame, "This feature is unimplemented and will be coming soon.\nSee README at https://git.worlio.com/bonkmaykr/firestar", "Unimplemented", JOptionPane.INFORMATION_MESSAGE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void createSelectionEventListener() { // moved incase needs to be removed and re-added
|
|
|
|
|
|