Exemple #1
0
 // saves the current configuration (breakpoints, window sizes and positions...)
 private void saveConfig() {
   try {
     ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(idxName + ".config"));
     Breakpoints.save(out);
     Properties.save(out);
     out.close();
   } catch (IOException exc) {
     consoleFrame.echoInfo("Could not save settings: " + exc);
   }
 }
Exemple #2
0
 public boolean write() {
   try {
     Properties configFile = new Properties();
     configFile.load(new FileInputStream(settingsFile));
     configFile.put("SMTP_Host", mSMTPHost);
     configFile.put("SMTP_Port", mSMTPPort);
     configFile.put("POP3_Host", mPOP3Host);
     configFile.put("POP3_Port", mPOP3Port);
     configFile.put("From", mFrom);
     configFile.put("Password", mPass);
     configFile.put("Name", mName);
     configFile.put("Mails_Location", mMailsLocation);
     configFile.put("Contacts_Location", mContactsLocation);
     // TODO : There are some wrong and deprecated usage of date formatting, fix it.
     configFile.put(
         "Last_Update",
         Integer.toString(mLastUpdate.getYear() + 1900)
             + "/"
             + Integer.toString(mLastUpdate.getMonth())
             + "/"
             + Integer.toString(mLastUpdate.getDay())
             + "-"
             + Integer.toString(mLastUpdate.getHours())
             + "-"
             + Integer.toString(mLastUpdate.getMinutes())
             + "-"
             + Integer.toString(mLastUpdate.getSeconds()));
     FileOutputStream out = new FileOutputStream(settingsFile);
     // TODO : There is a usage of ini save method that deprecated.
     configFile.save(out, "properties updated");
   } catch (Exception e) {
     System.out.println("Write Exception:" + e.getMessage());
     return false;
   }
   return true;
 }