Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMaxium69 committed May 25, 2021
0 parents commit e7078d9
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="D:/Tyrolium/Workspace/launcher/Ficher/LauncherUpdate/openlauncherlib-2.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="D:/Tyrolium/Workspace/launcher/Ficher/LauncherUpdate/s-update-3.1.0-BETA.jar"/>
<classpathentry kind="lib" path="D:/Tyrolium/Workspace/launcher/Ficher/LauncherUpdate/swinger-1.0.0-BETA.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>UpLauncher</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
94 changes: 94 additions & 0 deletions src/fr/tyrolium/maxime/update/LauncherUpdate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package fr.tyrolium.maxime.update;

import fr.theshark34.openlauncherlib.bootstrap.Bootstrap;
import fr.theshark34.openlauncherlib.bootstrap.LauncherClasspath;
import fr.theshark34.openlauncherlib.bootstrap.LauncherInfos;
import fr.theshark34.openlauncherlib.util.ErrorUtil;
import fr.theshark34.openlauncherlib.util.GameDir;
import fr.theshark34.openlauncherlib.util.SplashScreen;
import fr.theshark34.supdate.BarAPI;
import fr.theshark34.supdate.SUpdate;
import fr.theshark34.swinger.colored.SColoredBar;

import static fr.theshark34.swinger.Swinger.*;

import java.io.File;
import java.io.IOException;

public class LauncherUpdate {

private static SplashScreen splash;
private static SColoredBar bar;
private static Thread barThread;

private static final LauncherInfos TY_B_INFOS = new LauncherInfos("Tyrolium", "fr.tyrolium.maxime.launcher.LauncherFrame");
private static final File TY_DIR = GameDir.createGameDir("TyroliumLauncher");
private static final LauncherClasspath TY_B_CP = new LauncherClasspath(new File(TY_DIR, "Launcher/launcher.jar"), new File(TY_DIR, "Launcher/Libs/"));

private static ErrorUtil errorUtil = new ErrorUtil(new File(TY_DIR, ("Launcher/crashes")));

public static void main(String[] args) {

setResourcePath("/fr/tyrolium/maxime/update/ressources");
displaySplash();
try {
doUpdate();
} catch (Exception e) {
errorUtil.catchError(e, "Impossible de mettre a jour le launcher !");
barThread.interrupt();
}
try {
launchLauncher();
} catch (IOException e) {
errorUtil.catchError(e, "Impossible de lancer le launcher !");
barThread.interrupt();
}
}

private static void displaySplash() {

splash = new SplashScreen("Tyrolium", getResource("splash.png"));

bar = new SColoredBar(getTransparentWhite(100), getTransparentWhite(175));
bar.setBounds(0, 490, 350, 20);
splash.add(bar);

splash.setBackground(TRANSPARENT);
splash.getContentPane().setBackground(TRANSPARENT);
splash.setVisible(true);
}

private static void doUpdate() throws Exception{

SUpdate su = new SUpdate("http://tyrolium.fr/s-update-launch", new File(TY_DIR, "Launcher"));

barThread = new Thread() {
@Override
public void run() {
while(!this.isInterrupted()) {
bar.setValue((int) (BarAPI.getNumberOfTotalDownloadedBytes() / 1000));
bar.setMaximum((int) (BarAPI.getNumberOfTotalBytesToDownload() / 1000));
}
}
};
barThread.start();

su.start();
barThread.interrupt();

}

private static void launchLauncher() throws IOException{
Bootstrap bootstrap = new Bootstrap(TY_B_CP, TY_B_INFOS);
Process p = bootstrap.launch();

splash.setVisible(false);

try {
p.waitFor();
} catch (InterruptedException e) {
}
System.exit(0);
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e7078d9

Please sign in to comment.