Standardserver hinzugefügt + optimierungen und Fehlerbehebungen

This commit is contained in:
simonr 2016-10-26 16:28:51 +02:00
parent 8ef4dd7852
commit a73961ea28
9 changed files with 209 additions and 55 deletions

View file

@ -5,7 +5,6 @@
*/ */
package ModpackDownloader; package ModpackDownloader;
import ModpackDownloader.ModpackDownloader2;
import forgemodpackbuilder.GUI; import forgemodpackbuilder.GUI;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
@ -20,12 +19,12 @@ public class ModpackDownloader {
static int mods = 0; static int mods = 0;
public static String zeile = ""; public static String zeile = "";
private static String version; public static String version;
public static void main(String[] args) throws MalformedURLException, IOException { public static void main(String[] args) throws MalformedURLException, IOException {
//Modpack URL Suchen //Modpack URL Suchen
ModpackDownloader2.URL = "http://localhost/" + zeile; ModpackDownloader2.URL = GUI.URL + zeile;
ModpackDownloader2.output = "./modpack/modpack.txt"; ModpackDownloader2.output = "./modpack/modpack.txt";
ModpackDownloader2.main(null); ModpackDownloader2.main(null);
@ -45,9 +44,12 @@ public class ModpackDownloader {
version = br1.readLine(); version = br1.readLine();
while ((zeile = br1.readLine()) != null) { while ((zeile = br1.readLine()) != null) {
ModpackDownloader2.URL = "http://localhost/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("Output = " + GUI.datei + "/mods/" + zeile);
//Progressbar //Progressbar
GUI.zahl = mods; GUI.zahl = mods;

View file

@ -25,7 +25,7 @@ public class ModpackSuche {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
final URL url = new URL("http://localhost/modpacks.txt"); final URL url = new URL(GUI.URL + "/modpacks.txt");
final URLConnection conn = url.openConnection(); final URLConnection conn = url.openConnection();
try (InputStream is = new BufferedInputStream(conn.getInputStream())) { try (InputStream is = new BufferedInputStream(conn.getInputStream())) {
final OutputStream os; final OutputStream os;

View file

@ -8,10 +8,7 @@ package ModpackDownloader;
import forgemodpackbuilder.GUI; import forgemodpackbuilder.GUI;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.BufferedReader;
;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.URL; import java.net.URL;
@ -48,21 +45,17 @@ public class downloader1 {
version = forge7; version = forge7;
} }
if (GUI.version.equals("Modpacks")) { 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")) { if (ModpackDownloader.version.equals("1.10.2")) {
version = forge10; version = forge10;
} }
if (total.equals("1.9.4")) { if (ModpackDownloader.version.equals("1.9.4")) {
version = forge9; version = forge9;
} }
if (total.equals("1.8.9")) { if (ModpackDownloader.version.equals("1.8.9")) {
version = forge8; version = forge8;
} }
if (total.equals("1.7.10")) { if (ModpackDownloader.version.equals("1.7.10")) {
version = forge7; version = forge7;
} }
} }

View file

@ -20,10 +20,11 @@ public class Modpacktxt {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
FileWriter fw = new FileWriter(name + ".txt"); FileWriter fw = new FileWriter(name);
BufferedWriter bw = new BufferedWriter(fw); BufferedWriter bw = new BufferedWriter(fw);
bw.write(GUI.version); bw.write(GUI.version);
bw.newLine();
for (int i = 0; i < GUI.mods1.size(); i++) { for (int i = 0; i < GUI.mods1.size(); i++) {
bw.write(GUI.mods1.get(i).substring( GUI.mods1.get(i).lastIndexOf( "/" ) + 1 )); bw.write(GUI.mods1.get(i).substring( GUI.mods1.get(i).lastIndexOf( "/" ) + 1 ));
bw.newLine(); bw.newLine();

View file

@ -95,40 +95,6 @@ public class frage extends javax.swing.JFrame {
this.dispose(); this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed }//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* 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(frage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new frage().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1; private javax.swing.JButton jButton1;

View file

@ -34,7 +34,9 @@
<Component id="jComboBox1" min="-2" max="-2" attributes="0"/> <Component id="jComboBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="58" max="-2" attributes="0"/> <EmptySpace min="-2" pref="58" max="-2" attributes="0"/>
<Component id="jButton6" max="32767" attributes="0"/> <Component id="jButton6" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="158" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton7" min="-2" pref="146" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton5" min="-2" pref="177" max="-2" attributes="0"/> <Component id="jButton5" min="-2" pref="177" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
@ -76,6 +78,7 @@
<Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jComboBox1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton6" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton5" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jButton5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton7" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -240,5 +243,13 @@
</Component> </Component>
<Component class="javax.swing.JProgressBar" name="jProgressBar1"> <Component class="javax.swing.JProgressBar" name="jProgressBar1">
</Component> </Component>
<Component class="javax.swing.JButton" name="jButton7">
<Properties>
<Property name="text" type="java.lang.String" value="Server-URL"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton7ActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View file

@ -37,6 +37,7 @@ public class GUI extends javax.swing.JFrame {
public static String version = "1.10.2"; public static String version = "1.10.2";
public static String datei2 = null; public static String datei2 = null;
public static int funktion = 0; public static int funktion = 0;
public static String URL = "http://mgwywbvcwmot7vir.myfritz.net/";
/** /**
* Creates new form GUI * Creates new form GUI
@ -70,6 +71,7 @@ public class GUI extends javax.swing.JFrame {
jButton8 = new javax.swing.JButton(); jButton8 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField(); jTextField1 = new javax.swing.JTextField();
jProgressBar1 = new javax.swing.JProgressBar(); jProgressBar1 = new javax.swing.JProgressBar();
jButton7 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("ForgeModpackBuilder"); setTitle("ForgeModpackBuilder");
@ -151,6 +153,13 @@ public class GUI extends javax.swing.JFrame {
} }
}); });
jButton7.setText("Server-URL");
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()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -165,7 +174,9 @@ public class GUI extends javax.swing.JFrame {
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(58, 58, 58) .addGap(58, 58, 58)
.addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(158, 158, 158) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
@ -197,7 +208,8 @@ public class GUI extends javax.swing.JFrame {
.addComponent(jLabel1) .addComponent(jLabel1)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton6) .addComponent(jButton6)
.addComponent(jButton5)) .addComponent(jButton5)
.addComponent(jButton7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING)
@ -304,7 +316,7 @@ public class GUI extends javax.swing.JFrame {
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
try { try {
frage.main(null); new frage().setVisible(true);
} catch (Throwable ex) { } catch (Throwable ex) {
Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(GUI.class.getName()).log(Level.SEVERE, null, ex);
} }
@ -379,6 +391,12 @@ public class GUI extends javax.swing.JFrame {
} }
}//GEN-LAST:event_jList1KeyPressed }//GEN-LAST:event_jList1KeyPressed
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
// TODO add your handling code here:
new Server().setVisible(true);
System.out.println(URL);
}//GEN-LAST:event_jButton7ActionPerformed
public void progressnext() { public void progressnext() {
jProgressBar1.setMaximum(zahl); jProgressBar1.setMaximum(zahl);
@ -395,6 +413,7 @@ public class GUI extends javax.swing.JFrame {
private javax.swing.JButton jButton4; private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5; private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6; private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8; private javax.swing.JButton jButton8;
private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="189" max="32767" attributes="0"/>
</Group>
<Component id="jTextField1" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextField1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Wie ist die neue Server-URL"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Best&#xe4;tigen"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -0,0 +1,88 @@
/*
* 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;
/**
*
* @author simonr
*/
public class Server extends javax.swing.JFrame {
/**
* Creates new form URL
*/
public Server() {
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")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setText("Wie ist die neue Server-URL");
jButton1.setText("Bestätigen");
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 189, Short.MAX_VALUE))
.addComponent(jTextField1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
GUI.URL = jTextField1.getText();
this.dispose();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField jTextField1;
// End of variables declaration//GEN-END:variables
}