Package org.ini4j

Examples of org.ini4j.Wini


      if (ModManager.logging){
        ModManager.debugLogger.writeMessage("Mod Desc file is null, unable to read description");
      }
      return;
    }
    Wini modini = null;
    try {
      modini = new Wini(modDescFile);
      modDesc = modini.get("ModInfo", "moddesc");
      modDesc = breakFixer(modDesc);
    } catch (InvalidFileFormatException e) {
      e.printStackTrace();
      if (ModManager.logging){
        ModManager.debugLogger.writeMessage("Invalid File Format exception on moddesc.");
      }
      return;
    } catch (IOException e) {
      if (ModManager.logging){
        ModManager.debugLogger.writeMessage("I/O Error reading mod file. It may not exist or it might be corrupt.");
      }
      return;
    }
    modDesc = breakFixer(modDesc);

    // Add 1st newline
    modDesc += "\n";

    // Add modversion
    if (modini.get("ModInfo", "modver") != null) {
      modDesc += "\nMod Version: " + modini.get("ModInfo", "modver");
    }
    // Add mod manager build version
    if (markedLegacy) {
      modDesc += "\nLegacy Mod";
    }

    // Add modifier
    modDesc += getModifyString();

    // Add MP Changer
    if (modini.get("ModInfo", "modmp") != null) {
      modDesc += "\nModifies Multiplayer: " + modini.get("ModInfo", "modmp");
    }
    // Add developer
    if (modini.get("ModInfo", "moddev") != null) {
      modDesc += "\nMod Developer: " + modini.get("ModInfo", "moddev");
    }
    // Add Devsite
    if (modini.get("ModInfo", "modsite") != null) {
      modDesc += "\nMod Site: " + modini.get("ModInfo", "modsite");
    }
  }
View Full Code Here


    this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resource/icon32.png")));
    this.pack();
    this.setLocationRelativeTo(callingWindow);
    //Set the backup flag to true
    Wini ini;
    try {
      File settings = new File("me3mcc.ini");
      if (!settings.exists())
        settings.createNewFile();
      ini = new Wini(settings);
      ini.put("Settings", "dlc_backup_flag", "1");
      ini.store();
    } catch (InvalidFileFormatException e) {
      e.printStackTrace();
    } catch (IOException e) {
      System.err.println("Settings file encountered an I/O error while attempting to write it. Settings not saved.");
    }
