4399游戏盒 v7.2.1.31版本的 MD5 值为:951717f45e3fda95c8a358caf4ca93e1
以下内容为反编译后的 c.java 源代码,内容仅作参考
package cn.m4399.gamebox;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import cn.m4399.gamebox.support.AlResult;
import cn.m4399.operate.provider.UserModel;
import com.m4399.gamecenter.plugin.main.database.tables.u;
import java.io.File;
import java.util.HashMap;
import org.json.JSONObject;
public class c {
public static final int FAILED_OPERATE_V1 = 4;
public static final int FAILED_OPERATE_V2 = 8;
public static final int FAILED_PREPARE_PREF = 0;
public static final int FAILED_SINGLE = 16;
public static final int SUCCESS = 0;
public static class a {
String dataDir;
String gameKey;
String jW;
public a(String str, String str2, String str3) {
this.gameKey = str;
this.dataDir = str2;
this.jW = str3;
}
public String toString() {
return "Config{gameKey='" + this.gameKey + "', dataDir='" + this.dataDir + "', udid='" + this.jW + "'}";
}
}
public static class e {
String id;
String refreshToken;
public e(String str, String str2) {
this.refreshToken = str;
this.id = str2;
}
public String toString() {
return "User{refreshToken='" + this.refreshToken + "', id='" + this.id + "'}";
}
}
public static void doAuth(Context context, final a aVar, final e eVar, final cn.m4399.gamebox.support.b<Void> bVar) {
cn.m4399.gamebox.support.a.init(context);
cn.m4399.gamebox.support.c.e("SecretOauth will init: %s, %s", aVar, eVar);
final String H = H(aVar.dataDir);
if (H == null) {
bVar.onFinished(new AlResult<>(0, false, "Failed to prepare preference dir"));
} else {
final Handler handler = new Handler(Looper.getMainLooper());
new Thread(new Runnable() {
@Override
public void run() {
final AlResult b2 = c.b(a.this, eVar);
handler.post(new Runnable() {
@Override
public void run() {
int code = b2.code();
if (code == 100 || code == 200) {
JSONObject json = ((cn.m4399.gamebox.support.network.a.a) b2.data()).json();
int l = new b(H).l(json);
StringBuilder sb = new StringBuilder();
sb.append("Finished to sync account: ");
sb.append(l == 0 ? " V1 success;" : " V1 failed;");
String sb2 = sb.toString();
int l2 = new C0015c(H).l(json);
StringBuilder sb3 = new StringBuilder();
sb3.append(sb2);
sb3.append(l2 == 0 ? " V2 success;" : "V 2 failed;");
String sb4 = sb3.toString();
int l3 = new d(H).l(json);
StringBuilder sb5 = new StringBuilder();
sb5.append(sb4);
sb5.append(l3 == 0 ? " Single success" : " Single failed");
int i = l3 | l | l2;
bVar.onFinished(new AlResult(i, i == 0, sb5.toString()));
return;
}
bVar.onFinished(new AlResult(b2));
}
});
}
}).start();
}
}
public static int doRepeal(Context context, String str) {
cn.m4399.gamebox.support.a.init(context);
String H = H(str);
if (H == null) {
return 0;
}
return new d(H).clear() | new b(H).clear() | new C0015c(H).clear();
}
private static String H(String str) {
if (!cn.m4399.gamebox.support.a.b.mkdirs(str, "shared_prefs")) {
return null;
}
return str + File.separator + "shared_prefs";
}
public static AlResult<cn.m4399.gamebox.support.network.a.a> b(a aVar, e eVar) {
cn.m4399.gamebox.a aVar2 = new cn.m4399.gamebox.a();
aVar2.a(aVar, eVar);
HashMap hashMap = new HashMap();
hashMap.put("refresh_token", eVar.refreshToken);
hashMap.put("device", aVar2.F(eVar.id));
return cn.m4399.gamebox.support.network.b.post().api("https://m.4399api.com/openapiv2/oauth-getinfobyrefresh.html").body(hashMap).execute(cn.m4399.gamebox.support.network.a.a.class);
}
private static abstract class f {
protected String jX;
abstract int clear();
abstract int l(JSONObject jSONObject);
public f(String str) {
this.jX = str;
}
}
private static class b extends f {
public b(String str) {
super(str);
}
@Override
int l(JSONObject jSONObject) {
String optString;
cn.m4399.gamebox.support.a.c instance = cn.m4399.gamebox.support.a.c.instance(this.jX, "device");
if (instance == null) {
return 0;
}
cn.m4399.gamebox.support.a.c putString = instance.putString("state", jSONObject.optString("state")).putString("code", jSONObject.optString("code")).putString("USER_NAME", jSONObject.optString("username"));
if (jSONObject.isNull(u.COLUMN_NICK)) {
optString = jSONObject.optString("username", "");
} else {
optString = jSONObject.optString(u.COLUMN_NICK, "");
}
putString.putString("NICK", optString).putString("UID", jSONObject.optString("uid")).putString("bindedphone", jSONObject.optString("bindedphone", "")).putString("SERVER_SERIAL", "0").putString("greeting", jSONObject.optString("hello", "")).putString(com.tencent.connect.common.b.PARAM_ACCESS_TOKEN, jSONObject.optString(com.tencent.connect.common.b.PARAM_ACCESS_TOKEN, "")).putString("account_type", jSONObject.optString("account_type", "4399")).putString("suid", jSONObject.optString("suid", "-1")).putString("id_checked", String.valueOf(jSONObject.optBoolean("id_checked", false))).putString("id_checked_real", String.valueOf(jSONObject.optBoolean("id_checked_real", false))).putString("idcard_state", String.valueOf(jSONObject.optInt("idcard_state", -1))).putString("activate", String.valueOf(jSONObject.optBoolean("activated", false))).putString("phone_bound", String.valueOf(jSONObject.optInt("phone_bound", -1))).putString("idcard_editable", String.valueOf(jSONObject.optBoolean("idcard_editable"))).commit();
String string = instance.getString("state", "");
return (!TextUtils.equals(jSONObject.optString("state"), string) || TextUtils.isEmpty(string)) ? 4 : 0;
}
@Override
int clear() {
cn.m4399.gamebox.support.a.c instance = cn.m4399.gamebox.support.a.c.instance(this.jX, "device");
if (instance == null) {
return 0;
}
instance.remove("state").remove("code").remove("USER_NAME").remove("NICK").remove("UID").remove("bindedphone").remove("SERVER_SERIAL").remove("greeting").remove(com.tencent.connect.common.b.PARAM_ACCESS_TOKEN).remove("account_type").remove("suid").remove("id_checked").remove("id_checked_real").remove("idcard_state").remove("activate").remove("phone_bound").remove("idcard_editable").commit();
return 0;
}
}
private static class C0015c extends f {
public C0015c(String str) {
super(str);
}
@Override
int l(JSONObject jSONObject) {
UserModel userModel = new UserModel();
userModel.parse(jSONObject);
userModel.persist(this.jX, "operate_pref");
UserModel userModel2 = (UserModel) cn.m4399.gamebox.support.a.d.deserialize(this.jX, "operate_pref", UserModel.class);
cn.m4399.gamebox.support.c.v("%s, %s", userModel.state, userModel2.state);
return (!TextUtils.equals(userModel.state, userModel2.state) || TextUtils.isEmpty(userModel2.state)) ? 8 : 0;
}
@Override
int clear() {
UserModel userModel = new UserModel();
userModel.uid = "";
userModel.state = "";
userModel.accessToken = "";
userModel.persist(this.jX, "operate_pref");
return 0;
}
}
private static class d extends f {
public d(String str) {
super(str);
}
@Override
int l(JSONObject jSONObject) {
cn.m4399.single.basic.UserModel userModel = new cn.m4399.single.basic.UserModel();
userModel.parse(jSONObject);
userModel.persist(this.jX, "cn_m4399_single");
cn.m4399.single.basic.UserModel userModel2 = (cn.m4399.single.basic.UserModel) cn.m4399.gamebox.support.a.d.deserialize(this.jX, "cn_m4399_single", cn.m4399.single.basic.UserModel.class);
cn.m4399.gamebox.support.c.v("%s, %s", userModel.state, userModel2.state);
return (!TextUtils.equals(userModel.state, userModel2.state) || TextUtils.isEmpty(userModel2.state)) ? 16 : 0;
}
@Override
int clear() {
cn.m4399.single.basic.UserModel userModel = new cn.m4399.single.basic.UserModel();
userModel.uid = "";
userModel.state = "";
userModel.accessToken = "";
userModel.persist(this.jX, "cn_m4399_single");
return 0;
}
}
}