Compare commits

...

3 Commits

11 changed files with 97 additions and 98 deletions

View File

@ -16,19 +16,16 @@
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.util.ArrayList; import java.util.ArrayList;
public class Bert implements ActionListener { public class Bert implements ActionListener {
BufferedImage windowIcon;
public JFrame frame = new JFrame(); public JFrame frame = new JFrame();
private JPanel frameContainer; private JPanel frameContainer;
private JButton cancelbtn; private JButton cancelbtn;
@ -60,12 +57,7 @@ public class Bert implements ActionListener {
cancelbtn.addActionListener(this); cancelbtn.addActionListener(this);
downloadbtn.addActionListener(this); downloadbtn.addActionListener(this);
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setVisible(true); frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() { frame.addWindowListener(new WindowAdapter() {

View File

@ -20,18 +20,14 @@ import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException; import net.lingala.zip4j.exception.ZipException;
import org.json.JSONObject; import org.json.JSONObject;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException;
import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE; import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE;
@ -84,12 +80,7 @@ public class Clifford implements ActionListener {
creating = false; creating = false;
frame.add(frameContainer); frame.add(frameContainer);
try { frame.setIconImage(Main.windowIcon);
BufferedImage windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find resource titleIcon.png. Window will not have an icon.");
}
frame.setSize(600, 300); // 1280 800 frame.setSize(600, 300); // 1280 800
frame.setMinimumSize(new Dimension(200,100)); frame.setMinimumSize(new Dimension(200,100));
frame.setTitle("Options"); frame.setTitle("Options");

View File

@ -21,7 +21,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
@ -33,7 +32,6 @@ import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JEditorPane; import javax.swing.JEditorPane;
import javax.swing.JFrame; import javax.swing.JFrame;
@ -61,18 +59,12 @@ public class Ernie implements ActionListener {
private JButton surebtn; private JButton surebtn;
public boolean backgroundDone = false; public boolean backgroundDone = false;
private BufferedImage windowIcon;
private JFrame parent; private JFrame parent;
public Ernie(JFrame parent) { public Ernie(JFrame parent) {
this.parent = parent; this.parent = parent;
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
byte[] urlraw = getFile(gitapi+"/releases?draft=false&pre-release=false"); byte[] urlraw = getFile(gitapi+"/releases?draft=false&pre-release=false");
if (urlraw.length <= 0) { if (urlraw.length <= 0) {
JOptionPane.showMessageDialog(frame, "Internal Error: Couldn't check for updates.", "Fatal Error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(frame, "Internal Error: Couldn't check for updates.", "Fatal Error", JOptionPane.ERROR_MESSAGE);

View File

@ -19,18 +19,12 @@
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.*; import java.net.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Optional;
public class Fozzie { public class Fozzie {
BufferedImage windowIcon;
private JFrame frame = new JFrame(); private JFrame frame = new JFrame();
public JProgressBar progressBar; public JProgressBar progressBar;
private JPanel frameContainer; private JPanel frameContainer;
@ -55,12 +49,7 @@ public class Fozzie {
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setVisible(true); frame.setVisible(true);
label.setText("Downloading \"" + dname + "\""); label.setText("Downloading \"" + dname + "\"");
@ -110,12 +99,7 @@ public class Fozzie {
frame.setLayout(new GridLayout()); frame.setLayout(new GridLayout());
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setAlwaysOnTop(true); frame.setAlwaysOnTop(true);
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setVisible(true); frame.setVisible(true);
label.setText(text); label.setText(text);

View File

@ -21,13 +21,11 @@ import com.github.difflib.UnifiedDiffUtils;
import com.github.difflib.patch.Patch; import com.github.difflib.patch.Patch;
import net.lingala.zip4j.ZipFile; import net.lingala.zip4j.ZipFile;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import java.awt.*; import java.awt.*;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.*; import java.io.*;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
@ -60,12 +58,7 @@ public class Gonzo {
frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA
try { frame.setIconImage(Main.windowIcon);
BufferedImage windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setSize(800, 400); frame.setSize(800, 400);
frame.setMinimumSize(new Dimension(600,400)); frame.setMinimumSize(new Dimension(600,400));
frame.setTitle("Mod Installation"); frame.setTitle("Mod Installation");

View File

@ -16,7 +16,6 @@
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.filechooser.FileNameExtensionFilter;
@ -24,32 +23,23 @@ import javax.swing.text.DefaultCaret;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.*; import java.nio.file.*;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;
import net.lingala.zip4j.*; import net.lingala.zip4j.*;
import net.lingala.zip4j.exception.ZipException;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import static java.nio.file.StandardCopyOption.*;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE; import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class MissPiggy implements ActionListener { public class MissPiggy implements ActionListener {
BufferedImage windowIcon;
JFrame frame = new JFrame(); JFrame frame = new JFrame();
JPanel frameContainer; JPanel frameContainer;
JPanel actionsContainer; JPanel actionsContainer;
@ -154,12 +144,7 @@ public class MissPiggy implements ActionListener {
descriptionField.getDocument().putProperty("filterNewlines", Boolean.FALSE); descriptionField.getDocument().putProperty("filterNewlines", Boolean.FALSE);
// display window // display window
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
menuBar.setBackground(new Color(25, 41, 93)); menuBar.setBackground(new Color(25, 41, 93));
fileMenu.setForeground(new Color(255, 255, 255)); fileMenu.setForeground(new Color(255, 255, 255));

View File

@ -0,0 +1,87 @@
/*
* Firestar Mod Manager
* Copyright (C) 2024 bonkmaykr
*
* 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, see https://www.gnu.org/licenses/.
*/
import java.io.File;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Rizzo {
public void Rizzo(File infile) {
}
public static String[] translateCommandline(String toProcess) {
if (toProcess == null || toProcess.length() == 0) {
return new String[0];
}
final int normal = 0;
final int inQuote = 1;
final int inDoubleQuote = 2;
int state = normal;
final StringTokenizer tok = new StringTokenizer(toProcess, "\"\' ", true);
final ArrayList<String> result = new ArrayList<String>();
final StringBuilder current = new StringBuilder();
boolean lastTokenHasBeenQuoted = false;
while (tok.hasMoreTokens()) {
String nextTok = tok.nextToken();
switch (state) {
case inQuote:
if ("\'".equals(nextTok)) {
lastTokenHasBeenQuoted = true;
state = normal;
} else {
current.append(nextTok);
}
break;
case inDoubleQuote:
if ("\"".equals(nextTok)) {
lastTokenHasBeenQuoted = true;
state = normal;
} else {
current.append(nextTok);
}
break;
default:
if ("\'".equals(nextTok)) {
state = inQuote;
} else if ("\"".equals(nextTok)) {
state = inDoubleQuote;
} else if (" ".equals(nextTok)) {
if (lastTokenHasBeenQuoted || current.length() != 0) {
result.add(current.toString());
current.setLength(0);
}
} else {
current.append(nextTok);
}
lastTokenHasBeenQuoted = false;
break;
}
}
if (lastTokenHasBeenQuoted || current.length() != 0) {
result.add(current.toString());
}
if (state == inQuote || state == inDoubleQuote) {
throw new RuntimeException("unbalanced quotes in " + toProcess);
}
return result.toArray(new String[result.size()]);
}
}

View File

@ -19,14 +19,11 @@
import javax.imageio.*; import javax.imageio.*;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.image.*;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
public class Rowlf { public class Rowlf {
private BufferedImage windowIcon;
JFrame frame = new JFrame(); JFrame frame = new JFrame();
JPanel frameContainer; JPanel frameContainer;
Image logo; Image logo;
@ -42,12 +39,7 @@ public class Rowlf {
System.out.println("ERROR: Failed to open About screen because we couldn't find an image needed to display the page."); System.out.println("ERROR: Failed to open About screen because we couldn't find an image needed to display the page.");
throw new RuntimeException(e); throw new RuntimeException(e);
} }
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
//frame.add(picLabel); //frame.add(picLabel);
frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA frame.add(frameContainer); // initialize window contents -- will be handled by IntelliJ IDEA

View File

@ -16,11 +16,8 @@
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
public class Scooter { public class Scooter {
private JFrame frame = new JFrame(); private JFrame frame = new JFrame();

View File

@ -16,14 +16,12 @@
* along with this program. If not, see https://www.gnu.org/licenses/. * along with this program. If not, see https://www.gnu.org/licenses/.
*/ */
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -50,12 +48,7 @@ public class Waldorf implements ActionListener {
invoker = inv; invoker = inv;
frame.add(frameContainer); frame.add(frameContainer);
try { frame.setIconImage(Main.windowIcon);
BufferedImage windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
frame.setSize(600, 300); // 1280 800 frame.setSize(600, 300); // 1280 800
frame.setMinimumSize(new Dimension(200,100)); frame.setMinimumSize(new Dimension(200,100));
frame.setTitle("Options"); frame.setTitle("Options");

View File

@ -24,7 +24,6 @@ import javax.swing.text.html.HTMLDocument;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -32,7 +31,6 @@ import java.nio.file.Files;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE; import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class WilkinsCoffee implements ActionListener { public class WilkinsCoffee implements ActionListener {
BufferedImage windowIcon;
Image logo; Image logo;
public Pages page; public Pages page;
public JFrame frame = new JFrame(); public JFrame frame = new JFrame();
@ -82,12 +80,7 @@ public class WilkinsCoffee implements ActionListener {
// reformat path slightly for windows // reformat path slightly for windows
if (Main.windows) {outPathTemp.replace("/", "\\");} if (Main.windows) {outPathTemp.replace("/", "\\");}
try { frame.setIconImage(Main.windowIcon);
windowIcon = ImageIO.read(Main.class.getResourceAsStream("/titleIcon.png"));
frame.setIconImage(windowIcon);
} catch (IOException e) {
System.out.println("ERROR: Failed to find /resources/titleIcon.png. Window will not have an icon.");
}
try { try {
logo = ImageIO.read(Main.class.getResourceAsStream("/programIcon.png")).getScaledInstance(96, 96, Image.SCALE_SMOOTH); logo = ImageIO.read(Main.class.getResourceAsStream("/programIcon.png")).getScaledInstance(96, 96, Image.SCALE_SMOOTH);
picLabel.setIcon(new ImageIcon(logo));picLabel.setText(""); picLabel.setIcon(new ImageIcon(logo));picLabel.setText("");