Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.io.StringWriter;
- import java.net.URL;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- import javax.swing.JOptionPane;
- /*
- * 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.
- */
- /**
- *
- * @author clement
- */
- public class SelectorForm extends javax.swing.JFrame {
- private static StringWriter sw;
- private static BufferedWriter bw;
- private static FileWriter fw;
- private static FileReader fr;
- static String[] Read = new String[9];
- static String[] ReadNames = new String[9];
- static String CurrentAccount = "none";
- public static void main(String args[]) throws Exception
- {
- //Checks the files current Directory
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- System.out.println(location.getFile()+"Accounts.ini");
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- if(f.exists())
- {
- // read the file and load the accounts
- System.out.println("True");
- File file = new File(NewDir2+"Accounts.ini");
- fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- int i = 0;
- while(i<8)
- {
- i = i+1;
- Read[i] = br.readLine();
- System.out.println(Read[i]);
- }
- i = 0;
- while(i<8)
- {
- i = i+1;
- int indexpass = Read[i].indexOf("/");
- System.out.println(indexpass);
- ReadNames[i] = Read[i].substring(4, indexpass);
- }
- }
- else
- {
- System.out.println("False");
- // Create file and load defaults
- File file = new File(NewDir2+"Accounts.ini");
- file.createNewFile();
- fw = new FileWriter(file);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write("AC"+n+"=new/Pass");
- bw.newLine();
- n = n+1;
- }
- bw.close();
- }
- /* 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(SelectorForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(SelectorForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(SelectorForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(SelectorForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- @Override
- public void run() {
- new SelectorForm().setVisible(true);
- }
- });
- }
- /**
- * Creates new form SelectorForm
- */
- public SelectorForm() {
- 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">
- private void initComponents() {
- jButton4 = new javax.swing.JButton();
- jPanel1 = new javax.swing.JPanel();
- jButton10 = new javax.swing.JButton();
- jButton1 = new javax.swing.JButton();
- CurrentAcc = new javax.swing.JLabel();
- jButton2 = new javax.swing.JButton();
- jButton3 = new javax.swing.JButton();
- jButton5 = new javax.swing.JButton();
- jButton6 = new javax.swing.JButton();
- jButton7 = new javax.swing.JButton();
- jButton8 = new javax.swing.JButton();
- jButton9 = new javax.swing.JButton();
- jButton11 = new javax.swing.JButton();
- jLabel1 = new javax.swing.JLabel();
- jLabel2 = new javax.swing.JLabel();
- jButton4.setText("jButton3");
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 100, Short.MAX_VALUE)
- );
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 100, Short.MAX_VALUE)
- );
- jButton10.setText("jButton10");
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jButton1.setText("Play!");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- CurrentAcc.setText("Current Account:");
- jButton2.setText(ReadNames[1]);
- jButton2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton2ActionPerformed(evt);
- }
- });
- jButton3.setText(ReadNames[2]);
- jButton3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton3ActionPerformed(evt);
- }
- });
- jButton5.setText(ReadNames[3]);
- jButton5.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton5ActionPerformed(evt);
- }
- });
- jButton6.setText(ReadNames[4]);
- jButton6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton6ActionPerformed(evt);
- }
- });
- jButton7.setText(ReadNames[5]);
- jButton7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton7ActionPerformed(evt);
- }
- });
- jButton8.setText(ReadNames[6]);
- jButton8.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton8ActionPerformed(evt);
- }
- });
- jButton9.setText(ReadNames[7]);
- jButton9.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton9ActionPerformed(evt);
- }
- });
- jButton11.setText(ReadNames[8]);
- jButton11.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton11ActionPerformed(evt);
- }
- });
- jLabel1.setText("Archlord Account sellecter v1");
- jLabel2.setText("Clement Kirton");
- 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(CurrentAcc, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)
- .addComponent(jButton5, 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)
- .addComponent(jButton7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addGap(81, 81, 81)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel1)
- .addComponent(jLabel2))
- .addGap(0, 0, Short.MAX_VALUE)))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jButton2)
- .addGroup(layout.createSequentialGroup()
- .addGap(4, 4, 4)
- .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jButton3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGap(20, 20, 20)))
- .addComponent(jButton5)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton6)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton7)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton8)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton9)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jButton11)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(CurrentAcc, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(15, 15, 15)))
- .addContainerGap())
- );
- pack();
- }// </editor-fold>
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- try {
- Runtime runtime = Runtime.getRuntime();
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- Runtime.getRuntime().exec(NewDir2+"JUSTArchlord.exe");
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[1].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[1];
- Read[1] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[1];
- Read[1] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[1]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[1].indexOf("/");
- String Pass = Read[1].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- BufferedWriter bw2 = new BufferedWriter(fw);
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[1]);
- bw2.newLine();
- bw2.write("password="+Pass);
- bw2.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[5].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[5];
- Read[5] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[5];
- Read[5] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[5]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[5].indexOf("/");
- String Pass = Read[5].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[5]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[2].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[2];
- Read[2] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[2];
- Read[2] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[2]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[2].indexOf("/");
- String Pass = Read[2].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[2]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[3].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[3];
- Read[3] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[3];
- Read[3] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[3]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[3].indexOf("/");
- String Pass = Read[3].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[3]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[4].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[4];
- Read[4] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[4];
- Read[4] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[4]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[4].indexOf("/");
- String Pass = Read[4].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[4]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[6].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[6];
- Read[6] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[6];
- Read[6] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[6]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[6].indexOf("/");
- String Pass = Read[6].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[6]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[7].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[7];
- Read[7] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[7];
- Read[7] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[7]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[7].indexOf("/");
- String Pass = Read[7].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[7]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
- if(ReadNames[8].equals("new"))
- {
- try {
- String NewAccount = JOptionPane.showInputDialog("Please Enter your Account name");
- String NewPass = JOptionPane.showInputDialog("Please Enter your Account Password");
- String Temp = Read[8];
- Read[8] = Temp.replaceAll("new", NewAccount);
- String Temp2 = Read[8];
- Read[8] = Temp2.replaceAll("Pass", NewPass);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Accounts.ini");
- fw = new FileWriter(f);
- BufferedWriter bw = new BufferedWriter(fw);
- int n = 1;
- while(n<9)
- {
- bw.write(Read[n]);
- bw.newLine();
- n = n+1;
- }
- bw.close();
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- JOptionPane.showMessageDialog (null, "Please Restart the Program", "Restart", JOptionPane.WARNING_MESSAGE);
- }
- else
- {
- try {
- CurrentAcc.setText("Current Account: "+ReadNames[8]);
- URL location = SelectorForm.class.getProtectionDomain().getCodeSource().getLocation();
- int indexpass2 = Read[8].indexOf("/");
- String Pass = Read[8].substring(indexpass2+1);
- String Dir = location.getFile().toString();
- //Replaces the %20 with a " ".
- String NewDir = Dir.replaceAll("%20"," ");
- String NewDir2 = NewDir.replaceAll("Archlord_Selecter.jar","");
- //Checks if the file exists
- File f = new File(NewDir2+"Justaccount.ini");
- f.createNewFile();
- fw = new FileWriter(f);
- try (BufferedWriter bw2 = new BufferedWriter(fw)) {
- bw2.write("[INFO]");
- bw2.newLine();
- bw2.write("account="+ReadNames[8]);
- bw2.newLine();
- bw2.write("password="+Pass);
- }
- } catch (IOException ex) {
- Logger.getLogger(SelectorForm.class.getName()).log(Level.SEVERE, null, ex);
- }
- } // TODO add your handling code here:
- }
- /**
- * @param args the command line arguments
- */
- /**
- *
- * @param args the command line arguments
- * @throws java.lang.Exception
- */
- // Variables declaration - do not modify
- private javax.swing.JLabel CurrentAcc;
- private javax.swing.JButton jButton1;
- private javax.swing.JButton jButton10;
- private javax.swing.JButton jButton11;
- private javax.swing.JButton jButton2;
- private javax.swing.JButton jButton3;
- 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.JButton jButton9;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JPanel jPanel1;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement