Komplettes G-Earth Paket inkl. JRE, Extensions und Tools. Extensions: - G-BuildTools, G-Click Ultimate, G-Loader, G-Manipulate - G-Presets, G-Translator, G-Trigger, G-itemViewer - Market Utils, Packet Info Explorer, Plants - RandomRoomVisitor, RoomLogger, Sanbovir Photo Inspector - SpyFriends, WallAligner, XabboScripter, xabbo
151 lines
5.1 KiB
Java
151 lines
5.1 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javafx.application.Application
|
|
* javafx.application.Platform
|
|
* javafx.fxml.FXMLLoader
|
|
* javafx.scene.Parent
|
|
* javafx.scene.Scene
|
|
* javafx.scene.image.Image
|
|
* javafx.stage.Stage
|
|
* javafx.stage.StageStyle
|
|
*/
|
|
package gearth;
|
|
|
|
import gearth.misc.AdminValidator;
|
|
import gearth.misc.Cacher;
|
|
import gearth.misc.UpdateChecker;
|
|
import gearth.misc.listenerpattern.ObservableObject;
|
|
import gearth.ui.GEarthController;
|
|
import gearth.ui.themes.Theme;
|
|
import gearth.ui.themes.ThemeFactory;
|
|
import gearth.ui.titlebar.TitleBarConfig;
|
|
import gearth.ui.titlebar.TitleBarController;
|
|
import javafx.application.Application;
|
|
import javafx.application.Platform;
|
|
import javafx.fxml.FXMLLoader;
|
|
import javafx.scene.Parent;
|
|
import javafx.scene.Scene;
|
|
import javafx.scene.image.Image;
|
|
import javafx.stage.Stage;
|
|
import javafx.stage.StageStyle;
|
|
|
|
public class GEarth
|
|
extends Application {
|
|
public static GEarth main;
|
|
public static String version;
|
|
public static String gitApi;
|
|
public static ObservableObject<Theme> observableTheme;
|
|
private Stage stage;
|
|
private GEarthController controller;
|
|
public static String[] args;
|
|
|
|
public void start(Stage primaryStage) throws Exception {
|
|
main = this;
|
|
this.stage = primaryStage;
|
|
FXMLLoader loader = new FXMLLoader(((Object)((Object)this)).getClass().getResource("/gearth/ui/G-Earth.fxml"));
|
|
Parent root = (Parent)loader.load();
|
|
this.controller = (GEarthController)loader.getController();
|
|
this.controller.setStage(primaryStage);
|
|
this.stage.initStyle(StageStyle.TRANSPARENT);
|
|
primaryStage.setScene(new Scene(root));
|
|
TitleBarController.create(primaryStage, new TitleBarConfig(){
|
|
|
|
@Override
|
|
public boolean displayThemePicker() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean displayMinimizeButton() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public void onCloseClicked() {
|
|
GEarth.this.closeGEarth();
|
|
}
|
|
|
|
@Override
|
|
public void onMinimizeClicked() {
|
|
GEarth.this.stage.setIconified(true);
|
|
}
|
|
|
|
@Override
|
|
public void setTheme(Theme theme) {
|
|
GEarth.this.setGearthTheme(theme);
|
|
}
|
|
|
|
@Override
|
|
public Theme getCurrentTheme() {
|
|
return observableTheme.getObject();
|
|
}
|
|
});
|
|
primaryStage.setResizable(false);
|
|
primaryStage.sizeToScene();
|
|
this.setGearthTheme(observableTheme.getObject());
|
|
primaryStage.show();
|
|
primaryStage.setOnCloseRequest(event -> this.closeGEarth());
|
|
AdminValidator.validate();
|
|
UpdateChecker.checkForUpdates();
|
|
}
|
|
|
|
private void closeGEarth() {
|
|
this.controller.exit();
|
|
Platform.exit();
|
|
System.exit(0);
|
|
}
|
|
|
|
private void setGearthTheme(Theme theme) {
|
|
Cacher.put("theme", theme.title());
|
|
observableTheme.setObject(theme);
|
|
Theme defaultTheme = ThemeFactory.getDefaultTheme();
|
|
this.stage.getScene().getStylesheets().clear();
|
|
this.stage.getScene().getStylesheets().add((Object)GEarth.class.getResource(String.format("/gearth/ui/themes/%s/styling.css", theme.internalName())).toExternalForm());
|
|
this.stage.getIcons().clear();
|
|
this.stage.getIcons().add((Object)new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logoSmall.png", theme.overridesLogo() ? theme.internalName() : defaultTheme.internalName()))));
|
|
this.stage.setTitle((theme.overridesTitle() ? theme.title() : defaultTheme.title()) + " " + version);
|
|
this.controller.infoController.img_logo.setImage(new Image(GEarth.class.getResourceAsStream(String.format("/gearth/ui/themes/%s/logo.png", theme.overridesLogo() ? theme.internalName() : defaultTheme.internalName()))));
|
|
this.controller.infoController.version.setText(this.stage.getTitle());
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
GEarth.args = args;
|
|
GEarth.launch((String[])args);
|
|
}
|
|
|
|
public static boolean hasFlag(String flag) {
|
|
for (String s : args) {
|
|
if (!s.equals(flag)) continue;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static String getArgument(String ... arg) {
|
|
for (int i = 0; i < args.length - 1; ++i) {
|
|
for (String str : arg) {
|
|
if (!args[i].toLowerCase().equals(str.toLowerCase())) continue;
|
|
return args[i + 1];
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static ObservableObject<Theme> getThemeObservable() {
|
|
return observableTheme;
|
|
}
|
|
|
|
public static Theme getTheme() {
|
|
return observableTheme.getObject();
|
|
}
|
|
|
|
static {
|
|
version = "1.5.2";
|
|
gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest";
|
|
observableTheme = new ObservableObject<Theme>(Cacher.getCacheContents().has("theme") ? ThemeFactory.themeForTitle(Cacher.getCacheContents().getString("theme")) : ThemeFactory.getDefaultTheme());
|
|
}
|
|
}
|
|
|