View Full Code Here

      String YesNo[] = { "Yes", "No" };
      int saveDir = JOptionPane
          .showOptionDialog(null, "BioGame directory set to: " + dirChooser.getSelectedFile().toString()
              + "\nSave this path for next time?", "Save directory path?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, YesNo, YesNo[0]);
      if (saveDir == 0) {
        Wini ini;
        try {
          File settings = new File("me3mcc.ini");
          if (!settings.exists())
            settings.createNewFile();
          ini = new Wini(settings);
          ini.put("Settings", "biogame_dir", appendSlash(dirChooser.getSelectedFile().toString()));
          if (ModManager.logging) {
            ModManager.debugLogger.writeMessage(appendSlash(dirChooser.getSelectedFile().toString()));
          }
          ini.store();
        } catch (InvalidFileFormatException e) {
          e.printStackTrace();
        } catch (IOException e) {
          System.err.println("Settings file encountered an I/O error while attempting to write it. Settings not saved.");
        }
View Full Code Here

      return false;
    }
  }

  private String getLocationText(JTextField locationSet) {
    Wini settingsini;
    String setDir = "C:\\Program Files (x86)\\Origin Games\\Mass Effect 3\\BioGame\\";
    try {
      settingsini = new Wini(new File("me3mcc.ini"));
      setDir = settingsini.get("Settings", "biogame_dir");
      if (setDir == null || setDir.equals("")) {
        setDir = "C:\\Program Files (x86)\\Origin Games\\Mass Effect 3\\BioGame\\";
      }
    } catch (InvalidFileFormatException e) {
      e.printStackTrace();
View Full Code Here

    }
    return true;
  }

  private boolean checkBackedUp() {
    Wini ini;
    boolean answer = true;
    try {
      File settings = new File("me3mcc.ini");
      if (!settings.exists())
        settings.createNewFile();
      ini = new Wini(settings);
      String backupFlag = ini.get("Settings", "dlc_backup_flag");
      if (backupFlag == null || !backupFlag.equals("1")) {
        // backup flag not set, lets ask user
        if (ModManager.logging) {
          ModManager.debugLogger.writeMessage("Did not read the backup flag from settings or flag was not set to 1");
        }
        String YesNo[] = { "Yes", "No" }; // Yes/no buttons
        int showDLCBackup = JOptionPane
            .showOptionDialog(null, "This instance of Mod Manager hasn't backed up your DLC's yet;\nIf you have previously backed up using Mod Manager, you can ignore this message.\n\nBefore you install mods you should back them up in the event that you lose them.\n\nNote: This dialog will only be displayed once.\n\nOpen the backup manager window?", "Backup DLC before mod installation?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, YesNo, YesNo[0]);
        // System.out.println("User chose: "+showDLCBackup);
        if (showDLCBackup == 0) {
          backupDLC(fieldBiogameDir.getText());
        }
      }
      // shown only once. Backup complete, set to settings file
      ini.put("Settings", "dlc_backup_flag", "1");
      ini.store();
    } catch (InvalidFileFormatException e) {
      e.printStackTrace();
    } catch (IOException e) {
      System.err.println("Settings file encountered an I/O error while attempting to write it. Settings not saved.");
    }
View Full Code Here

    loggingMode = new JCheckBox("Mod debugging mode");
    loggingMode.setSelected(ModManager.logging);
    loggingMode.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Wini ini;
        try {
          File settings = new File("me3mcc.ini");
          if (!settings.exists())
            settings.createNewFile();
          ini = new Wini(settings);

          if (loggingMode.isSelected()) {
            ini.put("Settings", "logging_mode", "1");
            JOptionPane.showMessageDialog(null, "A log file will be generated in the ME3CMM.exe directory with the filename 'me3cmm_last_run_log.txt'.\nUse this to debug your moddesc files.\nClose ME3CMM before opening your log file.\nYou must restart Mod Manager for logging to take effect.\nNote: Logs will continue to be made every time the program is run.", "Logging Mode", JOptionPane.INFORMATION_MESSAGE);
          } else {
            ini.put("Settings", "logging_mode", "0");
            ModManager.logging = false;
          }
          ini.store();
        } catch (InvalidFileFormatException error) {
          error.printStackTrace();
        } catch (IOException error) {
          if (ModManager.logging){
            ModManager.debugLogger.writeMessage("Settings file encountered an I/O error while attempting to write it. Settings not saved.");
View Full Code Here

  public static DebugLogger debugLogger;
  public static boolean logging = false;
 
  public static void main(String[] args) {
    //Set and get debugging mode from wini
    Wini settingsini;
    try {
      settingsini = new Wini(new File("me3mcc.ini"));
      String logStr  = settingsini.get("Settings", "logging_mode");
      int logInt = 0;
      if (logStr!= null && !logStr.equals("")) {
        try {
          logInt = Integer.parseInt(logStr);
          if (logInt>0){
View Full Code Here

   * is called by {@link FilePreference#setValue(Object)} and it is thus not necessary to call this
   * method separately unless you wish to perform a forced write of the cache to disk.
   */
  public void write() {
    try {
      Wini ini = new Wini(preferenceFile);

      for (OperaPreference p : this) {
        ini.put(p.getSection(), p.getKey(), ((AbstractPreference) p).getValue(true));
      }

      ini.store(preferenceFile);
    } catch (IOException e) {
      throw new WebDriverException("Unable to write to preference file: " + e.getMessage());
    }
  }
View Full Code Here

        return new StdCouchDbInstance(httpClient);
    }


    protected int getEmbeddedCouchPort(String localIniFile) throws IOException {
        Wini ini = new Wini(new File(localIniFile));
        int port = ini.get("httpd", "port", int.class);
        return port;
    }
View Full Code Here

        int port = ini.get("httpd", "port", int.class);
        return port;
    }

    protected void setEmbeddedCouchPort(String localIniFile, int port) throws IOException {
        Wini ini = new Wini(new File(localIniFile));
        ini.put("httpd", "port", port);
        // side effects!!! need to ensure bind address is 127.0.0.1, add lucene
        ini.put("httpd", "bind_address", "127.0.0.1");
        ini.put("httpd_global_handlers", "_fti", "{couch_httpd_proxy, handle_proxy_req, <<\"http://127.0.0.1:5985\">>}");



        ini.store();
    }
View Full Code Here

TOP

Related Classes of org.ini4j.Wini

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.