萝莉来了 v1.2.1版本的 MD5 值为:6055c21e001561c5b114d0da5b392fcb
以下内容为反编译后的 a.java 源代码,内容仅作参考
package org.cocos2dx.a;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.text.format.Time;
import cn.iyd.pay.alipay.AlixDefine;
import com.flurry.org.codehaus.jackson.util.MinimalPrettyPrinter;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import org.cocos2dx.PBInstance;
import org.cocos2dx.PBPaymentInfo;
import org.json.JSONException;
import org.json.JSONObject;
public final class a {
private static long a = 0;
private static String b = "";
private static String c = "";
public static void a() {
boolean z = true;
SharedPreferences h = h();
if (h != null) {
z = h.getBoolean("isNewUser", true);
if (h.getString("firstOpenTime", null) == null) {
String str = String.valueOf(i()) + "%20" + j();
SharedPreferences.Editor edit = h.edit();
edit.putString("firstOpenTime", str);
edit.commit();
PBInstance.LogD("PBDataStat", "Record FirstGame Time : " + str);
}
}
if (z && org.cocos2dx.d.c.d()) {
new b(d("install"), h).start();
}
}
public static void a(PBPaymentInfo pBPaymentInfo) {
if (pBPaymentInfo == null) {
return;
}
String str = String.valueOf(org.cocos2dx.d.c.b()) + "," + org.cocos2dx.d.c.c() + "," + pBPaymentInfo.mPayModeName + "," + org.cocos2dx.d.c.g() + "," + org.cocos2dx.d.c.h() + "," + org.cocos2dx.d.c.j() + "," + pBPaymentInfo.mProductCoins + "," + pBPaymentInfo.mProductPrice + "," + Build.MANUFACTURER + "-" + Build.MODEL + "," + i() + "%20" + j() + "," + org.cocos2dx.d.c.e() + "-" + org.cocos2dx.d.c.f() + "," + pBPaymentInfo.mProductID + "," + org.cocos2dx.d.c.i();
String str2 = String.valueOf(str) + "," + org.cocos2dx.d.c.a(str);
if (org.cocos2dx.d.c.d()) {
new e(str2).start();
} else {
b("prepareKey", str2);
}
}
public static void a(PBPaymentInfo pBPaymentInfo, String str) {
if (pBPaymentInfo == null) {
return;
}
String str2 = String.valueOf(org.cocos2dx.d.c.b()) + "," + org.cocos2dx.d.c.c() + "," + pBPaymentInfo.mPayModeName + "," + org.cocos2dx.d.c.g() + "," + org.cocos2dx.d.c.h() + "," + org.cocos2dx.d.c.j() + "," + pBPaymentInfo.mProductCoins + "," + pBPaymentInfo.mProductPrice + "," + Build.MANUFACTURER + "-" + Build.MODEL + "," + str + "," + c + "," + i() + "%20" + j() + ",," + org.cocos2dx.d.c.e() + "-" + org.cocos2dx.d.c.f() + "," + pBPaymentInfo.mProductID + "," + org.cocos2dx.d.c.i();
String str3 = String.valueOf(str2) + "," + org.cocos2dx.d.c.a(str2);
if (org.cocos2dx.d.c.d()) {
new f(str3).start();
} else {
b("confirmKey", str3);
}
}
public static void b() {
SharedPreferences h = h();
if (h != null) {
int f = org.cocos2dx.d.c.f();
int i = h.getInt("VersionCode", -1);
if (-1 == i) {
SharedPreferences.Editor edit = h.edit();
edit.putInt("VersionCode", f);
edit.commit();
} else {
if (f <= i || !org.cocos2dx.d.c.d()) {
return;
}
new c(d(AlixDefine.actionUpdate), h, f).start();
}
}
}
public static void b(String str, String str2) {
SharedPreferences sharedPreferences = org.cocos2dx.d.c.a().getSharedPreferences("iapRreference", 0);
String string = sharedPreferences.getString(str, "");
if (string.length() > 0) {
str2 = String.valueOf(string) + ";" + str2;
}
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString(str, str2);
edit.commit();
PBInstance.LogD("PBDataStat", "Record " + str + " : " + str2);
}
public static String c() {
return d("v2update");
}
public static boolean c(String str) {
try {
return new JSONObject(str).getString("status").equals("ok");
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private static String d(String str) {
Hashtable hashtable = new Hashtable();
hashtable.put("path", org.cocos2dx.d.c.c());
hashtable.put("uid", Uri.encode(org.cocos2dx.d.c.g()));
hashtable.put(AlixDefine.VERSION, Uri.encode(org.cocos2dx.d.c.e()));
hashtable.put("appid", org.cocos2dx.d.c.b());
hashtable.put("versioncode", new StringBuilder().append(org.cocos2dx.d.c.f()).toString());
hashtable.put("os", Uri.encode(Build.VERSION.RELEASE));
hashtable.put("mac", org.cocos2dx.d.c.h());
hashtable.put(AlixDefine.DEVICE, String.valueOf(Uri.encode(Build.MANUFACTURER)) + "-" + Uri.encode(Build.MODEL));
hashtable.put("op", str);
hashtable.put("ver", "1.3");
if (str.equals("install")) {
SharedPreferences h = h();
String str2 = String.valueOf(i()) + "%20" + j();
if (h != null) {
str2 = h.getString("firstOpenTime", str2);
}
PBInstance.LogD("PBDataStat", "getFirstOpenTime : " + str2);
hashtable.put("time", str2);
} else {
hashtable.put("time", String.valueOf(i()) + "%20" + j());
}
if (str.equals("session")) {
hashtable.put(AlixDefine.data, k());
}
Map.Entry[] a2 = org.cocos2dx.d.c.a(hashtable);
String str3 = String.valueOf(PBInstance.getTestUrlEnabled() ? String.valueOf("") + "http://117.121.56.146/appark/www/?A2/v2/" : String.valueOf("") + "http://stat.punchbox.org/?A2/v2/") + org.cocos2dx.d.c.a(a2) + "&sign=" + org.cocos2dx.d.c.b(a2);
PBInstance.LogD("PBDataStat", "operation :" + str + ", url : " + str3);
return str3;
}
public static void d() {
if (org.cocos2dx.d.c.d()) {
SharedPreferences sharedPreferences = org.cocos2dx.d.c.a().getSharedPreferences("sessionsInfo", 0);
if (sharedPreferences.getAll().size() == 0) {
return;
}
new d(d("session"), sharedPreferences).start();
}
}
private static String e(String str) {
return str.substring(0, str.indexOf(38));
}
public static void e() {
String e;
int f;
int i = 0;
SharedPreferences sharedPreferences = org.cocos2dx.d.c.a().getSharedPreferences("sessionsInfo", 0);
b = i();
a = System.currentTimeMillis();
String string = sharedPreferences.getString(b, null);
if (string == null) {
e = j();
f = 1;
} else {
e = e(string);
f = f(string) + 1;
i = g(string);
}
String str = String.valueOf(e) + AlixDefine.split + f + AlixDefine.split + i;
PBInstance.LogD("PBDataStat", "refreshSessionData : " + str);
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString(b, str);
edit.commit();
}
private static int f(String str) {
return Integer.parseInt(str.substring(str.indexOf(38) + 1, str.lastIndexOf(38)));
}
public static void f() {
SharedPreferences sharedPreferences = org.cocos2dx.d.c.a().getSharedPreferences("sessionsInfo", 0);
String string = sharedPreferences.getString(b, null);
try {
String e = e(string);
String str = String.valueOf(e) + AlixDefine.split + f(string) + AlixDefine.split + (g(string) + ((int) ((System.currentTimeMillis() - a) / 1000)));
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString(b, str);
edit.commit();
PBInstance.LogD("PBDataStat", "StatData : " + str);
} catch (Exception e2) {
e2.printStackTrace();
PBInstance.LogD("PBDataStat", "Update user play time failed!");
}
}
private static int g(String str) {
return Integer.parseInt(str.substring(str.lastIndexOf(38) + 1));
}
public static void g() {
if (org.cocos2dx.d.c.d()) {
new g().start();
}
}
private static SharedPreferences h() {
if (org.cocos2dx.d.c.a() != null) {
return org.cocos2dx.d.c.a().getSharedPreferences("StatPreference", 0);
}
return null;
}
private static String i() {
Time time = new Time();
time.setToNow();
return String.format("%04d-%02d-%02d", Integer.valueOf(time.year), Integer.valueOf(time.month + 1), Integer.valueOf(time.monthDay));
}
private static String j() {
Time time = new Time();
time.setToNow();
return String.format("%02d:%02d:%02d", Integer.valueOf(time.hour), Integer.valueOf(time.minute), Integer.valueOf(time.second));
}
private static String k() {
Iterator<Map.Entry<String, ?>> it = org.cocos2dx.d.c.a().getSharedPreferences("sessionsInfo", 0).getAll().entrySet().iterator();
String str = "[";
while (true) {
String str2 = str;
if (!it.hasNext()) {
String str3 = String.valueOf(str2) + "]";
PBInstance.LogD("PBDataStat", "SessionData : " + str3);
String encode = Uri.encode(str3);
PBInstance.LogD("PBDataStat", "SessionData encode : " + encode);
return encode;
}
Map.Entry<String, ?> next = it.next();
String str4 = String.valueOf(next.getKey()) + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + e((String) next.getValue());
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("ostime", str4);
jSONObject.put("stime", g((String) next.getValue()));
jSONObject.put("snum", f((String) next.getValue()));
str2 = String.valueOf(str2) + jSONObject.toString();
str = String.valueOf(str2) + ",";
} catch (JSONException e) {
str = str2;
e.printStackTrace();
}
}
}
}