Initial git commit
This commit is contained in:
BIN
QuickLaunchUpdateServer/.DS_Store
vendored
Normal file
BIN
QuickLaunchUpdateServer/.DS_Store
vendored
Normal file
Binary file not shown.
6
QuickLaunchUpdateServer/.classpath
Normal file
6
QuickLaunchUpdateServer/.classpath
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
QuickLaunchUpdateServer/.project
Normal file
17
QuickLaunchUpdateServer/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>QuickLaunchUpdateServer</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>
|
||||
11
QuickLaunchUpdateServer/.settings/org.eclipse.jdt.core.prefs
Normal file
11
QuickLaunchUpdateServer/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,11 @@
|
||||
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.source=1.8
|
||||
BIN
QuickLaunchUpdateServer/bin/run/ServerThread.class
Normal file
BIN
QuickLaunchUpdateServer/bin/run/ServerThread.class
Normal file
Binary file not shown.
BIN
QuickLaunchUpdateServer/bin/run/Start.class
Normal file
BIN
QuickLaunchUpdateServer/bin/run/Start.class
Normal file
Binary file not shown.
BIN
QuickLaunchUpdateServer/bin/run/UpdateThread.class
Normal file
BIN
QuickLaunchUpdateServer/bin/run/UpdateThread.class
Normal file
Binary file not shown.
67
QuickLaunchUpdateServer/src/run/ServerThread.java
Normal file
67
QuickLaunchUpdateServer/src/run/ServerThread.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package run;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import run.Start;
|
||||
|
||||
public class ServerThread
|
||||
implements Runnable {
|
||||
int PORT;
|
||||
|
||||
public ServerThread(int port) {
|
||||
this.PORT = port;
|
||||
}
|
||||
|
||||
boolean updateNeeded = true;
|
||||
ServerSocket ses;
|
||||
Socket s;
|
||||
DataOutputStream out;
|
||||
DataInputStream in;
|
||||
|
||||
public void run() {
|
||||
do {
|
||||
try {
|
||||
do {
|
||||
updateNeeded = true;
|
||||
ses = new ServerSocket(this.PORT);
|
||||
s = ses.accept();
|
||||
System.out.println("Connected with: " + s.getInetAddress());
|
||||
out = new DataOutputStream(s.getOutputStream());
|
||||
in = new DataInputStream(s.getInputStream());
|
||||
out.writeFloat(Start.version);
|
||||
|
||||
System.out.println(in.readUTF());
|
||||
System.out.println(in.readUTF());
|
||||
System.out.println(in.readUTF());
|
||||
System.out.println(in.readUTF());
|
||||
|
||||
updateNeeded = in.readBoolean();
|
||||
|
||||
if (updateNeeded) {
|
||||
System.out.println("Update needed, Download link was send");
|
||||
out.writeUTF(Start.download);
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
s.close();
|
||||
ses.close();
|
||||
} while (true);
|
||||
}
|
||||
catch (IOException io) {
|
||||
io.printStackTrace();
|
||||
try {
|
||||
out.close();
|
||||
in.close();
|
||||
s.close();
|
||||
ses.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Server panic");
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
25
QuickLaunchUpdateServer/src/run/Start.java
Normal file
25
QuickLaunchUpdateServer/src/run/Start.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package run;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import run.ServerThread;
|
||||
import run.UpdateThread;
|
||||
|
||||
public class Start {
|
||||
public static float version = -1.0f;
|
||||
public static String download = "";
|
||||
|
||||
private static final int PORT = 9999;
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version:"));
|
||||
download = JOptionPane.showInputDialog("Link to downloadable");
|
||||
Thread ut = new Thread(new UpdateThread());
|
||||
ut.start();
|
||||
System.out.println("Update thread started");
|
||||
Thread st = new Thread(new ServerThread(PORT));
|
||||
st.start();
|
||||
System.out.println("Server listening");
|
||||
}
|
||||
}
|
||||
15
QuickLaunchUpdateServer/src/run/UpdateThread.java
Normal file
15
QuickLaunchUpdateServer/src/run/UpdateThread.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package run;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
import run.Start;
|
||||
|
||||
public class UpdateThread
|
||||
implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
do {
|
||||
Start.version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version (" + Start.version + "): "));
|
||||
Start.download = JOptionPane.showInputDialog("Link to downloadable:");
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user