Package org.ini4j

Examples of org.ini4j.Ini


  doState(subKA.exitValue);
  subKA = null;
    }

    private void _loadActions(String fname) throws IOException {
  Ini    inir = new Ini(new File(fname));
  String    tmp  = "";
  Vector<String>  tvec = null;

  for(String key : inir.get(name).keySet()){
      tmp  = inir.get(name).get(key);
      tvec = new Vector<String>();
     
      for(String arrItem : tmp.split(",")){
    tvec.add(arrItem);
      }
View Full Code Here


      m_speciesData.loadSpeciesDatabase(new File("./res/dpspecies.db"));
    } catch (Exception e1) {
      e1.printStackTrace();
      return;
    }
    Ini ini = null;
    /* Load updated POLR db */
    try {
      ini = new Ini(new FileInputStream("./res/pokemon.ini"));
    } catch (Exception e) {
      e.printStackTrace();
      return;
    }
    for (int i = 0; i < 493; i++) {
      Ini.Section s = ini.get(String.valueOf(i+1));
            PokemonSpecies species = null;
            String name = s.get("InternalName");
            if(name.equalsIgnoreCase("NIDORANfE")) {
              name = "Nidoran-f";
              species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
            } else if(name.equalsIgnoreCase("NIDORANmA")) {
              name = "Nidoran-m";
              species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
            } else if(name.equalsIgnoreCase("DEOXYS")) {
              species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
                species = m_speciesData.getPokemonByName("Deoxys-f");
                initialisePokemon(species, s);
                species = m_speciesData.getPokemonByName("Deoxys-l");
                initialisePokemon(species, s);
                species = m_speciesData.getPokemonByName("Deoxys-e");
                initialisePokemon(species, s);
            } else if(name.equalsIgnoreCase("WORMADAM")) {
              species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
                species = m_speciesData.getPokemonByName("Wormadam-g");
                initialisePokemon(species, s);
                species = m_speciesData.getPokemonByName("Wormadam-s");
                initialisePokemon(species, s);
            } else if(name.equalsIgnoreCase("Porygonz")) {
              name = "Porygonz";
              species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
            } else {
              name = s.get("Name");
                species = m_speciesData.getPokemonByName(name);
                initialisePokemon(species, s);
            }
    }
    /* Load TM info */
    try {
      ini = new Ini(new FileInputStream("./res/tms.ini"));
    } catch (Exception e) {
      e.printStackTrace();
      return;
    }
    Iterator<String> iterator = ini.keySet().iterator();
    while(iterator.hasNext()) {
      String tm = (String) iterator.next();
      Ini.Section s = ini.get(tm);
      String [] pokemons = s.get("POKEMON").split(",");
      for(int i = 0; i < pokemons.length; i++) {
        PokemonSpecies species = m_speciesData.getPokemonByName(pokemons[i]);
        if(species != null) {
          for(int j = 0; j < species.getTMMoves().length; j++) {
View Full Code Here

                try {
                  // load it
                  f = new FileReader(RGSSProjectHelper.getGameIniFile(project));

                  // build game ini
                  Ini ini = new Ini();

                  ini.load();

                  Ini.Section section = ini.get("Game");

                  // add it
                  section.add("Title", ftf.getContentAsString());
                  section.add("RTP1", ftf.getContentAsString());
                  section.add("RTP2", ftf.getContentAsString());
                  section.add("RTP3", ftf.getContentAsString());

                  // save
                  ini.store(RGSSProjectHelper.getGameIniFile(project));

                } catch (Throwable t) {
                  YEx.info("Can not save " + RGSSProjectHelper.getGameIniFile(project), t);
                } finally {
                  if (f != null) {
View Full Code Here

  public List<Map<String, String>> parseConfigWithContent(String configUnparsed, String contentUnparsed, String macroid, Long pageid, Map<String, Object>  context, Boolean enableddl) throws InvalidFileFormatException, IOException {
        List<Map<String, String>> result = new ArrayList<Map<String, String>>();
       
       
   
        Ini ini = new Ini();
       
        StringReader input = new StringReader(configUnparsed);     
        ini.load(input);
       
    Set<String> sections = ini.keySet();
    for (String sectionName : sections) {
      StringBuilder strbuilder = new StringBuilder();
      Map<String, String> params = new HashMap<String, String>();     
      Section currentsection = ini.get(sectionName);
      Set<Entry<String,String>> entrySet = currentsection.entrySet();
      String currentContent = contentUnparsed;
      for (Entry<String,String> entry : entrySet) {
        currentContent = currentContent.replace("${"+entry.getKey()+"}", entry.getValue());
      }
View Full Code Here

   
   
    /*
     * Create collections to hold our settings, frameworks and webapps for later processing
     */
    Ini ini = new Ini();
    ini.load(new FileReader(configFile));
   
    /*
     * Get info about our webroot and sencha cmd paths
     */
    Ini.Section settingsSection = ini.get(Environment.SETTINGS);
    String webrootPath = settingsSection.get(Environment.WEBROOT_PATH);
    String cmdPath = settingsSection.get(Environment.SENCHA_CMD_PATH);

    /*
     * Get our list of webapps
     */
    List<String> webappPaths = new ArrayList<String>();
    Map<String, String> webappPathMap = ini.get(Environment.WEBAPPS);
    if (webappPathMap != null)
      for (String key : webappPathMap.keySet())
        webappPaths.add(webappPathMap.get(key));
   
    /*
 
View Full Code Here

  public void saveEnvironment() throws IOException {
    Environment e = this.env;
   
    File configFile = new File(configPath);
    if (!configFile.exists()) configFile.createNewFile();
    Ini ini = new Ini();
    ini.load(new FileReader(configFile));
   
    Ini.Section settingsSection = ini.get(Environment.SETTINGS);
    if (settingsSection == null) settingsSection = ini.add(Environment.SETTINGS);
    settingsSection.put(Environment.WEBROOT_PATH, e.getWebrootPath());
    settingsSection.put(Environment.SENCHA_CMD_PATH, e.getCmdPath());
   
    Ini.Section weblibSection = ini.get(Environment.WEBAPPS);
    if (weblibSection == null) weblibSection = ini.add(Environment.WEBAPPS);
    weblibSection.clear();
    Map<String,Webapp> webapps = e.getWebapps();
    for (String key : webapps.keySet()) {
      Webapp webapp = webapps.get(key);
      String webappPath = webapp.getFullPath();
      if (webappPath.endsWith("/")) webappPath = webappPath.substring(0, webappPath.length()-1);
      weblibSection.put(webapp.getName().replace(" ", ".").toLowerCase(), webappPath);
    }
   
    ini.store(configFile);
  }
View Full Code Here

    webapp.setFullPath(fullPath);
   
    /*
     * Create collections to hold our settings, frameworks and webapps for later processing
     */
    Ini ini = new Ini();
    File appSettings = new File(fullPath + "/src/main/webapp/adaptrex/app.config");
    if (!appSettings.exists()) return null;
    ini.load(new FileReader(appSettings));
   
    /*
     * Get our app name
     */
    Ini.Section settingsSection = ini.get(SETTINGS);
    webapp.setName(settingsSection.get("name"));
    webapp.setBasePackage(settingsSection.get(BASE_PACKAGE));
    webapp.setGlobalFolder(settingsSection.get(GLOBAL_FOLDER));
    webapp.setGlobalNamespace(settingsSection.get(GLOBAL_NAMESPACE));
   
   
    /*
     * Get information about our webapp's frameworks
     */
    Ini.Section frameworkSection = ini.get(FRAMEWORKS);
    if (frameworkSection.containsKey(ADAPTREXJS))
      webapp.setAdaptrex(env.getAdaptrexFrameworks().get(frameworkSection.get(ADAPTREXJS)));
    if (frameworkSection.containsKey(EXTJS))
      webapp.setExt(env.getExtFrameworks().get(frameworkSection.get(EXTJS)));
    if (frameworkSection.containsKey(SENCHA_TOUCH))
      webapp.setSenchaTouch(env.getSenchaTouchFrameworks().get(frameworkSection.get(SENCHA_TOUCH)));
    if (frameworkSection.containsKey(ORM))
      webapp.setOrm(frameworkSection.get(ORM));
    if (frameworkSection.containsKey(PRESENTATION))
      webapp.setPresentation(frameworkSection.get(PRESENTATION));
    if (frameworkSection.containsKey(DI))
      webapp.setDi(frameworkSection.get(DI));
     
   
    /*
     * Get our list of pages
     */
    Map<String,String> pagesSection = ini.get(PAGES);
    Map<String,Page> pages = webapp.getPages();
    if (pagesSection != null) {
      for (String key : pagesSection.keySet()) {
        String[] valueParts = pagesSection.get(key).split(",");
        String path = key.replace(".", "/");
View Full Code Here

    if (!configFile.exists()) {
      File adaptrexFolder = new File(webapp.getFullPath() + "/src/main/webapp/adaptrex");
      adaptrexFolder.mkdirs();
      configFile.createNewFile();
    }
    Ini ini = new Ini();
    ini.load(new FileReader(configFile));
   
    Ini.Section settingsSection = ini.get(SETTINGS);
    if (settingsSection == null) settingsSection = ini.add(SETTINGS);   
    settingsSection.put(NAME, webapp.getName());
    settingsSection.put(BASE_PACKAGE, webapp.getBasePackage());
    settingsSection.put(GLOBAL_NAMESPACE, webapp.getGlobalNamespace());
    settingsSection.put(GLOBAL_FOLDER, webapp.getGlobalFolder());
   
    Ini.Section frameworksSection = ini.get(FRAMEWORKS);
    if (frameworksSection == null) frameworksSection = ini.add(FRAMEWORKS);
   
    if (webapp.getAdaptrex() != null)
      frameworksSection.put(ADAPTREXJS, webapp.getAdaptrex().getFolderName());
    if (webapp.getExt() != null)
      frameworksSection.put(EXTJS, webapp.getExt().getFolderName());
    if (webapp.getSenchaTouch() != null)
      frameworksSection.put(SENCHA_TOUCH, webapp.getSenchaTouch().getFolderName());
    if (webapp.getOrm() != null)
      frameworksSection.put(ORM, webapp.getOrm());
    if (webapp.getPresentation() != null)
      frameworksSection.put(PRESENTATION, webapp.getPresentation());
    if (webapp.getDi() != null)
      frameworksSection.put(DI, webapp.getDi());
   
    Ini.Section pagesSection = ini.get(PAGES);
    if (pagesSection == null) pagesSection = ini.add(PAGES);
    pagesSection.clear();
    Map<String,Page> pages = webapp.getPages();
    for (String key : pages.keySet()) {
      Page page = pages.get(key);
      pagesSection.put(key, page.getNamespace() + "," + page.getFrameworkType());
    }
   
    ini.store(configFile);
  }
View Full Code Here

      }

      return;
    }

    Ini ini = getIniForPreferenceFile(preferenceFile);

    // Add each preference entry
    for (Map.Entry<String, Profile.Section> section : ini.entrySet()) {
      for (Map.Entry<String, String> entry : section.getValue().entrySet()) {
        set(section.getValue().getName(), entry.getKey(), entry.getValue());
      }
    }
  }
View Full Code Here

      // This config setting makes sure we can handle pref lines without
      // '=' chars in them. Such prefs will be treated as having value null.
      config.setEmptyOption(true);
      // This config setting makes sure we can handle pref lines with '\' in them.
      config.setEscape(false);
      Ini ini = new Ini();
      ini.setConfig(config);
      ini.load(new StringReader(Joiner.on("\n").join(filteredLines)));
      return ini;
    } catch (IOException e) {
      throw Throwables.propagate(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.ini4j.Ini

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.