コード例 #1
0
  public static Map func_27177_a(String s) {
    HashMap hashmap = new HashMap();
    try {
      String s1 = "local";
      StringBuilder stringbuilder = new StringBuilder();
      J_JsonRootNode j_jsonrootnode = (new J_JdomParser()).func_27367_a(s);
      List list = j_jsonrootnode.func_27217_b(new Object[] {"stats-change"});
      for (Iterator iterator = list.iterator(); iterator.hasNext(); ) {
        J_JsonNode j_jsonnode = (J_JsonNode) iterator.next();
        Map map = j_jsonnode.func_27214_c();
        java.util.Map.Entry entry = (java.util.Map.Entry) map.entrySet().iterator().next();
        int i = Integer.parseInt(((J_JsonStringNode) entry.getKey()).func_27216_b());
        int j = Integer.parseInt(((J_JsonNode) entry.getValue()).func_27216_b());
        StatBase statbase = StatList.func_27361_a(i);
        if (statbase == null) {
          System.out.println(
              (new StringBuilder()).append(i).append(" is not a valid stat").toString());
        } else {
          stringbuilder.append(StatList.func_27361_a(i).statGuid).append(",");
          stringbuilder.append(j).append(",");
          hashmap.put(statbase, Integer.valueOf(j));
        }
      }

      MD5String md5string = new MD5String(s1);
      String s2 = md5string.func_27369_a(stringbuilder.toString());
      if (!s2.equals(j_jsonrootnode.func_27213_a(new Object[] {"checksum"}))) {
        System.out.println("CHECKSUM MISMATCH");
        return null;
      }
    } catch (J_InvalidSyntaxException j_invalidsyntaxexception) {
      j_invalidsyntaxexception.printStackTrace();
    }
    return hashmap;
  }
コード例 #2
0
  public static String func_27185_a(String s, String s1, Map map) {
    StringBuilder stringbuilder = new StringBuilder();
    StringBuilder stringbuilder1 = new StringBuilder();
    boolean flag = true;
    stringbuilder.append("{\r\n");
    if (s != null && s1 != null) {
      stringbuilder.append("  \"user\":{\r\n");
      stringbuilder.append("    \"name\":\"").append(s).append("\",\r\n");
      stringbuilder.append("    \"sessionid\":\"").append(s1).append("\"\r\n");
      stringbuilder.append("  },\r\n");
    }
    stringbuilder.append("  \"stats-change\":[");
    StatBase statbase;
    for (Iterator iterator = map.keySet().iterator();
        iterator.hasNext();
        stringbuilder1.append(map.get(statbase)).append(",")) {
      statbase = (StatBase) iterator.next();
      if (!flag) {
        stringbuilder.append("},");
      } else {
        flag = false;
      }
      stringbuilder
          .append("\r\n    {\"")
          .append(statbase.statId)
          .append("\":")
          .append(map.get(statbase));
      stringbuilder1.append(statbase.statGuid).append(",");
    }

    if (!flag) {
      stringbuilder.append("}");
    }
    MD5String md5string = new MD5String(s1);
    stringbuilder.append("\r\n  ],\r\n");
    stringbuilder
        .append("  \"checksum\":\"")
        .append(md5string.func_27369_a(stringbuilder1.toString()))
        .append("\"\r\n");
    stringbuilder.append("}");
    return stringbuilder.toString();
  }