From 8ef4dd7852ef7068f4078192bef2e58e109bec19 Mon Sep 17 00:00:00 2001 From: simonr Date: Wed, 26 Oct 2016 15:03:33 +0200 Subject: [PATCH] =?UTF-8?q?Verbesserungen=20und=20S=C3=A4uberungen=20und?= =?UTF-8?q?=20neues=20System?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- forge.jar.log | 0 nbproject/build-impl.xml | 21 +-- nbproject/genfiles.properties | 4 +- nbproject/project.properties | 2 +- .../DateiKopierenClass.java | 3 +- .../DateiKopierenClass1.java | 3 +- .../DateiKopierenClass2.java | 2 +- .../FileDeleteExample.java | 3 +- src/ModpackDownloader/ModpackDownloader.java | 60 +++++++ .../ModpackDownloader2.java | 2 +- .../ModpackSuche.java | 9 +- .../downloader.java | 2 +- .../downloader1.java | 37 ++++- src/{forgemodpackbuilder => Suche}/Suche.java | 5 +- .../Suche1.java | 5 +- .../Suche2.java | 4 +- .../Suche3.java | 3 +- .../AktuellesDatumJava8.java | 3 +- .../Modpacktxt.java | 4 +- .../UnZip.java | 6 +- src/{forgemodpackbuilder => Zipper}/Zip.java | 2 +- .../frage.form | 0 .../frage.java | 4 +- src/forgemodpackbuilder/GUI.form | 27 +--- src/forgemodpackbuilder/GUI.java | 146 ++++++------------ .../ModpackDownloader.java | 102 ------------ .../{ProcExecExamples.java => ProcExec.java} | 10 +- src/main.java | 23 +++ test/NewJFrame.form | 65 ++++++++ test/NewJFrame.java | 121 +++++++++++++++ 30 files changed, 411 insertions(+), 267 deletions(-) create mode 100644 forge.jar.log rename src/{forgemodpackbuilder => DateiKopieren}/DateiKopierenClass.java (96%) rename src/{forgemodpackbuilder => DateiKopieren}/DateiKopierenClass1.java (96%) rename src/{forgemodpackbuilder => DateiKopieren}/DateiKopierenClass2.java (97%) rename src/{forgemodpackbuilder => DateiKopieren}/FileDeleteExample.java (91%) create mode 100644 src/ModpackDownloader/ModpackDownloader.java rename src/{forgemodpackbuilder => ModpackDownloader}/ModpackDownloader2.java (97%) rename src/{forgemodpackbuilder => ModpackDownloader}/ModpackSuche.java (86%) rename src/{forgemodpackbuilder => ModpackDownloader}/downloader.java (97%) rename src/{forgemodpackbuilder => ModpackDownloader}/downloader1.java (66%) rename src/{forgemodpackbuilder => Suche}/Suche.java (92%) rename src/{forgemodpackbuilder => Suche}/Suche1.java (92%) rename src/{forgemodpackbuilder => Suche}/Suche2.java (92%) rename src/{forgemodpackbuilder => Suche}/Suche3.java (93%) rename src/{forgemodpackbuilder => Zipper}/AktuellesDatumJava8.java (95%) rename src/{forgemodpackbuilder => Zipper}/Modpacktxt.java (90%) rename src/{forgemodpackbuilder => Zipper}/UnZip.java (88%) rename src/{forgemodpackbuilder => Zipper}/Zip.java (97%) rename src/{forgemodpackbuilder => Zipper}/frage.form (100%) rename src/{forgemodpackbuilder => Zipper}/frage.java (98%) delete mode 100644 src/forgemodpackbuilder/ModpackDownloader.java rename src/forgemodpackbuilder/{ProcExecExamples.java => ProcExec.java} (66%) create mode 100644 src/main.java create mode 100644 test/NewJFrame.form create mode 100644 test/NewJFrame.java diff --git a/forge.jar.log b/forge.jar.log new file mode 100644 index 0000000..e69de29 diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index ec99f4a..d125eae 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -46,8 +46,8 @@ is divided into following sections: - - + + @@ -76,7 +76,7 @@ is divided into following sections: - + @@ -156,6 +156,7 @@ is divided into following sections: + @@ -840,7 +841,7 @@ is divided into following sections: - + @@ -852,7 +853,7 @@ is divided into following sections: - + @@ -975,15 +976,15 @@ is divided into following sections: - + - + - + @@ -991,7 +992,7 @@ is divided into following sections: - + @@ -1186,7 +1187,7 @@ is divided into following sections: Must select one file in the IDE or set run.class - + Must select one file in the IDE or set applet.url diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 17c6539..9fe0d18 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=8064a381@1.79.1.48 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=e9df12b1 -nbproject/build-impl.xml.script.CRC32=869e51d9 -nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 +nbproject/build-impl.xml.script.CRC32=4048cd96 +nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/nbproject/project.properties b/nbproject/project.properties index 6b7fb8a..4c06539 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -58,7 +58,7 @@ javadoc.splitindex=true javadoc.use=true javadoc.version=false javadoc.windowtitle= -main.class=forgemodpackbuilder.GUI +main.class=main manifest.file=manifest.mf meta.inf.dir=${src.dir}/META-INF mkdist.disabled=false diff --git a/src/forgemodpackbuilder/DateiKopierenClass.java b/src/DateiKopieren/DateiKopierenClass.java similarity index 96% rename from src/forgemodpackbuilder/DateiKopierenClass.java rename to src/DateiKopieren/DateiKopierenClass.java index 5336f5f..24c5f0f 100644 --- a/src/forgemodpackbuilder/DateiKopierenClass.java +++ b/src/DateiKopieren/DateiKopierenClass.java @@ -3,12 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package DateiKopieren; /** * * @author simonr */ +import forgemodpackbuilder.GUI; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; diff --git a/src/forgemodpackbuilder/DateiKopierenClass1.java b/src/DateiKopieren/DateiKopierenClass1.java similarity index 96% rename from src/forgemodpackbuilder/DateiKopierenClass1.java rename to src/DateiKopieren/DateiKopierenClass1.java index 572300f..d4f8581 100644 --- a/src/forgemodpackbuilder/DateiKopierenClass1.java +++ b/src/DateiKopieren/DateiKopierenClass1.java @@ -3,12 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package DateiKopieren; /** * * @author simonr */ +import forgemodpackbuilder.GUI; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; diff --git a/src/forgemodpackbuilder/DateiKopierenClass2.java b/src/DateiKopieren/DateiKopierenClass2.java similarity index 97% rename from src/forgemodpackbuilder/DateiKopierenClass2.java rename to src/DateiKopieren/DateiKopierenClass2.java index f681842..bf6d50b 100644 --- a/src/forgemodpackbuilder/DateiKopierenClass2.java +++ b/src/DateiKopieren/DateiKopierenClass2.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package DateiKopieren; /** * diff --git a/src/forgemodpackbuilder/FileDeleteExample.java b/src/DateiKopieren/FileDeleteExample.java similarity index 91% rename from src/forgemodpackbuilder/FileDeleteExample.java rename to src/DateiKopieren/FileDeleteExample.java index b78771d..8857d8d 100644 --- a/src/forgemodpackbuilder/FileDeleteExample.java +++ b/src/DateiKopieren/FileDeleteExample.java @@ -3,12 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package DateiKopieren; /** * * @author simonr */ +import forgemodpackbuilder.GUI; import java.io.File; public class FileDeleteExample { diff --git a/src/ModpackDownloader/ModpackDownloader.java b/src/ModpackDownloader/ModpackDownloader.java new file mode 100644 index 0000000..bf6bda8 --- /dev/null +++ b/src/ModpackDownloader/ModpackDownloader.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ModpackDownloader; + +import ModpackDownloader.ModpackDownloader2; +import forgemodpackbuilder.GUI; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.net.MalformedURLException; + +/** + * + * @author simonr + */ +public class ModpackDownloader { + + static int mods = 0; + public static String zeile = ""; + private static String version; + + public static void main(String[] args) throws MalformedURLException, IOException { + + //Modpack URL Suchen + ModpackDownloader2.URL = "http://localhost/" + zeile; + ModpackDownloader2.output = "./modpack/modpack.txt"; + ModpackDownloader2.main(null); + + //Progressbar Modpack durchsuchen + FileReader fr = new FileReader("./modpack/modpack.txt"); + BufferedReader br = new BufferedReader(fr); + + while ((zeile = br.readLine()) != null) { + mods++; + } + System.out.println("Mods = " + mods); + + //Modpack Installieren + FileReader fr1 = new FileReader("./modpack/modpack.txt"); + BufferedReader br1 = new BufferedReader(fr1); + + version = br1.readLine(); + + while ((zeile = br1.readLine()) != null) { + ModpackDownloader2.URL = "http://localhost/mods/" + version + "/" + zeile; + ModpackDownloader2.output = GUI.datei + "/mods/" + zeile; + ModpackDownloader2.main(null); + + //Progressbar + GUI.zahl = mods; + GUI.datei2 = zeile; + GUI c = new GUI(); + c.progressnext(); + } + + } +} diff --git a/src/forgemodpackbuilder/ModpackDownloader2.java b/src/ModpackDownloader/ModpackDownloader2.java similarity index 97% rename from src/forgemodpackbuilder/ModpackDownloader2.java rename to src/ModpackDownloader/ModpackDownloader2.java index 80b8178..09af3de 100644 --- a/src/forgemodpackbuilder/ModpackDownloader2.java +++ b/src/ModpackDownloader/ModpackDownloader2.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package ModpackDownloader; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; diff --git a/src/forgemodpackbuilder/ModpackSuche.java b/src/ModpackDownloader/ModpackSuche.java similarity index 86% rename from src/forgemodpackbuilder/ModpackSuche.java rename to src/ModpackDownloader/ModpackSuche.java index b3a78cd..522b4f8 100644 --- a/src/forgemodpackbuilder/ModpackSuche.java +++ b/src/ModpackDownloader/ModpackSuche.java @@ -3,8 +3,9 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package ModpackDownloader; +import forgemodpackbuilder.GUI; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; @@ -24,11 +25,11 @@ public class ModpackSuche { public static void main(String[] args) throws IOException { - final URL url = new URL("https://www.dropbox.com/s/fjy9lnv5ga00hq4/Modpacks.txt?dl=1"); + final URL url = new URL("http://localhost/modpacks.txt"); final URLConnection conn = url.openConnection(); try (InputStream is = new BufferedInputStream(conn.getInputStream())) { final OutputStream os; - os = new BufferedOutputStream(new FileOutputStream("./modpack/Modpacks/Modpacks.txt")); + os = new BufferedOutputStream(new FileOutputStream("./modpack/modpacks.txt")); byte[] chunk = new byte[1024]; int chunkSize; while ((chunkSize = is.read(chunk)) != -1) { @@ -38,7 +39,7 @@ public class ModpackSuche { os.close(); // Datei durchsuchen - FileReader fr = new FileReader("./modpack/Modpacks/Modpacks.txt"); + FileReader fr = new FileReader("./modpack/modpacks.txt"); BufferedReader br = new BufferedReader(fr); String zeile; diff --git a/src/forgemodpackbuilder/downloader.java b/src/ModpackDownloader/downloader.java similarity index 97% rename from src/forgemodpackbuilder/downloader.java rename to src/ModpackDownloader/downloader.java index 30cc2ff..d5b261e 100644 --- a/src/forgemodpackbuilder/downloader.java +++ b/src/ModpackDownloader/downloader.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package ModpackDownloader; import java.io.BufferedInputStream; import java.io.BufferedOutputStream;; diff --git a/src/forgemodpackbuilder/downloader1.java b/src/ModpackDownloader/downloader1.java similarity index 66% rename from src/forgemodpackbuilder/downloader1.java rename to src/ModpackDownloader/downloader1.java index fc61f0f..4f6117d 100644 --- a/src/forgemodpackbuilder/downloader1.java +++ b/src/ModpackDownloader/downloader1.java @@ -3,12 +3,15 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package ModpackDownloader; +import forgemodpackbuilder.GUI; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; +import java.io.BufferedReader; ; import java.io.FileOutputStream; +import java.io.FileReader; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; @@ -30,25 +33,45 @@ public class downloader1 { String forge7 = "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/forge-1.7.10-10.13.4.1614-1.7.10-installer.jar"; String total = ""; + String version = ""; if (GUI.version.equals("1.10.2")) { - total = forge10; + version = forge10; } if (GUI.version.equals("1.9.4")) { - total = forge9; + version = forge9; } if (GUI.version.equals("1.8.9")) { - total = forge8; + version = forge8; } if (GUI.version.equals("1.7.10")) { - total = forge7; + version = forge7; + } + if (GUI.version.equals("Modpacks")) { + FileReader fr = new FileReader("./modpack/modpack.txt"); + BufferedReader br = new BufferedReader(fr); + total = br.readLine(); + System.out.println(total); + + if (total.equals("1.10.2")) { + version = forge10; + } + if (total.equals("1.9.4")) { + version = forge9; + } + if (total.equals("1.8.9")) { + version = forge8; + } + if (total.equals("1.7.10")) { + version = forge7; + } } - final URL url = new URL(total); + final URL url = new URL(version); final URLConnection conn = url.openConnection(); try (InputStream is = new BufferedInputStream(conn.getInputStream())) { final OutputStream os; - os = new BufferedOutputStream(new FileOutputStream("./modpack/" + GUI.version + "/" + total.substring(total.lastIndexOf("/") + 1))); + os = new BufferedOutputStream(new FileOutputStream("./modpack/forge.jar")); byte[] chunk = new byte[1024]; int chunkSize; while ((chunkSize = is.read(chunk)) != -1) { diff --git a/src/forgemodpackbuilder/Suche.java b/src/Suche/Suche.java similarity index 92% rename from src/forgemodpackbuilder/Suche.java rename to src/Suche/Suche.java index 014a8ec..8aaf1f4 100644 --- a/src/forgemodpackbuilder/Suche.java +++ b/src/Suche/Suche.java @@ -3,8 +3,9 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Suche; +import forgemodpackbuilder.GUI; import java.io.File; /** @@ -13,7 +14,7 @@ import java.io.File; */ public class Suche { - static String name = ""; + public static String name = ""; public static void main(String[] args) { diff --git a/src/forgemodpackbuilder/Suche1.java b/src/Suche/Suche1.java similarity index 92% rename from src/forgemodpackbuilder/Suche1.java rename to src/Suche/Suche1.java index e1e6fd4..1802588 100644 --- a/src/forgemodpackbuilder/Suche1.java +++ b/src/Suche/Suche1.java @@ -3,8 +3,9 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Suche; +import forgemodpackbuilder.GUI; import java.io.File; /** @@ -13,7 +14,7 @@ import java.io.File; */ public class Suche1 { - static String name = ""; + public static String name = ""; public static void main(String[] args) { diff --git a/src/forgemodpackbuilder/Suche2.java b/src/Suche/Suche2.java similarity index 92% rename from src/forgemodpackbuilder/Suche2.java rename to src/Suche/Suche2.java index 1b779b6..fa2c286 100644 --- a/src/forgemodpackbuilder/Suche2.java +++ b/src/Suche/Suche2.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Suche; /** * @@ -13,7 +13,7 @@ import java.io.File; public class Suche2 { - static String filename; + public static String filename; public static void main(String[] args) { diff --git a/src/forgemodpackbuilder/Suche3.java b/src/Suche/Suche3.java similarity index 93% rename from src/forgemodpackbuilder/Suche3.java rename to src/Suche/Suche3.java index 5e0cf01..b323b64 100644 --- a/src/forgemodpackbuilder/Suche3.java +++ b/src/Suche/Suche3.java @@ -3,12 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Suche; /** * * @author simonr */ +import forgemodpackbuilder.GUI; import java.io.File; public class Suche3 { diff --git a/src/forgemodpackbuilder/AktuellesDatumJava8.java b/src/Zipper/AktuellesDatumJava8.java similarity index 95% rename from src/forgemodpackbuilder/AktuellesDatumJava8.java rename to src/Zipper/AktuellesDatumJava8.java index 52d10ed..711612b 100644 --- a/src/forgemodpackbuilder/AktuellesDatumJava8.java +++ b/src/Zipper/AktuellesDatumJava8.java @@ -3,12 +3,13 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Zipper; /** * * @author simonr */ +import Zipper.Zip; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/forgemodpackbuilder/Modpacktxt.java b/src/Zipper/Modpacktxt.java similarity index 90% rename from src/forgemodpackbuilder/Modpacktxt.java rename to src/Zipper/Modpacktxt.java index 049c8e2..2f05e24 100644 --- a/src/forgemodpackbuilder/Modpacktxt.java +++ b/src/Zipper/Modpacktxt.java @@ -3,8 +3,9 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Zipper; +import forgemodpackbuilder.GUI; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; @@ -22,6 +23,7 @@ public class Modpacktxt { FileWriter fw = new FileWriter(name + ".txt"); BufferedWriter bw = new BufferedWriter(fw); + bw.write(GUI.version); for (int i = 0; i < GUI.mods1.size(); i++) { bw.write(GUI.mods1.get(i).substring( GUI.mods1.get(i).lastIndexOf( "/" ) + 1 )); bw.newLine(); diff --git a/src/forgemodpackbuilder/UnZip.java b/src/Zipper/UnZip.java similarity index 88% rename from src/forgemodpackbuilder/UnZip.java rename to src/Zipper/UnZip.java index ab3ac2f..75827df 100644 --- a/src/forgemodpackbuilder/UnZip.java +++ b/src/Zipper/UnZip.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Zipper; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.exception.ZipException; @@ -14,8 +14,8 @@ import net.lingala.zip4j.exception.ZipException; */ public class UnZip { - static String modpack = ""; - static String modpack1 = ""; + public static String modpack = ""; + public static String modpack1 = ""; public static void main() { String source = modpack; String destination = modpack1; diff --git a/src/forgemodpackbuilder/Zip.java b/src/Zipper/Zip.java similarity index 97% rename from src/forgemodpackbuilder/Zip.java rename to src/Zipper/Zip.java index 90415d4..f1ce138 100644 --- a/src/forgemodpackbuilder/Zip.java +++ b/src/Zipper/Zip.java @@ -3,7 +3,7 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Zipper; /** * diff --git a/src/forgemodpackbuilder/frage.form b/src/Zipper/frage.form similarity index 100% rename from src/forgemodpackbuilder/frage.form rename to src/Zipper/frage.form diff --git a/src/forgemodpackbuilder/frage.java b/src/Zipper/frage.java similarity index 98% rename from src/forgemodpackbuilder/frage.java rename to src/Zipper/frage.java index afdb713..17b2a3b 100644 --- a/src/forgemodpackbuilder/frage.java +++ b/src/Zipper/frage.java @@ -3,8 +3,10 @@ * To change this template file, choose Tools | Templates * and open the template in the editor. */ -package forgemodpackbuilder; +package Zipper; +import Zipper.AktuellesDatumJava8; +import Zipper.Zip; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/src/forgemodpackbuilder/GUI.form b/src/forgemodpackbuilder/GUI.form index c5d9e8d..192b99f 100644 --- a/src/forgemodpackbuilder/GUI.form +++ b/src/forgemodpackbuilder/GUI.form @@ -34,10 +34,8 @@ - - - - + + @@ -56,11 +54,11 @@ - + - + - + @@ -75,10 +73,9 @@ - - + @@ -86,10 +83,10 @@ - - + + @@ -241,14 +238,6 @@ - - - - - - - - diff --git a/src/forgemodpackbuilder/GUI.java b/src/forgemodpackbuilder/GUI.java index 7d56d01..d60ff67 100644 --- a/src/forgemodpackbuilder/GUI.java +++ b/src/forgemodpackbuilder/GUI.java @@ -5,6 +5,16 @@ */ package forgemodpackbuilder; +import ModpackDownloader.ModpackSuche; +import DateiKopieren.DateiKopierenClass; +import DateiKopieren.FileDeleteExample; +import Zipper.frage; +import Zipper.UnZip; +import ModpackDownloader.ModpackDownloader; +import ModpackDownloader.downloader1; +import ModpackDownloader.downloader; +import Suche.Suche1; +import Suche.Suche; import java.awt.event.KeyEvent; import java.io.File; import java.io.IOException; @@ -20,10 +30,13 @@ import javax.swing.JOptionPane; */ public class GUI extends javax.swing.JFrame { - static String datei = null; - static ArrayList mods0 = new ArrayList(); - static ArrayList mods1 = new ArrayList(); - static String version = "1.10.2"; + public static String datei = null; + public static int zahl = 0; + public static ArrayList mods0 = new ArrayList(); + public static ArrayList mods1 = new ArrayList(); + public static String version = "1.10.2"; + public static String datei2 = null; + public static int funktion = 0; /** * Creates new form GUI @@ -56,7 +69,6 @@ public class GUI extends javax.swing.JFrame { jButton6 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); - jButton7 = new javax.swing.JButton(); jProgressBar1 = new javax.swing.JProgressBar(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); @@ -139,13 +151,6 @@ public class GUI extends javax.swing.JFrame { } }); - jButton7.setText("Bibliotheken download"); - jButton7.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButton7ActionPerformed(evt); - } - }); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -160,10 +165,8 @@ public class GUI extends javax.swing.JFrame { .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(58, 58, 58) .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(158, 158, 158) + .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() @@ -179,11 +182,11 @@ public class GUI extends javax.swing.JFrame { .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE) + .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() - .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addContainerGap()) ); layout.setVerticalGroup( @@ -192,20 +195,19 @@ public class GUI extends javax.swing.JFrame { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(jButton3) - .addComponent(jButton4) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButton6)) + .addComponent(jButton6) + .addComponent(jButton5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2) - .addComponent(jButton5) .addComponent(jButton8) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButton7))) + .addComponent(jButton4) + .addComponent(jButton3))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE) @@ -232,7 +234,6 @@ public class GUI extends javax.swing.JFrame { private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: - //jProgressBar1.setValue(10); String s = (String) jComboBox1.getSelectedItem(); System.out.println(s); version = s; @@ -275,23 +276,30 @@ public class GUI extends javax.swing.JFrame { }//GEN-LAST:event_jButton2ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed - // TODO add your handling code here: - ProcExecExamples.funktion = 1; + try { - ProcExecExamples.main(null); - } catch (Exception ex) { + downloader.main(null); + funktion = 1; + ProcExec.main(null); + } catch (Throwable ex) { Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton3ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed - // TODO add your handling code here: - ProcExecExamples.funktion = 2; + try { - ProcExecExamples.main(null); - } catch (Exception ex) { + // TODO add your handling code here: + File dir = new File(System.getProperty("user.home") + "/.minecraft"); + dir.mkdir(); + + downloader1.main(null); + funktion = 2; + ProcExec.main(null); + } catch (Throwable ex) { Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex); } + }//GEN-LAST:event_jButton4ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed @@ -323,22 +331,22 @@ public class GUI extends javax.swing.JFrame { UnZip.modpack1 = datei; UnZip.main(); } else { - ModpackDownloader.modpack = jList1.getSelectedValue(); JOptionPane.showMessageDialog(null, "Bitte geben sie einen Installationsort für das Modpack!"); OeffnenDialogClass.main(null); System.out.println("GUI = " + datei); File dir = new File(datei + "/mods"); dir.mkdir(); - ModpackDownloader.install = datei; + System.out.println("Ausgewählt = " + jList1.getSelectedValue()); + ModpackDownloader.zeile = jList1.getSelectedValue(); ModpackDownloader.main(null); } + jButton3ActionPerformed(evt); jButton4ActionPerformed(evt); } catch (java.lang.NullPointerException ex) { System.out.println("Keine Eingabe!!!"); - }catch (IOException ex) { + } catch (IOException ex) { System.out.println("Fehler!!!"); } - //jButton3ActionPerformed(evt); }//GEN-LAST:event_jButton6ActionPerformed private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed @@ -363,21 +371,6 @@ public class GUI extends javax.swing.JFrame { }//GEN-LAST:event_jTextField1ActionPerformed - private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed - try { - // TODO add your handling code here: - downloader.main(null); - downloader1.main(null); - Suche3.main(null); - DateiKopierenClass1.main(null); - DateiKopierenClass2.main(null); - String file = "./modpack/modpack/" + GUI.datei.substring(GUI.datei.lastIndexOf("/") + 1); - new File(file).renameTo(new File("./modpack/modpack/forge.jar")); - } catch (Throwable ex) { - Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex); - } - }//GEN-LAST:event_jButton7ActionPerformed - private void jList1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jList1KeyPressed // TODO add your handling code here: if (evt.getKeyCode() == KeyEvent.VK_ENTER) { @@ -386,51 +379,13 @@ public class GUI extends javax.swing.JFrame { } }//GEN-LAST:event_jList1KeyPressed - DefaultListModel dim2 = new DefaultListModel(); + public void progressnext() { - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; + jProgressBar1.setMaximum(zahl); + jProgressBar1.setValue(jProgressBar1.getValue() + 1); + jProgressBar1.setStringPainted(true); + jProgressBar1.setString(datei); - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(GUI.class - .getName()).log(java.util.logging.Level.SEVERE, null, ex); - - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(GUI.class - .getName()).log(java.util.logging.Level.SEVERE, null, ex); - - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(GUI.class - .getName()).log(java.util.logging.Level.SEVERE, null, ex); - - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(GUI.class - .getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - System.out.println("Hallo Welt"); - new GUI().setVisible(true); - File dir = new File("./modpack"); - dir.mkdir(); - System.out.println(System.getProperty("user.home")); - }); } // Variables declaration - do not modify//GEN-BEGIN:variables @@ -440,7 +395,6 @@ public class GUI extends javax.swing.JFrame { private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; - private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JComboBox jComboBox1; private javax.swing.JLabel jLabel1; diff --git a/src/forgemodpackbuilder/ModpackDownloader.java b/src/forgemodpackbuilder/ModpackDownloader.java deleted file mode 100644 index 9666630..0000000 --- a/src/forgemodpackbuilder/ModpackDownloader.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package forgemodpackbuilder; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; - -/** - * - * @author simonr - */ -public class ModpackDownloader { - - static String install; - static String modpack = "Xerxes"; - static ArrayList text = new ArrayList(); - - public static void main(String[] args) throws MalformedURLException, IOException { - - final URL url = new URL("https://www.dropbox.com/s/n91j0wjb88s8341/URL.txt?dl=1"); - final URLConnection conn = url.openConnection(); - try (InputStream is = new BufferedInputStream(conn.getInputStream())) { - final OutputStream os; - os = new BufferedOutputStream(new FileOutputStream("./modpack/Modpacks/URL.txt")); - byte[] chunk = new byte[1024]; - int chunkSize; - while ((chunkSize = is.read(chunk)) != -1) { - os.write(chunk, 0, chunkSize); - } - os.flush(); // Necessary for Java < 6 - os.close(); - - //Modpack URL Suchen - FileReader fr = new FileReader("./modpack/Modpacks/URL.txt"); - BufferedReader br = new BufferedReader(fr); - - String zeile = ""; - - int b = 0; - while (!(zeile.equals(modpack))) { - zeile = br.readLine(); - System.out.println(zeile); - text.add(zeile); - b++; - } - System.out.println(text.get(b - 2)); - - br.close(); - - //Modpack Installieren - ModpackDownloader2.URL = text.get(b - 2); - ModpackDownloader2.output = "./modpack/Modpacks/Modpack.txt"; - ModpackDownloader2.main(null); - text.clear(); - - FileReader fr1 = new FileReader("./modpack/Modpacks/Modpack.txt"); - BufferedReader br1 = new BufferedReader(fr1); - - String zeile1 = ""; - - while ((zeile1 = br1.readLine()) != null) { - System.out.println(zeile1); - - FileReader fr2 = new FileReader("./modpack/Modpacks/URL.txt"); - BufferedReader br2 = new BufferedReader(fr2); - - b = 0; - zeile = ""; - while (!(zeile.equals(modpack))) { - zeile = br2.readLine(); - System.out.println(zeile); - text.add(zeile); - b++; - } - - br2.close(); - - ModpackDownloader2.URL = text.get(b - 2); - ModpackDownloader2.output = install + "/mods/" + zeile1; - ModpackDownloader2.main(null); - text.clear(); - - } - - br1.close(); - - } - } -} diff --git a/src/forgemodpackbuilder/ProcExecExamples.java b/src/forgemodpackbuilder/ProcExec.java similarity index 66% rename from src/forgemodpackbuilder/ProcExecExamples.java rename to src/forgemodpackbuilder/ProcExec.java index 5624c1a..e6da923 100644 --- a/src/forgemodpackbuilder/ProcExecExamples.java +++ b/src/forgemodpackbuilder/ProcExec.java @@ -10,17 +10,15 @@ package forgemodpackbuilder; * @author simonr */ -public class ProcExecExamples { - - public static int funktion = 1; +public class ProcExec { public static void main(String[] args) throws Exception { - if (funktion == 1) { + if (GUI.funktion == 1) { Runtime.getRuntime().exec("java -jar ./modpack/Minecraft.jar"); } - if (funktion == 2) { - Runtime.getRuntime().exec("java -jar ./modpack/modpack/forge.jar"); + if (GUI.funktion == 2) { + Runtime.getRuntime().exec("java -jar ./modpack/forge.jar"); } } } diff --git a/src/main.java b/src/main.java new file mode 100644 index 0000000..e4497c1 --- /dev/null +++ b/src/main.java @@ -0,0 +1,23 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + + +import forgemodpackbuilder.GUI; +import java.io.File; + +/** + * + * @author simonr + */ +public class main { + public static void main(String[] args) { + System.out.println("Hallo Welt"); + new GUI().setVisible(true); + File dir = new File("./modpack"); + dir.mkdir(); + System.out.println(System.getProperty("user.home")); + } +} diff --git a/test/NewJFrame.form b/test/NewJFrame.form new file mode 100644 index 0000000..2cc5064 --- /dev/null +++ b/test/NewJFrame.form @@ -0,0 +1,65 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/test/NewJFrame.java b/test/NewJFrame.java new file mode 100644 index 0000000..97d5561 --- /dev/null +++ b/test/NewJFrame.java @@ -0,0 +1,121 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author simonr + */ +public class NewJFrame extends javax.swing.JFrame { + + /** + * Creates new form NewJFrame + */ + public NewJFrame() { + initComponents(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jProgressBar1 = new javax.swing.JProgressBar(); + jButton1 = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jButton1.setText("jButton1"); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap(156, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(134, 134, 134)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(jButton1) + .addGap(180, 180, 180)))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(161, Short.MAX_VALUE) + .addComponent(jButton1) + .addGap(43, 43, 43) + .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(47, 47, 47)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + + jProgressBar1.setMaximum(10); + jProgressBar1.setValue(jProgressBar1.getValue() + 1); + jProgressBar1.setStringPainted(true); + jProgressBar1.setString("hi"); + + + + + + }//GEN-LAST:event_jButton1ActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new NewJFrame().setVisible(true); + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JProgressBar jProgressBar1; + // End of variables declaration//GEN-END:variables +}