From a73961ea2871d8b9a1d1edbbdd9d76ce1fc0afef Mon Sep 17 00:00:00 2001 From: simonr Date: Wed, 26 Oct 2016 16:28:51 +0200 Subject: [PATCH] =?UTF-8?q?Standardserver=20hinzugef=C3=BCgt=20+=20optimie?= =?UTF-8?q?rungen=20und=20Fehlerbehebungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ModpackDownloader/ModpackDownloader.java | 10 ++- src/ModpackDownloader/ModpackSuche.java | 2 +- src/ModpackDownloader/downloader1.java | 15 +--- src/Zipper/Modpacktxt.java | 3 +- src/Zipper/frage.java | 34 -------- src/forgemodpackbuilder/GUI.form | 13 ++- src/forgemodpackbuilder/GUI.java | 25 +++++- src/forgemodpackbuilder/Server.form | 74 ++++++++++++++++ src/forgemodpackbuilder/Server.java | 88 ++++++++++++++++++++ 9 files changed, 209 insertions(+), 55 deletions(-) create mode 100644 src/forgemodpackbuilder/Server.form create mode 100644 src/forgemodpackbuilder/Server.java diff --git a/src/ModpackDownloader/ModpackDownloader.java b/src/ModpackDownloader/ModpackDownloader.java index bf6bda8..2d8f183 100644 --- a/src/ModpackDownloader/ModpackDownloader.java +++ b/src/ModpackDownloader/ModpackDownloader.java @@ -5,7 +5,6 @@ */ package ModpackDownloader; -import ModpackDownloader.ModpackDownloader2; import forgemodpackbuilder.GUI; import java.io.BufferedReader; import java.io.FileReader; @@ -20,12 +19,12 @@ public class ModpackDownloader { static int mods = 0; public static String zeile = ""; - private static String version; + public static String version; public static void main(String[] args) throws MalformedURLException, IOException { //Modpack URL Suchen - ModpackDownloader2.URL = "http://localhost/" + zeile; + ModpackDownloader2.URL = GUI.URL + zeile; ModpackDownloader2.output = "./modpack/modpack.txt"; ModpackDownloader2.main(null); @@ -45,9 +44,12 @@ public class ModpackDownloader { version = br1.readLine(); 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.main(null); + + System.out.println("URL = " + GUI.URL + version + "/" + zeile); + System.out.println("Output = " + GUI.datei + "/mods/" + zeile); //Progressbar GUI.zahl = mods; diff --git a/src/ModpackDownloader/ModpackSuche.java b/src/ModpackDownloader/ModpackSuche.java index 522b4f8..993b345 100644 --- a/src/ModpackDownloader/ModpackSuche.java +++ b/src/ModpackDownloader/ModpackSuche.java @@ -25,7 +25,7 @@ public class ModpackSuche { 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(); try (InputStream is = new BufferedInputStream(conn.getInputStream())) { final OutputStream os; diff --git a/src/ModpackDownloader/downloader1.java b/src/ModpackDownloader/downloader1.java index 4f6117d..e8ab5ce 100644 --- a/src/ModpackDownloader/downloader1.java +++ b/src/ModpackDownloader/downloader1.java @@ -8,10 +8,7 @@ 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; @@ -48,21 +45,17 @@ public class downloader1 { version = forge7; } 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; } - if (total.equals("1.9.4")) { + if (ModpackDownloader.version.equals("1.9.4")) { version = forge9; } - if (total.equals("1.8.9")) { + if (ModpackDownloader.version.equals("1.8.9")) { version = forge8; } - if (total.equals("1.7.10")) { + if (ModpackDownloader.version.equals("1.7.10")) { version = forge7; } } diff --git a/src/Zipper/Modpacktxt.java b/src/Zipper/Modpacktxt.java index 2f05e24..ffafbfd 100644 --- a/src/Zipper/Modpacktxt.java +++ b/src/Zipper/Modpacktxt.java @@ -20,10 +20,11 @@ public class Modpacktxt { public static void main(String[] args) throws IOException { - FileWriter fw = new FileWriter(name + ".txt"); + FileWriter fw = new FileWriter(name); 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(); diff --git a/src/Zipper/frage.java b/src/Zipper/frage.java index 17b2a3b..af9fc47 100644 --- a/src/Zipper/frage.java +++ b/src/Zipper/frage.java @@ -95,40 +95,6 @@ public class frage extends javax.swing.JFrame { this.dispose(); }//GEN-LAST:event_jButton1ActionPerformed - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* 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); - } - // - - /* 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 private javax.swing.JButton jButton1; diff --git a/src/forgemodpackbuilder/GUI.form b/src/forgemodpackbuilder/GUI.form index 192b99f..96d9b81 100644 --- a/src/forgemodpackbuilder/GUI.form +++ b/src/forgemodpackbuilder/GUI.form @@ -34,7 +34,9 @@ - + + + @@ -76,6 +78,7 @@ + @@ -240,5 +243,13 @@ + + + + + + + + diff --git a/src/forgemodpackbuilder/GUI.java b/src/forgemodpackbuilder/GUI.java index d60ff67..bb11d0d 100644 --- a/src/forgemodpackbuilder/GUI.java +++ b/src/forgemodpackbuilder/GUI.java @@ -37,6 +37,7 @@ public class GUI extends javax.swing.JFrame { public static String version = "1.10.2"; public static String datei2 = null; public static int funktion = 0; + public static String URL = "http://mgwywbvcwmot7vir.myfritz.net/"; /** * Creates new form GUI @@ -70,6 +71,7 @@ public class GUI extends javax.swing.JFrame { 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); 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()); getContentPane().setLayout(layout); 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) .addGap(58, 58, 58) .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)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) @@ -197,7 +208,8 @@ public class GUI extends javax.swing.JFrame { .addComponent(jLabel1) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton6) - .addComponent(jButton5)) + .addComponent(jButton5) + .addComponent(jButton7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .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 try { - frage.main(null); + new frage().setVisible(true); } catch (Throwable 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 + 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() { jProgressBar1.setMaximum(zahl); @@ -395,6 +413,7 @@ public class GUI extends javax.swing.JFrame { private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; + private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JComboBox jComboBox1; private javax.swing.JLabel jLabel1; diff --git a/src/forgemodpackbuilder/Server.form b/src/forgemodpackbuilder/Server.form new file mode 100644 index 0000000..f8b4954 --- /dev/null +++ b/src/forgemodpackbuilder/Server.form @@ -0,0 +1,74 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/forgemodpackbuilder/Server.java b/src/forgemodpackbuilder/Server.java new file mode 100644 index 0000000..f626a36 --- /dev/null +++ b/src/forgemodpackbuilder/Server.java @@ -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") + // //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(); + }// //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 +}