From 7d0cdef4408047c1b637a3b66cc6f027560c7ca0 Mon Sep 17 00:00:00 2001 From: simonr Date: Wed, 26 Oct 2016 21:47:19 +0200 Subject: [PATCH] =?UTF-8?q?Config=20l=C3=A4sst=20sich=20mit=20Packen=20und?= =?UTF-8?q?=20herunterladen=20+=20Code=20gereinigt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DateiKopieren/DateiKopierenClass1.java | 46 -------------------- src/DateiKopieren/DateiKopierenClass2.java | 46 -------------------- src/ModpackDownloader/ModpackDownloader.java | 16 +++++-- src/ModpackDownloader/downloader1.java | 2 +- src/forgemodpackbuilder/GUI.java | 2 +- 5 files changed, 14 insertions(+), 98 deletions(-) delete mode 100644 src/DateiKopieren/DateiKopierenClass1.java delete mode 100644 src/DateiKopieren/DateiKopierenClass2.java diff --git a/src/DateiKopieren/DateiKopierenClass1.java b/src/DateiKopieren/DateiKopierenClass1.java deleted file mode 100644 index d4f8581..0000000 --- a/src/DateiKopieren/DateiKopierenClass1.java +++ /dev/null @@ -1,46 +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 DateiKopieren; - -/** - * - * @author simonr - */ -import forgemodpackbuilder.GUI; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.channels.FileChannel; - -public class DateiKopierenClass1 { - - public static void main(String[] args) throws IOException { - File inF = new File(GUI.datei); - File outF = new File("./modpack/modpack/" + GUI.datei.substring( GUI.datei.lastIndexOf( "/" ) + 1 )); - copyFile(inF, outF); - } - - public static void copyFile(File in, File out) throws IOException { - FileChannel inChannel = null; - FileChannel outChannel = null; - try { - inChannel = new FileInputStream(in).getChannel(); - outChannel = new FileOutputStream(out).getChannel(); - inChannel.transferTo(0, inChannel.size(), outChannel); - } catch (IOException e) { - throw e; - } finally { - try { - if (inChannel != null) - inChannel.close(); - if (outChannel != null) - outChannel.close(); - } catch (IOException e) {} - } - } -} - diff --git a/src/DateiKopieren/DateiKopierenClass2.java b/src/DateiKopieren/DateiKopierenClass2.java deleted file mode 100644 index bf6d50b..0000000 --- a/src/DateiKopieren/DateiKopierenClass2.java +++ /dev/null @@ -1,46 +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 DateiKopieren; - -/** - * - * @author simonr - */ -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.channels.FileChannel; - -public class DateiKopierenClass2 { - - public static void main(String[] args) throws IOException { - File inF = new File("./modpack/Minecraft.jar"); - File outF = new File("./modpack/modpack/Minecraft.jar"); - copyFile(inF, outF); - } - - public static void copyFile(File in, File out) throws IOException { - FileChannel inChannel = null; - FileChannel outChannel = null; - try { - inChannel = new FileInputStream(in).getChannel(); - outChannel = new FileOutputStream(out).getChannel(); - inChannel.transferTo(0, inChannel.size(), outChannel); - } catch (IOException e) { - throw e; - } finally { - try { - if (inChannel != null) - inChannel.close(); - if (outChannel != null) - outChannel.close(); - } catch (IOException e) {} - } - } -} - - diff --git a/src/ModpackDownloader/ModpackDownloader.java b/src/ModpackDownloader/ModpackDownloader.java index 2d8f183..9caf484 100644 --- a/src/ModpackDownloader/ModpackDownloader.java +++ b/src/ModpackDownloader/ModpackDownloader.java @@ -5,6 +5,7 @@ */ package ModpackDownloader; +import Zipper.UnZip; import forgemodpackbuilder.GUI; import java.io.BufferedReader; import java.io.FileReader; @@ -23,6 +24,14 @@ public class ModpackDownloader { public static void main(String[] args) throws MalformedURLException, IOException { + //Modpack-Config Download + ModpackDownloader2.URL = GUI.URL + zeile + ".zip"; + ModpackDownloader2.output = "./modpack/modpack.zip"; + ModpackDownloader2.main(null); + + UnZip.modpack = "./modpack/modpack.zip"; + UnZip.modpack1 = GUI.datei + "/"; + //Modpack URL Suchen ModpackDownloader2.URL = GUI.URL + zeile; ModpackDownloader2.output = "./modpack/modpack.txt"; @@ -40,23 +49,22 @@ public class ModpackDownloader { //Modpack Installieren FileReader fr1 = new FileReader("./modpack/modpack.txt"); BufferedReader br1 = new BufferedReader(fr1); - + version = br1.readLine(); while ((zeile = br1.readLine()) != null) { ModpackDownloader2.URL = GUI.URL + "mods/" + version + "/" + zeile; ModpackDownloader2.output = GUI.datei + "/mods/" + zeile; ModpackDownloader2.main(null); - + System.out.println("URL = " + GUI.URL + version + "/" + zeile); System.out.println("Output = " + GUI.datei + "/mods/" + zeile); //Progressbar GUI.zahl = mods; - GUI.datei2 = zeile; + GUI.datei1 = zeile; GUI c = new GUI(); c.progressnext(); } - } } diff --git a/src/ModpackDownloader/downloader1.java b/src/ModpackDownloader/downloader1.java index e8ab5ce..f9283e6 100644 --- a/src/ModpackDownloader/downloader1.java +++ b/src/ModpackDownloader/downloader1.java @@ -24,7 +24,7 @@ public class downloader1 { public static void main(String[] args) throws Throwable { - String forge10 = "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.10.2-12.18.2.2107/forge-1.10.2-12.18.2.2107-installer.jar"; + String forge10 = "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.10.2-12.18.2.2114/forge-1.10.2-12.18.2.2114-installer.jar"; String forge9 = "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.9.4-12.17.0.2051/forge-1.9.4-12.17.0.2051-installer.jar"; String forge8 = "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.8.9-11.15.1.1902-1.8.9/forge-1.8.9-11.15.1.1902-1.8.9-installer.jar"; 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"; diff --git a/src/forgemodpackbuilder/GUI.java b/src/forgemodpackbuilder/GUI.java index bb11d0d..b776634 100644 --- a/src/forgemodpackbuilder/GUI.java +++ b/src/forgemodpackbuilder/GUI.java @@ -35,7 +35,7 @@ public class GUI extends javax.swing.JFrame { 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 String datei1 = null; public static int funktion = 0; public static String URL = "http://mgwywbvcwmot7vir.myfritz.net/";