Package com.kolakcc.loljclient.util

Source Code of com.kolakcc.loljclient.util.RegionsXMLReader

package com.kolakcc.loljclient.util;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.commons.configuration.XMLConfiguration;

import com.kolakcc.loljclient.model.ServerInfo;

public class RegionsXMLReader {
  public static ArrayList<ServerInfo> getServerInfo() {
    ArrayList<ServerInfo> ret = new ArrayList<ServerInfo>();
    XMLConfiguration config;
    try {
      config = new XMLConfiguration(FileSystem.getFile("app://servers.xml"));
      List<HierarchicalConfiguration> servers = config.configurationsAt("server");
      for (HierarchicalConfiguration server : servers)
      {
        ServerInfo toBeAdded = new ServerInfo();
        toBeAdded.region = server.getString("region");
        toBeAdded.platform = server.getString("platform");
        toBeAdded.name = server.getString("name");
        toBeAdded.server = server.getString("server");
        toBeAdded.loginQueue = server.getString("loginQueue");
        toBeAdded.newsURL = server.getString("newsURL");
        toBeAdded.XMPPserver = server.getString("XMPPserver");
        toBeAdded.useGarena = server.getString("garena") != null;
        ret.add(toBeAdded);
      }
    } catch (ConfigurationException e) {
      e.printStackTrace();
    }
    return ret;
  }
}
TOP

Related Classes of com.kolakcc.loljclient.util.RegionsXMLReader

TOP
Copyright © 2018 www.massapi.com. 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.