Config lässt sich mit Packen und herunterladen + Code gereinigt

This commit is contained in:
simonr 2016-10-26 21:47:19 +02:00
parent a73961ea28
commit 7d0cdef440
5 changed files with 14 additions and 98 deletions

View file

@ -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) {}
}
}
}

View file

@ -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) {}
}
}
}

View file

@ -5,6 +5,7 @@
*/ */
package ModpackDownloader; package ModpackDownloader;
import Zipper.UnZip;
import forgemodpackbuilder.GUI; import forgemodpackbuilder.GUI;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
@ -23,6 +24,14 @@ public class ModpackDownloader {
public static void main(String[] args) throws MalformedURLException, IOException { 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 //Modpack URL Suchen
ModpackDownloader2.URL = GUI.URL + zeile; ModpackDownloader2.URL = GUI.URL + zeile;
ModpackDownloader2.output = "./modpack/modpack.txt"; ModpackDownloader2.output = "./modpack/modpack.txt";
@ -40,23 +49,22 @@ public class ModpackDownloader {
//Modpack Installieren //Modpack Installieren
FileReader fr1 = new FileReader("./modpack/modpack.txt"); FileReader fr1 = new FileReader("./modpack/modpack.txt");
BufferedReader br1 = new BufferedReader(fr1); BufferedReader br1 = new BufferedReader(fr1);
version = br1.readLine(); version = br1.readLine();
while ((zeile = br1.readLine()) != null) { while ((zeile = br1.readLine()) != null) {
ModpackDownloader2.URL = GUI.URL + "mods/" + version + "/" + zeile; ModpackDownloader2.URL = GUI.URL + "mods/" + version + "/" + zeile;
ModpackDownloader2.output = GUI.datei + "/mods/" + zeile; ModpackDownloader2.output = GUI.datei + "/mods/" + zeile;
ModpackDownloader2.main(null); ModpackDownloader2.main(null);
System.out.println("URL = " + GUI.URL + version + "/" + zeile); System.out.println("URL = " + GUI.URL + version + "/" + zeile);
System.out.println("Output = " + GUI.datei + "/mods/" + zeile); System.out.println("Output = " + GUI.datei + "/mods/" + zeile);
//Progressbar //Progressbar
GUI.zahl = mods; GUI.zahl = mods;
GUI.datei2 = zeile; GUI.datei1 = zeile;
GUI c = new GUI(); GUI c = new GUI();
c.progressnext(); c.progressnext();
} }
} }
} }

View file

@ -24,7 +24,7 @@ public class downloader1 {
public static void main(String[] args) throws Throwable { 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 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 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"; 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";

View file

@ -35,7 +35,7 @@ public class GUI extends javax.swing.JFrame {
public static ArrayList<String> mods0 = new ArrayList<String>(); public static ArrayList<String> mods0 = new ArrayList<String>();
public static ArrayList<String> mods1 = new ArrayList<String>(); public static ArrayList<String> mods1 = new ArrayList<String>();
public static String version = "1.10.2"; public static String version = "1.10.2";
public static String datei2 = null; public static String datei1 = null;
public static int funktion = 0; public static int funktion = 0;
public static String URL = "http://mgwywbvcwmot7vir.myfritz.net/"; public static String URL = "http://mgwywbvcwmot7vir.myfritz.net/";