Added custom launcher names

This commit is contained in:
modmuss50 2015-01-12 20:51:11 +00:00
parent c12dbd3361
commit 1d41417e17
15 changed files with 53 additions and 35 deletions

View file

@ -64,6 +64,7 @@ To get started with the code and plug in your own data, you need to create a src
public static final String PASTE_CHECK_URL = "";
public static final String PASTE_API_URL = "";
public static final Server[] SERVERS = new Server[] { new Server("Test", "my.file.server.com", true, true) };
public static final String LAUNCHER_NAME = "MyLauncher";
}
@ -88,6 +89,9 @@ This is a link to the create api command for the instance of [stikked](https://g
#### SERVERS
This is an array of Server type elements the launcher uses as a base to download files.
#### LAUNCHER_NAME
This is the name of the launcher.
#### How to make your data
To make the data the Launcher needs you will need to figure out your own server side way of doing that. You can create a system to do it automatically or you can manually do it by just popping the files on the server. The best way to get the file structure and contents is to examine the source code and the ATLauncher files it downloads.

View file

@ -27,6 +27,7 @@ import com.atlauncher.gui.dialogs.SetupDialog;
import com.atlauncher.gui.theme.Theme;
import com.atlauncher.utils.Utils;
import io.github.asyncronous.toast.Toaster;
import main.java.com.atlauncher.data.Constants;
import javax.swing.InputMap;
import javax.swing.JOptionPane;
@ -116,7 +117,7 @@ public class App {
} else if (parts[0].equalsIgnoreCase("--skip-minecraft-version-downloads")) {
skipMinecraftVersionDownloads = true;
LogManager.debug("Skipping Minecraft version downloads! This may cause issues, only use it as " +
"directed by ATLauncher staff!", true);
"directed by" + Constants.LAUNCHER_NAME + " staff!", true);
} else if (parts[0].equalsIgnoreCase("--skip-tray-integration")) {
skipTrayIntegration = true;
LogManager.debug("Skipping tray integration!", true);
@ -184,7 +185,7 @@ public class App {
if (Utils.isMac()) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "ATLauncher " + Constants.VERSION);
System.setProperty("com.apple.mrj.application.apple.menu.about.name", Constants.LAUNCHER_NAME + " " + Constants.VERSION);
try {
Class util = Class.forName("com.apple.eawt.Application");
Method getApplication = util.getMethod("getApplication", new Class[0]);

View file

@ -21,6 +21,7 @@ import com.atlauncher.App;
import com.atlauncher.LogManager;
import com.atlauncher.utils.Utils;
import com.atlauncher.workers.InstanceInstaller;
import main.java.com.atlauncher.data.Constants;
import java.io.BufferedReader;
import java.io.File;
@ -110,7 +111,7 @@ public class Downloadable {
etag = getConnection().getHeaderField("ETag");
if (etag == null) {
etag = getConnection().getHeaderField("ATLauncher-MD5");
etag = getConnection().getHeaderField(Constants.LAUNCHER_NAME + "-MD5");
}
if (etag == null) {
@ -240,7 +241,7 @@ public class Downloadable {
this.connection = null;
return getConnection();
} else {
LogManager.error("Failed to download " + this.beforeURL + " from all ATLauncher servers. " +
LogManager.error("Failed to download " + this.beforeURL + " from all " + Constants.LAUNCHER_NAME + " servers. " +
"Cancelling install!");
if (this.instanceInstaller != null) {
instanceInstaller.cancel(true);
@ -414,7 +415,7 @@ public class Downloadable {
download(downloadAsLibrary); // Redownload the file
} else {
Utils.copyFile(this.file, App.settings.getFailedDownloadsDir());
LogManager.error("Failed to download file " + this.file.getName() + " from all ATLauncher " +
LogManager.error("Failed to download file " + this.file.getName() + " from all " + Constants.LAUNCHER_NAME +
"servers. Copied to FailedDownloads Folder. Cancelling install!");
if (this.instanceInstaller != null) {
instanceInstaller.cancel(true);

View file

@ -23,6 +23,7 @@ import com.atlauncher.LogManager;
import com.atlauncher.gui.components.CollapsiblePanel;
import com.atlauncher.utils.Base64;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@ -46,7 +47,7 @@ import java.util.List;
*/
public class DropboxSync extends SyncAbstract {
private File dropboxLocation = null;
private String backupFolder = "ATLauncherBackup";
private String backupFolder = Constants.LAUNCHER_NAME + "Backup";
public DropboxSync() {
super("Dropbox");

View file

@ -43,6 +43,7 @@ import com.google.gson.GsonBuilder;
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import main.java.com.atlauncher.data.Constants;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@ -228,7 +229,7 @@ public class Settings {
instancesDataFile = new File(configsDir, "instancesdata");
checkingServersFile = new File(configsDir, "checkingservers.json");
userDataFile = new File(configsDir, "userdata");
propertiesFile = new File(configsDir, "ATLauncher.conf");
propertiesFile = new File(configsDir, Constants.LAUNCHER_NAME + ".conf");
}
public void loadEverything() {
@ -405,9 +406,9 @@ public class Settings {
public void clearOldLogs() {
LogManager.debug("Clearing out old logs");
File logFile1 = new File(getBaseDir(), "ATLauncher-Log-1.txt");
File logFile2 = new File(getBaseDir(), "ATLauncher-Log-2.txt");
File logFile3 = new File(getBaseDir(), "ATLauncher-Log-3.txt");
File logFile1 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-1.txt");
File logFile2 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-2.txt");
File logFile3 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-3.txt");
if (logFile3.exists()) {
Utils.delete(logFile3);
@ -431,7 +432,7 @@ public class Settings {
for (File file : this.logsDir.listFiles(Utils.getLogsFileFilter())) {
try {
Date date = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").parse(file.getName().replace
("ATLauncher-Log_", "").replace(".log", ""));
(Constants.LAUNCHER_NAME + "-Log_", "").replace(".log", ""));
if (date.before(toDeleteAfter)) {
Utils.delete(file);
@ -446,9 +447,9 @@ public class Settings {
}
public void clearAllLogs() {
File logFile1 = new File(getBaseDir(), "ATLauncher-Log-1.txt");
File logFile2 = new File(getBaseDir(), "ATLauncher-Log-2.txt");
File logFile3 = new File(getBaseDir(), "ATLauncher-Log-3.txt");
File logFile1 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-1.txt");
File logFile2 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-2.txt");
File logFile3 = new File(getBaseDir(), Constants.LAUNCHER_NAME + "-Log-3.txt");
if (logFile3.exists()) {
Utils.delete(logFile3);
@ -594,7 +595,7 @@ public class Settings {
}
File newFile = new File(getTempDir(), saveAs);
LogManager.info("Downloading Launcher Update");
Downloadable update = new Downloadable("ATLauncher." + toget, newFile, null, null, true);
Downloadable update = new Downloadable(Constants.LAUNCHER_NAME + "." + toget, newFile, null, null, true);
update.download(false);
runUpdate(path, newFile.getAbsolutePath());
} catch (IOException e) {
@ -1143,7 +1144,7 @@ public class Settings {
}
try {
this.properties.load(new FileInputStream(propertiesFile));
this.theme = properties.getProperty("theme", "ATLauncher");
this.theme = properties.getProperty("theme", Constants.LAUNCHER_NAME);
this.dateFormat = properties.getProperty("dateformat", "dd/M/yyy");
if (!this.dateFormat.equalsIgnoreCase("dd/M/yyy") && !this.dateFormat.equalsIgnoreCase("M/dd/yyy") &&
!this.dateFormat.equalsIgnoreCase("yyy/M/dd")) {
@ -1386,7 +1387,7 @@ public class Settings {
this.daysOfLogsToKeep = 7;
}
this.theme = properties.getProperty("theme", "ATLauncher");
this.theme = properties.getProperty("theme", Constants.LAUNCHER_NAME);
this.dateFormat = properties.getProperty("dateformat", "dd/M/yyy");
if (!this.dateFormat.equalsIgnoreCase("dd/M/yyy") && !this.dateFormat.equalsIgnoreCase("M/dd/yyy") &&
@ -1469,7 +1470,7 @@ public class Settings {
properties.setProperty("autobackup", this.autoBackup ? "true" : "false");
properties.setProperty("notifybackup", this.notifyBackup ? "true" : "false");
properties.setProperty("dropboxlocation", this.dropboxFolderLocation);
this.properties.store(new FileOutputStream(propertiesFile), "ATLauncher Settings");
this.properties.store(new FileOutputStream(propertiesFile), Constants.LAUNCHER_NAME + " Settings");
} catch (FileNotFoundException e) {
logStackTrace(e);
} catch (IOException e) {
@ -3053,7 +3054,7 @@ public class Settings {
}
public String getUserAgent() {
return this.userAgent + " ATLauncher/" + Constants.VERSION;
return this.userAgent + Constants.LAUNCHER_NAME + " /" + Constants.VERSION;
}
/**

View file

@ -28,6 +28,7 @@ import com.atlauncher.evnt.manager.RelocalizationManager;
import com.atlauncher.gui.components.Console;
import com.atlauncher.gui.components.ConsoleBottomBar;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
@ -54,7 +55,7 @@ public class LauncherConsole extends JFrame implements RelocalizationListener {
private JMenuItem copy;
public LauncherConsole() {
this.setTitle("ATLauncher Console " + Constants.VERSION);
this.setTitle(Constants.LAUNCHER_NAME + " Console " + Constants.VERSION);
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
this.setIconImage(Utils.getImage("/assets/image/Icon.png"));
this.setMinimumSize(new Dimension(600, 400));

View file

@ -32,6 +32,7 @@ import com.atlauncher.gui.tabs.SettingsTab;
import com.atlauncher.gui.tabs.Tab;
import com.atlauncher.gui.tabs.ToolsTab;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.JFrame;
import javax.swing.JPanel;
@ -65,7 +66,7 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
App.settings.setParentFrame(this);
setSize(new Dimension(1000, 615));
setTitle("ATLauncher " + Constants.VERSION);
setTitle(Constants.LAUNCHER_NAME + " " + Constants.VERSION);
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
@ -99,7 +100,7 @@ public final class LauncherFrame extends JFrame implements RelocalizationListene
}
public void updateTitle(String str) {
setTitle("ATLauncher " + Constants.VERSION + " - " + str);
setTitle(Constants.LAUNCHER_NAME + " " + Constants.VERSION + " - " + str);
}
/**

View file

@ -27,6 +27,7 @@ import com.atlauncher.evnt.listener.SettingsListener;
import com.atlauncher.evnt.manager.SettingsManager;
import com.atlauncher.gui.dialogs.ProgressDialog;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
@ -130,11 +131,11 @@ public class NetworkCheckerToolPanel extends AbstractToolPanel implements Action
dialog.doneTask();
}
String result = Utils.uploadPaste("ATLauncher Network Test Log", results.toString());
String result = Utils.uploadPaste(Constants.LAUNCHER_NAME + " Network Test Log", results.toString());
if (result.contains(Constants.PASTE_CHECK_URL)) {
LogManager.info("Network Test has finished running, you can view the results at " + result);
} else {
LogManager.error("Network Test failed to submit to ATLauncher!");
LogManager.error("Network Test failed to submit to " + Constants.LAUNCHER_NAME + "!");
dialog.setReturnValue(false);
}
@ -147,7 +148,7 @@ public class NetworkCheckerToolPanel extends AbstractToolPanel implements Action
if (dialog.getReturnValue() == null || !(Boolean) dialog.getReturnValue()) {
LogManager.error("Network Test failed to run!");
} else {
LogManager.info("Network Test ran and submitted to ATLauncher!");
LogManager.info("Network Test ran and submitted to " + Constants.LAUNCHER_NAME + "!");
String[] options2 = {Language.INSTANCE.localize("common.ok")};
JOptionPane.showOptionDialog(App.settings.getParent(), "<html><p align=\"center\">" + Language
.INSTANCE.localizeWithReplace("tools.networkheckercomplete", "<br/><br/>") +

View file

@ -20,6 +20,7 @@ package com.atlauncher.gui.dialogs;
import com.atlauncher.App;
import com.atlauncher.data.Language;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.JButton;
import javax.swing.JCheckBox;
@ -55,7 +56,7 @@ public class SetupDialog extends JDialog {
private JButton saveButton;
public SetupDialog() {
super(null, "ATLauncher Setup", ModalityType.APPLICATION_MODAL);
super(null, Constants.LAUNCHER_NAME + " Setup", ModalityType.APPLICATION_MODAL);
this.requestFocus();
this.setSize(400, 200);
setLocationRelativeTo(null);
@ -66,7 +67,7 @@ public class SetupDialog extends JDialog {
// Top Panel Stuff
top = new JPanel();
top.add(new JLabel("Setting up ATLauncher"));
top.add(new JLabel("Setting up " + Constants.LAUNCHER_NAME));
// Middle Panel Stuff
middle = new JPanel();

View file

@ -21,6 +21,7 @@ package com.atlauncher.gui.theme;
import com.atlauncher.LogManager;
import com.atlauncher.utils.Resources;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import javax.swing.BorderFactory;
import javax.swing.UIManager;
@ -28,7 +29,7 @@ import java.awt.Color;
import java.awt.Font;
public final class Theme {
public static final Theme DEFAULT_THEME = new Theme("ATLauncher", "RyanTheAllmighty", true, new Color(40, 45, 50)
public static final Theme DEFAULT_THEME = new Theme(Constants.LAUNCHER_NAME, "RyanTheAllmighty", true, new Color(40, 45, 50)
, new Color(255, 255, 255), new Color(0, 0, 0), new Color(0, 136, 204), new Color(100, 100, 200), new
Color(80, 170, 107), new Color(50, 55, 60), new Color(50, 55, 60), new Color(30, 35, 40), new Color(255,
255, 255), new Color(255, 0, 0), new Color(255, 255, 255), new Color(137, 194, 54), new Color(255, 255,

View file

@ -24,6 +24,7 @@ import com.atlauncher.data.Account;
import com.atlauncher.data.Instance;
import com.atlauncher.data.LoginResponse;
import com.atlauncher.utils.Utils;
import main.java.com.atlauncher.data.Constants;
import java.applet.Applet;
import java.awt.Dimension;
@ -372,7 +373,7 @@ public class LegacyMCLauncher {
try {
Class<?> MCAppletClass = cl.loadClass("net.minecraft.client.MinecraftApplet");
Applet mcappl = (Applet) MCAppletClass.newInstance();
MCFrame mcWindow = new MCFrame("ATLauncher - " + instanceName);
MCFrame mcWindow = new MCFrame(Constants.LAUNCHER_NAME + " - " + instanceName);
mcWindow.start(mcappl, username, session, winSize, maximize);
} catch (InstantiationException e) {
System.out.println("Applet wrapper failed! Falling back " + "to compatibility mode.");

View file

@ -22,6 +22,7 @@ import com.atlauncher.App;
import com.atlauncher.evnt.LogEvent;
import com.atlauncher.utils.Timestamper;
import com.atlauncher.writer.LogEventWriter;
import main.java.com.atlauncher.data.Constants;
import java.io.File;
import java.io.FileWriter;
@ -34,7 +35,7 @@ public final class LoggingThread extends Thread {
private final LogEventWriter writer;
private final BlockingQueue<LogEvent> queue;
private static final String date = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss").format(new Date());
public static final String filename = "ATLauncher-Log_" + date + ".log";
public static final String filename = Constants.LAUNCHER_NAME + "-Log_" + date + ".log";
public LoggingThread(BlockingQueue<LogEvent> queue) {
this.queue = queue;

View file

@ -20,6 +20,7 @@ package com.atlauncher.thread;
import com.atlauncher.App;
import com.atlauncher.data.Constants;
import main.java.com.atlauncher.data.Constants;
import java.io.BufferedReader;
import java.io.InputStream;
@ -34,7 +35,7 @@ public final class PasteUpload implements Callable<String> {
public String call() throws Exception {
String log = App.settings.getLog().replace(System.getProperty("line.separator"), "\n");
String urlParameters = "";
urlParameters += "title=" + URLEncoder.encode("ATLauncher - Log", "ISO-8859-1") + "&";
urlParameters += "title=" + URLEncoder.encode(Constants.LAUNCHER_NAME + " - Log", "ISO-8859-1") + "&";
urlParameters += "language=" + URLEncoder.encode("text", "ISO-8859-1") + "&";
urlParameters += "private=" + URLEncoder.encode("1", "ISO-8859-1") + "&";
urlParameters += "text=" + URLEncoder.encode(log, "ISO-8859-1");

View file

@ -25,6 +25,7 @@ import com.atlauncher.data.mojang.ExtractRule;
import com.atlauncher.data.mojang.OperatingSystem;
import com.atlauncher.data.openmods.OpenEyeReportResponse;
import com.atlauncher.evnt.LogEvent.LogType;
import main.java.com.atlauncher.data.Constants;
import org.tukaani.xz.XZInputStream;
import javax.crypto.BadPaddingException;
@ -170,7 +171,7 @@ public class Utils {
.getSchemeSpecificPart()).getParentFile();
} catch (URISyntaxException e) {
e.printStackTrace();
return new File(System.getProperty("user.dir"), "ATLauncher");
return new File(System.getProperty("user.dir"), Constants.LAUNCHER_NAME);
}
} else {
return new File(System.getProperty("user.dir"));
@ -1378,7 +1379,7 @@ public class Utils {
@Override
public boolean accept(File dir, String name) {
File file = new File(dir, name);
return file.isFile() && name.startsWith("ATLauncher-Log_") && name.endsWith(".log");
return file.isFile() && name.startsWith(Constants.LAUNCHER_NAME + "-Log_") && name.endsWith(".log");
}
};
}

View file

@ -54,6 +54,7 @@ import com.google.gson.JsonIOException;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import main.java.com.atlauncher.data.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -2130,10 +2131,10 @@ public class InstanceInstaller extends SwingWorker<Boolean, Void> {
return installUsingJSON();
} catch (JsonSyntaxException e) {
App.settings.logStackTrace("Couldn't read JSON of pack! Report this to the pack's developer/s and " +
"NOT ATLauncher!", e);
"NOT " + Constants.LAUNCHER_NAME + "!", e);
} catch (JsonParseException e) {
App.settings.logStackTrace("Couldn't parse JSON of pack! Report this to the pack's developer/s and "
+ "NOT ATLauncher!", e);
+ "NOT " + Constants.LAUNCHER_NAME + "!", e);
}
}
return installUsingXML();