Package net.sourceforge.queried

Examples of net.sourceforge.queried.ServerInfo


  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, "getstatus", infoType, queryType, gameType);

    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      queryResult = queryResult.substring(queryResult.indexOf("\\"));
      queryResult = queryResult.replaceAll("\\^([0-9a-wyzA-WYZ]|x[0-9a-fA-F]{6})", "");
      serverInfo = new ServerInfo();
      String[] playerParts = queryResult.split("\n");
      serverInfo.setGame(Util.getPart(queryResult, "gamename"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(port + "");
      serverInfo.setName(Util.getPart(queryResult, "sv_hostname"));
      serverInfo.setPlayerCount(playerParts.length - 1 + "");
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "sv_maxclients"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here


  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, "getstatus", infoType, queryType, gameType);

    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      queryResult = queryResult.substring(queryResult.indexOf("\\"));
      queryResult = queryResult.replaceAll("\\^([0-9a-wyzA-WYZ]|x[0-9a-fA-F]{6})", "");
      serverInfo = new ServerInfo();
      String[] playerParts = queryResult.split("\n");
      serverInfo.setGame(Util.getPart(queryResult, "gamename"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(port + "");
      serverInfo.setName(Util.getPart(queryResult, "sv_hostname"));
      serverInfo.setPlayerCount(playerParts.length - 1 + "");
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "sv_maxclients"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

    }
    queryResult = queryResult.replaceAll("\\^([0-9a-wyzA-WYZ]|x[0-9a-fA-F]{6})", "");

    String[] masterServerPacketArray = queryResult.split("\u0000\u0000\u0000");

    ServerInfo serverInfo = null;
    if (masterServerPacketArray[1].length() > 0) {
      serverInfo = new ServerInfo();

      String plyrs = masterServerPacketArray[2].substring(1);
      Pattern playerPattern = Pattern.compile("(.)(.)\\x00(.{2})\\x00\\x00([\\w\\s/\\x19-\\x2f\\x51-\\x5e\\x7d\\x7b@!:~_]+)\\x00?([\\w\\s/\\x19-\\x2f\\x51-\\x5e\\x7d\\x7b@!:~_]+|\\x00?)");
      Matcher m = playerPattern.matcher(plyrs);
      int plyrcnt = 0;
      while (m.find()) {
        plyrcnt++;
      }
      String playercount = String.valueOf(plyrcnt);

      String tempGameVersion = Util.getPartGS2(masterServerPacketArray[1], "si_version");
      tempGameVersion = tempGameVersion.replaceAll("[a-zA-Z]", "").trim();
      String GameVersion = tempGameVersion.substring((tempGameVersion.indexOf("  ") + 2), tempGameVersion.indexOf(" ", tempGameVersion.indexOf("  ") + 3));// there's
// a whole lot of fluff in the version field.

      serverInfo.setGame(Util.getPartGS2(masterServerPacketArray[1], "si_gameType"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(port + "");
      serverInfo.setName(Util.getPartGS2(masterServerPacketArray[1], "si_name"));
      serverInfo.setGameVersion(GameVersion);
      serverInfo.setPlayerCount(playercount);
      serverInfo.setMaxPlayers(Util.getPartGS2(masterServerPacketArray[1], "si_maxPlayers"));
      serverInfo.setMap(Util.getPartGS2(masterServerPacketArray[1], "si_map"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, "\\info\\", infoType, queryType, gameType);
    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      serverInfo = new ServerInfo();
      serverInfo.setGame(Util.getPart(queryResult, "gameId"));
      serverInfo.setGameVersion(Util.getPart(queryResult, "version"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(Util.getPart(queryResult, "hostport"));
      serverInfo.setName(Util.getPart(queryResult, "hostname"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setPlayerCount(Util.getPart(queryResult, "numplayers"));
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "maxplayers"));
      serverInfo.setTeam1Tickets(Util.getPart(queryResult, "tickets1"));
      serverInfo.setTeam2Tickets(Util.getPart(queryResult, "tickets2"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, infoType, queryType, gameType);
    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      serverInfo = new ServerInfo();
      serverInfo.setGame("Neverwinter Nights");
      serverInfo.setGameVersion(Util.getPartGS2(queryResult, "gamever"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(Util.getPartGS2(queryResult, "hostport"));
      serverInfo.setName(Util.getPartGS2(queryResult, "hostname"));
      serverInfo.setMap(Util.getPartGS2(queryResult, "mapname"));
      serverInfo.setPlayerCount(Util.getPartGS2(queryResult, "numplayers"));
      serverInfo.setMaxPlayers(Util.getPartGS2(queryResult, "maxplayers"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {
    String queryResult = Util.getInfo(localPort, ipStr, port, "getstatus",
            infoType, queryType, gameType);

    ServerInfo serverInfo = null;

    if (queryResult != null && queryResult.length() > 0) {
      queryResult = queryResult.substring(queryResult.indexOf("\n"));
      queryResult = queryResult.replaceAll(
              "\\^([0-9a-wyzA-WYZ]|x[0-9a-fA-F]{6})", "");
      serverInfo = new ServerInfo();
      serverInfo.setGame(Util.getPart(queryResult, "gamename"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(port + "");
      serverInfo.setName(Util.getPart(queryResult, "sv_hostname"));

      serverInfo.setPlayerCount(
              queryResult.substring(queryResult.indexOf("\\clients\\") + 9,
                      queryResult.indexOf("\\clients\\") + 10));
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "sv_maxclients"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, infoType, queryType, gameType);

    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      serverInfo = new ServerInfo();
      serverInfo.setGame(Util.getPartGS2(queryResult, "gamename"));
      serverInfo.setGameVersion(Util.getPartGS2(queryResult, "gamever"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(Util.getPartGS2(queryResult, "hostport"));
      serverInfo.setName(Util.getPartGS2(queryResult, "hostname"));
      serverInfo.setMap(Util.getPartGS2(queryResult, "mapname"));
      serverInfo.setPlayerCount(Util.getPartGS2(queryResult, "numplayers"));
      serverInfo.setMaxPlayers(Util.getPartGS2(queryResult, "maxplayers"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

          int gameType) {

    String queryResult =
            Util.getInfo(localPort, ipStr, port, "\\info\\", infoType, queryType, gameType);

    ServerInfo serverInfo = null;
    ;
    if (queryResult != null && queryResult.length() > 1) {
      serverInfo = new ServerInfo();
      serverInfo.setName(Util.getPart(queryResult, "hostname"));
      serverInfo.setPort(Util.getPart(queryResult, "hostport"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setPlayerCount(Util.getPart(queryResult, "numplayers"));
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "maxplayers"));

      serverInfo.setGame(Util.getPart(queryResult, "gametype"));
      serverInfo.setGameVersion(Util.getPart(queryResult, "gamever"));
      serverInfo.setIp(ipStr);
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType,
          int queryType, int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, "getstatus", infoType, queryType, gameType);

    ServerInfo serverInfo = null;
    if (queryResult != null && queryResult.length() > 0) {
      queryResult = queryResult.substring(queryResult.indexOf("\\"));
      queryResult = queryResult.replaceAll("\\^([0-9a-wyzA-WYZ]|x[0-9a-fA-F]{6})", "");
      serverInfo = new ServerInfo();
      serverInfo.setGame(Util.getPart(queryResult, "gamename"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(port + "");
      serverInfo.setName(Util.getPart(queryResult, "hostname"));
      serverInfo.setPlayerCount(Util.getPart(queryResult, "clients"));
      serverInfo.setMaxPlayers(Util.getPart(queryResult, "sv_maxclients"));
      serverInfo.setMap(Util.getPart(queryResult, "mapname"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

  public static ServerInfo getDetails(int localPort, String ipStr, int port, int infoType, int queryType,
          int gameType) {

    String queryResult = Util.getInfo(localPort, ipStr, port, infoType, queryType, gameType);
    ServerInfo serverInfo = null;
    if ((queryResult != null) && (queryResult.length() > 0)) {
      serverInfo = new ServerInfo();
      serverInfo.setGame(Util.getPartGS2(queryResult, "game_id"));
      serverInfo.setGameVersion(Util.getPartGS2(queryResult, "gamever"));
      serverInfo.setIp(ipStr);
      serverInfo.setPort(Util.getPartGS2(queryResult, "hostport"));
      serverInfo.setName(Util.getPartGS2(queryResult, "hostname"));
      serverInfo.setMap(Util.getPartGS2(queryResult, "mapname"));
      serverInfo.setPlayerCount(Util.getPartGS2(queryResult, "numplayers"));
      serverInfo.setMaxPlayers(Util.getPartGS2(queryResult, "maxplayers"));
      serverInfo.setFullResponse(queryResult);
    }

    return serverInfo;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.queried.ServerInfo

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.