Download von Modpacks und erstellen von Modpacks Online
This commit is contained in:
parent
90bae0c04a
commit
cae7bb411d
12 changed files with 342 additions and 60 deletions
|
@ -24,9 +24,10 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jProgressBar1" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
|
||||
|
@ -39,8 +40,8 @@
|
|||
<Component id="jButton3" min="-2" pref="157" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
|
@ -51,7 +52,7 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" min="-2" pref="537" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="537" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
|
@ -96,7 +97,8 @@
|
|||
<Component id="jScrollPane1" pref="478" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane3" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jProgressBar1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -199,11 +201,12 @@
|
|||
<Component class="javax.swing.JComboBox" name="jComboBox1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="1.10.2"/>
|
||||
<StringItem index="1" value="1.9.4"/>
|
||||
<StringItem index="2" value="1.8.9"/>
|
||||
<StringItem index="3" value="1.7.10"/>
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Modpacks"/>
|
||||
<StringItem index="1" value="1.10.2"/>
|
||||
<StringItem index="2" value="1.9.4"/>
|
||||
<StringItem index="3" value="1.8.9"/>
|
||||
<StringItem index="4" value="1.7.10"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
@ -246,5 +249,7 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton7ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JProgressBar" name="jProgressBar1">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
@ -8,6 +8,7 @@ package forgemodpackbuilder;
|
|||
import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.DefaultListModel;
|
||||
|
@ -20,8 +21,8 @@ import javax.swing.JOptionPane;
|
|||
public class GUI extends javax.swing.JFrame {
|
||||
|
||||
static String datei = null;
|
||||
static String[] mods1 = new String[300];
|
||||
static String[] mods2 = new String[300];
|
||||
static ArrayList<String> mods0 = new ArrayList<String>();
|
||||
static ArrayList<String> mods1 = new ArrayList<String>();
|
||||
static String version = "1.10.2";
|
||||
|
||||
/**
|
||||
|
@ -56,6 +57,7 @@ public class GUI extends javax.swing.JFrame {
|
|||
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);
|
||||
setTitle("ForgeModpackBuilder");
|
||||
|
@ -109,7 +111,7 @@ public class GUI extends javax.swing.JFrame {
|
|||
}
|
||||
});
|
||||
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1.10.2", "1.9.4", "1.8.9", "1.7.10" }));
|
||||
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Modpacks", "1.10.2", "1.9.4", "1.8.9", "1.7.10" }));
|
||||
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jComboBox1ActionPerformed(evt);
|
||||
|
@ -151,6 +153,7 @@ 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)
|
||||
|
@ -162,8 +165,8 @@ public class GUI extends javax.swing.JFrame {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton2)
|
||||
|
@ -173,7 +176,7 @@ public class GUI extends javax.swing.JFrame {
|
|||
.addComponent(jButton8)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton1))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 537, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.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)
|
||||
|
@ -207,7 +210,8 @@ public class GUI extends javax.swing.JFrame {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane3))
|
||||
.addGap(26, 26, 26))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -228,24 +232,46 @@ 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:
|
||||
File dir = new File("./modpack/modpack");
|
||||
dir.mkdir();
|
||||
dir = new File("./modpack/modpack/mods");
|
||||
dir.mkdir();
|
||||
for (int i = 0; i < 200; i++) {
|
||||
mods1[i] = null;
|
||||
mods2[i] = null;
|
||||
//jProgressBar1.setValue(10);
|
||||
String s = (String) jComboBox1.getSelectedItem();
|
||||
System.out.println(s);
|
||||
version = s;
|
||||
try {
|
||||
if (!version.equals("Modpacks")) {
|
||||
File dir = new File("./modpack/" + version);
|
||||
dir.mkdir();
|
||||
dir = new File("./modpack/" + version + "/mods");
|
||||
dir.mkdir();
|
||||
}
|
||||
File dir = new File("./modpack/modpack");
|
||||
dir.mkdir();
|
||||
dir = new File("./modpack/modpack/mods");
|
||||
dir.mkdir();
|
||||
mods0.clear();
|
||||
mods1.clear();
|
||||
if (version.equals("Modpacks")) {
|
||||
ModpackSuche.main(null);
|
||||
} else {
|
||||
Suche.main(null);
|
||||
}
|
||||
Suche1.main(null);
|
||||
System.out.println("Tabelle 1 Mods = " + mods0.size());
|
||||
DefaultListModel dim = new DefaultListModel();
|
||||
DefaultListModel dim1 = new DefaultListModel();
|
||||
for (int i = 0; i < mods0.size(); i++) {
|
||||
dim.addElement(mods0.get(i));
|
||||
}
|
||||
System.out.println("Tabelle 2 Mods = " + mods1.size());
|
||||
for (int i = 0; i < mods1.size(); i++) {
|
||||
dim1.addElement(mods1.get(i));
|
||||
}
|
||||
jList1.setModel(dim);
|
||||
jList2.setModel(dim1);
|
||||
} catch (java.lang.NullPointerException ex) {
|
||||
System.out.println("VerbindungsFehler 404!!!");
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Fehler!!!");
|
||||
}
|
||||
Suche.main(mods1);
|
||||
Suche1.main(mods2);
|
||||
DefaultListModel dim = new DefaultListModel();
|
||||
DefaultListModel dim1 = new DefaultListModel();
|
||||
for (int i = 0; i < 200; i++) {
|
||||
dim.addElement(mods1[i]);
|
||||
dim1.addElement(mods2[i]);
|
||||
}
|
||||
jList1.setModel(dim);
|
||||
jList2.setModel(dim1);
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
|
||||
|
@ -278,13 +304,6 @@ public class GUI extends javax.swing.JFrame {
|
|||
|
||||
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
String s = (String) jComboBox1.getSelectedItem();
|
||||
System.out.println(s);
|
||||
version = s;
|
||||
File dir = new File("./modpack/" + version);
|
||||
dir.mkdir();
|
||||
dir = new File("./modpack/" + version + "/mods");
|
||||
dir.mkdir();
|
||||
jButton2ActionPerformed(evt);
|
||||
|
||||
}//GEN-LAST:event_jComboBox1ActionPerformed
|
||||
|
@ -292,19 +311,32 @@ public class GUI extends javax.swing.JFrame {
|
|||
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
try {
|
||||
JOptionPane.showMessageDialog(null, "Bitte geben sie den Pfad zu dem Modpack ein!");
|
||||
OeffnenDialogClass.main(null);
|
||||
OeffnenDialogClass a = new OeffnenDialogClass();
|
||||
System.out.println("GUI = " + datei);
|
||||
UnZip.modpack = datei;
|
||||
JOptionPane.showMessageDialog(null, "Bitte geben sie einen Installationsort für das Modpack!");
|
||||
OeffnenDialogClass.main(null);
|
||||
System.out.println("GUI = " + datei);
|
||||
UnZip.modpack1 = datei;
|
||||
UnZip.main();
|
||||
if (!version.equals("Modpacks")) {
|
||||
JOptionPane.showMessageDialog(null, "Bitte geben sie den Pfad zu dem Modpack ein!");
|
||||
OeffnenDialogClass.main(null);
|
||||
OeffnenDialogClass a = new OeffnenDialogClass();
|
||||
System.out.println("GUI = " + datei);
|
||||
UnZip.modpack = datei;
|
||||
JOptionPane.showMessageDialog(null, "Bitte geben sie einen Installationsort für das Modpack!");
|
||||
OeffnenDialogClass.main(null);
|
||||
System.out.println("GUI = " + datei);
|
||||
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;
|
||||
ModpackDownloader.main(null);
|
||||
}
|
||||
jButton4ActionPerformed(evt);
|
||||
} catch (java.lang.NullPointerException ex) {
|
||||
System.out.println("Keine Eingabe");
|
||||
System.out.println("Keine Eingabe!!!");
|
||||
}catch (IOException ex) {
|
||||
System.out.println("Fehler!!!");
|
||||
}
|
||||
//jButton3ActionPerformed(evt);
|
||||
}//GEN-LAST:event_jButton6ActionPerformed
|
||||
|
@ -336,7 +368,7 @@ public class GUI extends javax.swing.JFrame {
|
|||
// TODO add your handling code here:
|
||||
downloader.main(null);
|
||||
downloader1.main(null);
|
||||
VerzeichnisDurchsuchen3.main(null);
|
||||
Suche3.main(null);
|
||||
DateiKopierenClass1.main(null);
|
||||
DateiKopierenClass2.main(null);
|
||||
String file = "./modpack/modpack/" + GUI.datei.substring(GUI.datei.lastIndexOf("/") + 1);
|
||||
|
@ -415,6 +447,7 @@ public class GUI extends javax.swing.JFrame {
|
|||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JList<String> jList1;
|
||||
private javax.swing.JList<String> jList2;
|
||||
private javax.swing.JProgressBar jProgressBar1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane3;
|
||||
private javax.swing.JTextField jTextField1;
|
||||
|
|
102
src/forgemodpackbuilder/ModpackDownloader.java
Normal file
102
src/forgemodpackbuilder/ModpackDownloader.java
Normal file
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* 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<String> text = new ArrayList<String>();
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
44
src/forgemodpackbuilder/ModpackDownloader2.java
Normal file
44
src/forgemodpackbuilder/ModpackDownloader2.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
58
src/forgemodpackbuilder/ModpackSuche.java
Normal file
58
src/forgemodpackbuilder/ModpackSuche.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* 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.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author simonr
|
||||
*/
|
||||
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 URLConnection conn = url.openConnection();
|
||||
try (InputStream is = new BufferedInputStream(conn.getInputStream())) {
|
||||
final OutputStream os;
|
||||
os = new BufferedOutputStream(new FileOutputStream("./modpack/Modpacks/Modpacks.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();
|
||||
|
||||
// Datei durchsuchen
|
||||
FileReader fr = new FileReader("./modpack/Modpacks/Modpacks.txt");
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
String zeile;
|
||||
|
||||
while ((zeile = br.readLine()) != null) {
|
||||
GUI.mods0.add(zeile);
|
||||
}
|
||||
System.out.println("Zeilen = " + GUI.mods0.size());
|
||||
|
||||
for (int i = 0; i < GUI.mods0.size(); i++) {
|
||||
System.out.println(GUI.mods0.get(i));
|
||||
}
|
||||
br.close();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
32
src/forgemodpackbuilder/Modpacktxt.java
Normal file
32
src/forgemodpackbuilder/Modpacktxt.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author simonr
|
||||
*/
|
||||
public class Modpacktxt {
|
||||
|
||||
static String name;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
FileWriter fw = new FileWriter(name + ".txt");
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -28,8 +28,7 @@ public class Suche {
|
|||
if (fileThatYouWantToFilter.startsWith(name)
|
||||
&& fileThatYouWantToFilter.endsWith(".jar")) {
|
||||
System.out.println("found" + " " + fileThatYouWantToFilter);
|
||||
GUI.mods1[i] = "./modpack/" + GUI.version + "/mods/" + fileThatYouWantToFilter;
|
||||
i++;
|
||||
GUI.mods0.add("./modpack/" + GUI.version + "/mods/" + fileThatYouWantToFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ public class Suche1 {
|
|||
if (fileThatYouWantToFilter.startsWith(name)
|
||||
&& fileThatYouWantToFilter.endsWith(".jar")) {
|
||||
System.out.println("found" + " " + fileThatYouWantToFilter);
|
||||
GUI.mods2[i] = "./modpack/modpack/mods/" + fileThatYouWantToFilter;
|
||||
i++;
|
||||
GUI.mods1.add("./modpack/modpack/mods/" + fileThatYouWantToFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ package forgemodpackbuilder;
|
|||
*/
|
||||
import java.io.File;
|
||||
|
||||
public class VerzeichnisDurchsuchen2 {
|
||||
public class Suche2 {
|
||||
|
||||
static String filename;
|
||||
|
|
@ -11,7 +11,7 @@ package forgemodpackbuilder;
|
|||
*/
|
||||
import java.io.File;
|
||||
|
||||
public class VerzeichnisDurchsuchen3 {
|
||||
public class Suche3 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
@ -5,6 +5,10 @@
|
|||
*/
|
||||
package forgemodpackbuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author simonr
|
||||
|
@ -80,6 +84,12 @@ public class frage extends javax.swing.JFrame {
|
|||
Zip a = new Zip();
|
||||
a.modpack = name;
|
||||
a.archiveDir(null);
|
||||
Modpacktxt.name = name;
|
||||
try {
|
||||
Modpacktxt.main(null);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(frage.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
|
|
Loading…
Reference in a new issue