diff --git a/Xerxes b/Xerxes
deleted file mode 100644
index f41d776..0000000
--- a/Xerxes
+++ /dev/null
@@ -1,3 +0,0 @@
-1.10.2
-mod2.jar
-mod1.jar
diff --git a/Xerxes.zip b/Xerxes.zip
index 8c885b6..be04d4d 100644
Binary files a/Xerxes.zip and b/Xerxes.zip differ
diff --git a/modpack/Minecraft.jar b/modpack/Minecraft.jar
new file mode 100644
index 0000000..1f331a9
Binary files /dev/null and b/modpack/Minecraft.jar differ
diff --git a/modpack/forge.jar b/modpack/forge.jar
new file mode 100644
index 0000000..5cc3317
Binary files /dev/null and b/modpack/forge.jar differ
diff --git a/modpack/modpack.zip b/modpack/modpack.zip
new file mode 100644
index 0000000..be04d4d
Binary files /dev/null and b/modpack/modpack.zip differ
diff --git a/modpack/modpack/config/blablabla.config b/modpack/modpack/config/config.txt
similarity index 100%
rename from modpack/modpack/config/blablabla.config
rename to modpack/modpack/config/config.txt
diff --git a/modpack/modpack/version.txt b/modpack/modpack/version.txt
new file mode 100644
index 0000000..70ad429
--- /dev/null
+++ b/modpack/modpack/version.txt
@@ -0,0 +1 @@
+1.10.2
\ No newline at end of file
diff --git a/src/ModpackDownloader/ModpackDownloader.java b/src/ModpackDownloader/ModpackDownloader.java
index ea4161f..a7639d1 100644
--- a/src/ModpackDownloader/ModpackDownloader.java
+++ b/src/ModpackDownloader/ModpackDownloader.java
@@ -20,52 +20,17 @@ public class ModpackDownloader {
static int mods = 0;
public static String zeile = "";
- public static String version;
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);
+ //Modpack Download
+ ModpackDownloader1.URL = GUI.URL + zeile + ".zip";
+ ModpackDownloader1.output = "./modpack/modpack.zip";
+ ModpackDownloader1.main(null);
UnZip.modpack = "./modpack/modpack.zip";
UnZip.modpack1 = GUI.datei + "/";
UnZip.main();
-
- //Modpack URL Suchen
- ModpackDownloader2.URL = GUI.URL + 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 = 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.datei1 = zeile;
- GUI c = new GUI();
- c.progressnext();
- }
+
}
}
diff --git a/src/ModpackDownloader/ModpackDownloader1.java b/src/ModpackDownloader/ModpackDownloader1.java
new file mode 100644
index 0000000..e934e40
--- /dev/null
+++ b/src/ModpackDownloader/ModpackDownloader1.java
@@ -0,0 +1,78 @@
+/*
+ * 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 java.io.BufferedOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.swing.JFrame;
+import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+
+public class ModpackDownloader1 {
+
+ static String URL;
+ static String output;
+ private static JProgressBar jProgressBar;
+
+ public static void main(String[] args) {
+
+ jProgressBar = new JProgressBar();
+ jProgressBar.setMaximum(100000);
+ JFrame frame = new JFrame();
+ frame.setContentPane(jProgressBar);
+ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ frame.setSize(300, 70);
+ frame.setVisible(true);
+
+ run();
+ frame.dispose();
+
+ }
+
+ public static void run() {
+ try {
+
+ URL url = new URL(URL);
+ HttpURLConnection httpConnection = (HttpURLConnection) (url.openConnection());
+ long completeFileSize = httpConnection.getContentLength();
+
+ java.io.BufferedInputStream in = new java.io.BufferedInputStream(httpConnection.getInputStream());
+ java.io.FileOutputStream fos = new java.io.FileOutputStream(output);
+ java.io.BufferedOutputStream bout = new BufferedOutputStream(
+ fos, 1024);
+ byte[] data = new byte[1024];
+ long downloadedFileSize = 0;
+ int x = 0;
+ while ((x = in.read(data, 0, 1024)) >= 0) {
+ downloadedFileSize += x;
+
+ // calculate progress
+ final int currentProgress = (int) ((((double) downloadedFileSize) / ((double) completeFileSize)) * 100000d);
+
+ // update progress bar
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ jProgressBar.setValue(currentProgress);
+ }
+ });
+
+ bout.write(data, 0, x);
+ }
+ bout.close();
+ in.close();
+ } catch (FileNotFoundException e) {
+ } catch (IOException e) {
+ }
+ }
+
+}
diff --git a/src/ModpackDownloader/ModpackDownloader2.java b/src/ModpackDownloader/ModpackDownloader2.java
deleted file mode 100644
index 09af3de..0000000
--- a/src/ModpackDownloader/ModpackDownloader2.java
+++ /dev/null
@@ -1,44 +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 ModpackDownloader;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- *
- * @author simonr
- */
-public class ModpackDownloader2 {
-
- static String URL;
- static String output;
-
- public static void main(String[] args) throws MalformedURLException, IOException {
-
- final URL url = new URL(URL);
- final URLConnection conn = url.openConnection();
- try (InputStream is = new BufferedInputStream(conn.getInputStream())) {
- final OutputStream os;
- os = new BufferedOutputStream(new FileOutputStream(output));
- 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();
-
- }
- }
-}
diff --git a/src/ModpackDownloader/downloader1.java b/src/ModpackDownloader/downloader1.java
index f9283e6..da5ddd5 100644
--- a/src/ModpackDownloader/downloader1.java
+++ b/src/ModpackDownloader/downloader1.java
@@ -8,7 +8,9 @@ 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;
@@ -18,8 +20,6 @@ import java.net.URLConnection;
*
* @author simonr
*/
-
-
public class downloader1 {
public static void main(String[] args) throws Throwable {
@@ -31,6 +31,7 @@ public class downloader1 {
String total = "";
String version = "";
+ String version1 = "";
if (GUI.version.equals("1.10.2")) {
version = forge10;
@@ -46,16 +47,22 @@ public class downloader1 {
}
if (GUI.version.equals("Modpacks")) {
- if (ModpackDownloader.version.equals("1.10.2")) {
+ FileReader fr = new FileReader("./modpack/modpack/version.txt");
+ BufferedReader br = new BufferedReader(fr);
+
+ version1 = br.readLine();
+ br.close();
+
+ if (version1.equals("1.10.2")) {
version = forge10;
}
- if (ModpackDownloader.version.equals("1.9.4")) {
+ if (version1.equals("1.9.4")) {
version = forge9;
}
- if (ModpackDownloader.version.equals("1.8.9")) {
+ if (version1.equals("1.8.9")) {
version = forge8;
}
- if (ModpackDownloader.version.equals("1.7.10")) {
+ if (version1.equals("1.7.10")) {
version = forge7;
}
}
diff --git a/src/Zipper/Modpacktxt.java b/src/Zipper/Modpacktxt.java
index ffafbfd..0421ef5 100644
--- a/src/Zipper/Modpacktxt.java
+++ b/src/Zipper/Modpacktxt.java
@@ -16,19 +16,12 @@ import java.io.IOException;
*/
public class Modpacktxt {
- static String name;
-
public static void main(String[] args) throws IOException {
- FileWriter fw = new FileWriter(name);
+ FileWriter fw = new FileWriter("./modpack/modpack/version.txt");
BufferedWriter bw = new BufferedWriter(fw);
bw.write(GUI.version);
- bw.newLine();
- for (int i = 0; i < GUI.mods1.size(); i++) {
- bw.write(GUI.mods1.get(i).substring( GUI.mods1.get(i).lastIndexOf( "/" ) + 1 ));
- bw.newLine();
- }
bw.close();
}
diff --git a/src/Zipper/Zip.java b/src/Zipper/Zip.java
index e46cbc2..26f5e8a 100644
--- a/src/Zipper/Zip.java
+++ b/src/Zipper/Zip.java
@@ -16,7 +16,6 @@ import net.lingala.zip4j.util.*;
public class Zip {
String modpack = "";
- static String datum = "";
void archiveDir(String path) {
try {
@@ -25,7 +24,7 @@ public class Zip {
ZipFile zipFile = new ZipFile(modpack + ".zip");
// Folder to add
- String folderToAdd = "./modpack/modpack/config";
+ String folderToAdd = "./modpack/modpack";
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
@@ -38,7 +37,7 @@ public class Zip {
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
// Set the root folder
- //parameters.setIncludeRootFolder(false);
+ parameters.setIncludeRootFolder(false);
// Add folder to the zip file
zipFile.addFolder(folderToAdd, parameters);
diff --git a/src/Zipper/frage.java b/src/Zipper/frage.java
index 40dde93..a24c487 100644
--- a/src/Zipper/frage.java
+++ b/src/Zipper/frage.java
@@ -77,19 +77,20 @@ public class frage extends javax.swing.JFrame {
}// //GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
- // TODO add your handling code here:
- String name = jTextField1.getText();
- System.out.println(name);
- Zip a = new Zip();
- a.modpack = name;
- a.archiveDir(null);
- Modpacktxt.name = name;
+
try {
+ // TODO add your handling code here:
+ String name = jTextField1.getText();
+ System.out.println(name);
Modpacktxt.main(null);
+ Zip a = new Zip();
+ a.modpack = name;
+ a.archiveDir(null);
+ this.dispose();
} catch (IOException ex) {
Logger.getLogger(frage.class.getName()).log(Level.SEVERE, null, ex);
}
- this.dispose();
+
}//GEN-LAST:event_jButton1ActionPerformed
diff --git a/src/forgemodpackbuilder/GUI.form b/src/forgemodpackbuilder/GUI.form
index 96d9b81..d9ae89e 100644
--- a/src/forgemodpackbuilder/GUI.form
+++ b/src/forgemodpackbuilder/GUI.form
@@ -27,7 +27,6 @@
-
@@ -94,11 +93,9 @@
-
+
-
-
@@ -241,8 +238,6 @@
-
-
diff --git a/src/forgemodpackbuilder/GUI.java b/src/forgemodpackbuilder/GUI.java
index b776634..06836c7 100644
--- a/src/forgemodpackbuilder/GUI.java
+++ b/src/forgemodpackbuilder/GUI.java
@@ -70,7 +70,6 @@ public class GUI extends javax.swing.JFrame {
jButton6 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
- jProgressBar1 = new javax.swing.JProgressBar();
jButton7 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
@@ -167,7 +166,6 @@ public class GUI extends javax.swing.JFrame {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(4, 4, 4)
@@ -222,10 +220,8 @@ public class GUI extends javax.swing.JFrame {
.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)
- .addComponent(jScrollPane3))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE)
+ .addComponent(jScrollPane3)))
);
pack();
@@ -397,15 +393,6 @@ public class GUI extends javax.swing.JFrame {
System.out.println(URL);
}//GEN-LAST:event_jButton7ActionPerformed
- public void progressnext() {
-
- jProgressBar1.setMaximum(zahl);
- jProgressBar1.setValue(jProgressBar1.getValue() + 1);
- jProgressBar1.setStringPainted(true);
- jProgressBar1.setString(datei);
-
- }
-
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@@ -420,7 +407,6 @@ public class GUI extends javax.swing.JFrame {
private javax.swing.JLabel jLabel2;
private javax.swing.JList jList1;
private javax.swing.JList jList2;
- private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTextField jTextField1;