OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 ay.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.util;
import android.content.Context;
import android.database.sqlite.SQLiteFullException;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.android.admodule.bean.AdPlatBeanResult;
import com.android.spush.util.WebActionRouter;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.api.request.GameAttrsRequest;
import com.excelliance.kxqp.api.response.GameAttrsResponse;
import com.excelliance.kxqp.avds.AvdSplashCallBackImp;
import com.excelliance.kxqp.bean.AppExtraBean;
import com.excelliance.kxqp.bean.ResourcesDownloadInfo;
import com.excelliance.kxqp.bean.TextFeature;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.bitmap.bean.ResponseData;
import com.excelliance.kxqp.bitmap.model.ThirdLink;
import com.excelliance.kxqp.gs.bean.AppAreaBean;
import com.excelliance.kxqp.gs.bean.AppDownLoadInfoBean;
import com.excelliance.kxqp.gs.bean.AppDownLoadInfoChildBean;
import com.excelliance.kxqp.gs.bean.CityBean;
import com.excelliance.kxqp.gs.bean.CooperationAPPContent;
import com.excelliance.kxqp.gs.bean.DownloadAreaBean;
import com.excelliance.kxqp.gs.bean.InitialGameBean;
import com.excelliance.kxqp.gs.bean.LastSaveProxyInfo;
import com.excelliance.kxqp.gs.bean.LoginAreaBean;
import com.excelliance.kxqp.gs.bean.PermissionBean;
import com.excelliance.kxqp.gs.bean.ReginBean;
import com.excelliance.kxqp.gs.bean.SearchBean;
import com.excelliance.kxqp.gs.bean.ShareGameBean;
import com.excelliance.kxqp.gs.bean.UnableAndNativeInstallVpnResultBean;
import com.excelliance.kxqp.gs.bean.UpFileLoadBean;
import com.excelliance.kxqp.gs.game.GameType;
import com.excelliance.kxqp.gs.multi.down.model.DownBean;
import com.excelliance.kxqp.gs.multi.down.model.PatchDownBean;
import com.excelliance.kxqp.gs.service.ProxyDelayService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.gaccount.GAccountCombineBean;
import com.excelliance.kxqp.gs.ui.gaccount.GGAccBean;
import com.excelliance.kxqp.gs.ui.googlecard.bean.CardBean;
import com.excelliance.kxqp.gs.ui.googlecard.bean.CardReginBean;
import com.excelliance.kxqp.gs.ui.googlecard.bean.FailureBean;
import com.excelliance.kxqp.gs.ui.googlecard.bean.MyCardBean;
import com.excelliance.kxqp.gs.ui.googlecard.bean.SuccessBean;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.ui.InitialData;
import com.excelliance.kxqp.ui.detail.category.CategoryListActivity;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.tencent.open.SocialConstants;
import java.io.File;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ay {
public static List<CityBean> a(Context context, List<CityBean> list) {
return list;
}
public static int a(String str, int i) {
try {
return Integer.parseInt(str);
} catch (Exception e) {
Log.e("JsonUtil", "optInt: ex = [ " + e + "]");
return i;
}
}
public static long b(String str, int i) {
try {
return Long.parseLong(str);
} catch (Exception e) {
Log.e("JsonUtil", "strToLong: ex = [ " + e + "]");
return i;
}
}
public static List<String> a(String str) {
return a(str, "topAppslist");
}
public static List<String> a(String str, String str2) {
ArrayList arrayList = new ArrayList();
try {
try {
JSONArray jSONArray = new JSONObject(str).getJSONArray(str2);
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
String string = jSONArray.getJSONObject(i).getString("name");
if (!TextUtils.isEmpty(string)) {
arrayList.add(string);
}
}
return arrayList;
} catch (JSONException e) {
e.printStackTrace();
return arrayList;
}
} catch (Throwable unused) {
return arrayList;
}
}
public static List<CooperationAPPContent> a(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
if (jSONArray != null) {
try {
if (jSONArray.length() > 0) {
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
CooperationAPPContent cooperationAPPContent = new CooperationAPPContent();
cooperationAPPContent.setPkg_name(optJSONObject.optString("pkgname"));
cooperationAPPContent.setContent(optJSONObject.optString("content"));
arrayList.add(cooperationAPPContent);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return arrayList;
}
public static List<String> b(String str) {
ArrayList arrayList = new ArrayList();
try {
JSONArray jSONArray = new JSONObject(str).getJSONArray("recommend");
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
arrayList.add(URLDecoder.decode(((JSONObject) jSONArray.get(i)).getString("name"), "UTF-8"));
}
} catch (Exception e) {
e.printStackTrace();
}
return arrayList;
}
public static List<CityBean> c(String str) {
ArrayList arrayList = new ArrayList();
try {
try {
if (!TextUtils.isEmpty(str)) {
JSONArray jSONArray = new JSONObject(str).getJSONArray("regin");
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
CityBean cityBean = new CityBean();
JSONObject jSONObject = jSONArray.getJSONObject(i);
String string = jSONObject.getString("id");
String string2 = jSONObject.getString("name");
cityBean.setId(string);
cityBean.setName(string2);
arrayList.add(cityBean);
}
}
return arrayList;
} catch (JSONException e) {
e.printStackTrace();
return arrayList;
}
} catch (Throwable unused) {
return arrayList;
}
}
public static List<CityBean> a(String str, boolean z) {
if (!z || aq.v() || aq.e()) {
return c(str);
}
az.d("JsonUtil", "city json:" + str);
ArrayList arrayList = new ArrayList();
try {
if (!TextUtils.isEmpty(str)) {
JSONArray jSONArray = new JSONObject(str).getJSONArray("regin");
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
CityBean cityBean = new CityBean();
JSONObject jSONObject = jSONArray.getJSONObject(i);
String string = jSONObject.getString("id");
String string2 = jSONObject.getString("name");
int optInt = jSONObject.optInt("sort");
cityBean.setId(string + "_" + jSONObject.optInt("type"));
cityBean.setName(string2.trim());
cityBean.setType(jSONObject.optInt("type"));
cityBean.setHide(jSONObject.optInt("is_hide"));
cityBean.setSort(optInt);
cityBean.setGroup(jSONObject.optInt("group"));
cityBean.setShowTypePosition(jSONObject.optInt("showTypePosition"));
cityBean.itemType = 2;
arrayList.add(cityBean);
}
az.d("JsonUtil", "cityBeanList:" + arrayList);
return arrayList;
}
} catch (JSONException e) {
e.printStackTrace();
az.d("JsonUtil", "ex:" + e.getMessage());
}
return arrayList;
}
public static List<SearchBean> a(String str, String str2, Context context) {
ArrayList arrayList = new ArrayList();
if (!TextUtils.isEmpty(str2)) {
try {
if (!TextUtils.isEmpty(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
JSONArray jSONArray = jSONObject.getJSONArray(str2.toLowerCase());
ArrayList arrayList2 = new ArrayList();
if (b.bJ(context)) {
JSONArray optJSONArray = jSONObject.optJSONArray("third_domin");
az.d("JsonUtil", "parserGlobalSearch/thirdLink thirdArry: " + optJSONArray);
if (optJSONArray != null && optJSONArray.length() > 0) {
try {
arrayList2 = (List) new Gson().a(optJSONArray.toString(), new TypeToken<List<ThirdLink>>() {
}.getType());
} catch (Exception e) {
az.e("JsonUtil", "parserGlobalSearch/thirdLink ex:" + e);
}
}
}
int length = jSONArray.length();
int i = 0;
while (i < length) {
JSONObject jSONObject2 = jSONArray.getJSONObject(i);
String optString = jSONObject2.optString("company");
String optString2 = jSONObject2.optString(CategoryListActivity.TAG_NAME);
String optString3 = jSONObject2.optString(com.umeng.analytics.pro.am.O);
String optString4 = jSONObject2.optString("goodTag");
String optString5 = jSONObject2.optString("detail");
String optString6 = jSONObject2.optString(RankingItem.KEY_ICON);
StringBuilder sb = new StringBuilder();
sb.append(optString6.startsWith("https://cdn.ourplay.com.cn") ? "" : "http://search.ourplay.com.cn:8080/store/usercontent?url=");
sb.append(optString6);
String sb2 = sb.toString();
String optString7 = jSONObject2.optString("name");
String optString8 = jSONObject2.optString(AvdSplashCallBackImp.KEY_PRICE);
String optString9 = jSONObject2.optString("title");
double optDouble = jSONObject2.optDouble(RankingItem.KEY_STAR);
String optString10 = jSONObject2.optString("pkgname");
String optString11 = jSONObject2.optString(RankingItem.KEY_ONLINE);
JSONArray jSONArray2 = jSONArray;
JSONObject jSONObject3 = jSONObject;
long optLong = jSONObject2.optLong(RankingItem.KEY_SIZE);
int i2 = length;
int optInt = jSONObject2.optInt("apkfrom");
int optInt2 = jSONObject2.optInt("market_install_local");
int optInt3 = jSONObject2.optInt("market_strategy");
int optInt4 = jSONObject2.optInt("isSubscribe");
int optInt5 = jSONObject2.optInt("has_third_domin");
String optString12 = jSONObject2.optString("id");
String optString13 = jSONObject2.optString("hasappointment", "0");
String optString14 = jSONObject2.optString("version_updatetime");
String optString15 = jSONObject2.optString("datafinder_game_id");
int optInt6 = jSONObject2.optInt("apk_update_version");
int optInt7 = jSONObject2.optInt("buttonStatus");
String optString16 = jSONObject2.optString("buttonText");
int i3 = i;
ArrayList arrayList3 = arrayList;
ArrayList arrayList4 = arrayList2;
try {
SearchBean searchBean = new SearchBean(optString, optString5, sb2, optString7, optString8, optDouble, optString9);
searchBean.setTag(optString2);
searchBean.setUnit(optString3);
searchBean.setPkgName(optString10);
searchBean.setOnline(optString11);
searchBean.setSize(optLong);
searchBean.setExtraInfo(jSONObject2);
searchBean.apkFrom = optInt;
searchBean.market_install_local = optInt2;
searchBean.market_strategy = optInt3;
searchBean.setHighQuality(optString4);
searchBean.setSubscribe(optInt4);
searchBean.setHasThird(optInt5);
searchBean.appUpdateTime = optString14;
searchBean.datafinder_game_id = optString15;
searchBean.apk_update_version = optInt6;
searchBean.buttonStatus = optInt7;
searchBean.buttonText = optString16;
try {
searchBean.appId = Integer.valueOf(optString12).intValue();
} catch (Exception e2) {
e2.printStackTrace();
}
try {
searchBean.subscribeStates = Integer.valueOf(optString13).intValue();
} catch (Exception e3) {
e3.printStackTrace();
}
if (b.bJ(context) && optInt5 == 1) {
ArrayList<ThirdLink> arrayList5 = new ArrayList();
if (arrayList4 == null || arrayList4.size() <= 0) {
arrayList2 = arrayList4;
} else {
arrayList2 = arrayList4;
arrayList5.addAll(arrayList2);
for (ThirdLink thirdLink : arrayList5) {
if (thirdLink.isOurSelf == 1 && !cd.a(optString10) && !cd.a(thirdLink.url)) {
thirdLink.url += optString10;
thirdLink.pkgName = optString10;
thirdLink.sourceFromMarket = optInt3 == 1 ? 1 : 0;
}
}
}
az.d("JsonUtil", "parserGlobalSearch thirdUrlListItem: " + arrayList5);
searchBean.thirdLink = arrayList5;
} else {
arrayList2 = arrayList4;
}
az.d("JsonUtil", "parserGlobalSearch: " + searchBean);
arrayList = arrayList3;
arrayList.add(searchBean);
i = i3 + 1;
jSONArray = jSONArray2;
jSONObject = jSONObject3;
length = i2;
} catch (JSONException e4) {
e = e4;
arrayList = arrayList3;
Log.e("JsonUtil", "parserGlobalSearch: " + e);
return arrayList;
} catch (Throwable unused) {
return arrayList3;
}
}
JSONArray optJSONArray2 = jSONObject.optJSONArray("searchActivity");
if (optJSONArray2 != null && optJSONArray2.length() > 0) {
for (int length2 = optJSONArray2.length() - 1; length2 >= 0; length2--) {
String optString17 = optJSONArray2.getJSONObject(length2).optString(SocialConstants.PARAM_AVATAR_URI);
String optString18 = optJSONArray2.getJSONObject(length2).optString("jump_url");
SearchBean searchBean2 = new SearchBean("", "", optString17, "", "", 0.0d, "");
searchBean2.jumpUrl = optString18;
searchBean2.isKolEvent = true;
arrayList.add(0, searchBean2);
}
}
return arrayList;
} catch (JSONException e5) {
e = e5;
}
}
} catch (Throwable unused2) {
return arrayList;
}
}
return arrayList;
}
public static List<ThirdLink> d(String str) {
az.d("JsonUtil", "parserThirdList: response:" + str);
ArrayList arrayList = new ArrayList();
if (TextUtils.isEmpty(str)) {
return arrayList;
}
try {
JSONArray optJSONArray = new JSONObject(str).optJSONArray("noresult_drainage");
Log.d("JsonUtil", "parseDetail/thirdLink thirdArry: " + optJSONArray);
if (optJSONArray != null && optJSONArray.length() > 0) {
try {
arrayList = (List) new Gson().a(optJSONArray.toString(), new TypeToken<List<ThirdLink>>() {
}.getType());
} catch (JsonSyntaxException e) {
Log.e("JsonUtil", "parseDetail/thirdLink ex:" + e);
}
}
} catch (JSONException e2) {
az.d("JsonUtil", "parserThirdList: " + e2);
}
az.d("JsonUtil", "parserThirdList: thirdArrayList:" + arrayList);
return arrayList;
}
public static ShareGameBean e(String str) {
az.d("JsonUtil", "----contentJson:" + str);
ShareGameBean shareGameBean = new ShareGameBean();
ArrayList arrayList = new ArrayList();
try {
JSONObject jSONObject = new JSONObject(str);
shareGameBean.setTitle(jSONObject.getString("title"));
shareGameBean.setDescription(jSONObject.getString(SocialConstants.PARAM_COMMENT));
shareGameBean.setRatingValue(jSONObject.getString("ratingValue"));
shareGameBean.setRatingCount(jSONObject.getString("ratingCount"));
shareGameBean.setLink(jSONObject.getString("link"));
shareGameBean.setTitlePic(jSONObject.getString("title_pic"));
shareGameBean.setLib(jSONObject.getString("lib"));
JSONObject jSONObject2 = jSONObject.getJSONObject("pic");
arrayList.add(jSONObject2.getString("gamepic0"));
arrayList.add(jSONObject2.getString("gamepic1"));
arrayList.add(jSONObject2.getString("gamepic2"));
shareGameBean.setImageUrl(arrayList);
} catch (JSONException e) {
e.printStackTrace();
}
return shareGameBean;
}
public static InitialGameBean f(String str) {
az.d("JsonUtil", "----contentJson:" + str);
InitialGameBean initialGameBean = new InitialGameBean();
if (TextUtils.isEmpty(str) || TextUtils.equals(str, "null")) {
return initialGameBean;
}
try {
JSONObject jSONObject = new JSONObject(str);
initialGameBean.setAppTitle(jSONObject.getString("appTitle"));
initialGameBean.setLib(jSONObject.getString("lib"));
initialGameBean.setLink(jSONObject.getString("link"));
initialGameBean.setMd5(jSONObject.getString("md5"));
initialGameBean.setPic(jSONObject.getString("pic"));
String string = jSONObject.getString(RankingItem.KEY_SIZE);
Log.i("JsonUtil", "size:" + string);
initialGameBean.setSize(TextUtils.isEmpty(string) ? 0L : Long.valueOf(string.toString()).longValue());
if (str.contains("complete")) {
initialGameBean.setComplete(jSONObject.getBoolean("complete"));
}
if (str.contains("type")) {
initialGameBean.setType(jSONObject.getInt("type"));
}
} catch (JSONException e) {
e.printStackTrace();
}
return initialGameBean;
}
public static void a(DownBean downBean, final Context context) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("downloadUrl", downBean.downloadUrl);
jSONObject.put("name", downBean.name);
jSONObject.put(RankingItem.KEY_SIZE, downBean.size);
jSONObject.put("threadNum", downBean.threadNum);
jSONObject.put("index", downBean.index);
jSONObject.put("filePath", downBean.filePath);
jSONObject.put("md5", downBean.md5);
jSONObject.put("type", downBean.type);
jSONObject.put(ExcellianceAppInfo.KEY_DOWNLOAD_SOURCE, downBean.downloadSource);
jSONObject.put("appId", downBean.appId);
jSONObject.put("yalp_type", downBean.yalp_type);
jSONObject.put("isGzip", downBean.isGzip);
jSONObject.put("isZip", downBean.isZip);
jSONObject.put("childType", downBean.childType);
jSONObject.put(AppExtraBean.KEY_EXTRA, downBean.extra);
jSONObject.put("downloadSubState", downBean.downloadSubState);
if (downBean.yalp_type == 5) {
jSONObject.put("split_name", downBean.split_name);
}
if (downBean.SHA != null && downBean.SHA.length > 0) {
JSONArray jSONArray = new JSONArray();
for (int i = 0; i < downBean.SHA.length; i++) {
jSONArray.put(i, (int) downBean.SHA[i]);
}
jSONObject.put("hashArray", jSONArray);
}
try {
if (downBean.versionCode > 0) {
jSONObject.put("versionCode", downBean.versionCode);
}
} catch (Exception e) {
e.printStackTrace();
}
JSONArray jSONArray2 = new JSONArray();
JSONArray jSONArray3 = new JSONArray();
for (int i2 = 0; i2 < downBean.threadNum; i2++) {
jSONArray2.put(i2, downBean.endPos[i2]);
jSONArray3.put(i2, downBean.startPos[i2]);
}
jSONObject.put("endPos", jSONArray2);
jSONObject.put("startPos", jSONArray3);
jSONObject.put("download_special_source", downBean.download_special_source);
com.excelliance.kxqp.gs.multi.a.a.a(context.getApplicationContext()).update(downBean.name, downBean.type, jSONObject.toString());
} catch (SQLiteFullException e2) {
e2.printStackTrace();
tp.i(new Runnable() {
@Override
public void run() {
Toast.makeText(context, com.excelliance.kxqp.swipe.a.a.getString(context, "no_enough_storage_space"), 0).show();
}
});
} catch (JSONException e3) {
e3.printStackTrace();
}
}
public static void a(String str, DownBean downBean) {
try {
JSONObject jSONObject = new JSONObject(str);
downBean.downloadUrl = jSONObject.getString("downloadUrl");
downBean.name = jSONObject.getString("name");
downBean.size = jSONObject.getLong(RankingItem.KEY_SIZE);
downBean.index = jSONObject.getInt("index");
downBean.filePath = jSONObject.getString("filePath");
downBean.md5 = jSONObject.getString("md5");
downBean.type = jSONObject.getInt("type");
downBean.downloadSource = jSONObject.optString(ExcellianceAppInfo.KEY_DOWNLOAD_SOURCE);
downBean.appId = jSONObject.optInt("appId");
downBean.yalp_type = jSONObject.optInt("yalp_type");
downBean.isGzip = jSONObject.optBoolean("isGzip");
downBean.split_name = jSONObject.optString("split_name");
downBean.isZip = jSONObject.optBoolean("isZip");
downBean.childType = jSONObject.optInt("childType");
downBean.extra = jSONObject.optString(AppExtraBean.KEY_EXTRA);
downBean.downloadSubState = jSONObject.optInt("downloadSubState");
JSONArray optJSONArray = jSONObject.optJSONArray("hashArray");
if (optJSONArray != null && optJSONArray.length() > 0) {
byte[] bArr = new byte[optJSONArray.length()];
for (int i = 0; i < optJSONArray.length(); i++) {
bArr[i] = Byte.valueOf(optJSONArray.optString(i)).byteValue();
}
downBean.SHA = bArr;
az.d("JsonUtil", "hash :" + Arrays.toString(bArr));
}
try {
long optLong = jSONObject.optLong("versionCode");
if (optLong > 0) {
downBean.versionCode = optLong;
}
} catch (Exception e) {
e.printStackTrace();
}
int i2 = jSONObject.getInt("threadNum");
long[] jArr = new long[i2];
long[] jArr2 = new long[i2];
JSONArray jSONArray = jSONObject.getJSONArray("startPos");
JSONArray jSONArray2 = jSONObject.getJSONArray("endPos");
for (int i3 = 0; i3 < i2; i3++) {
jArr[i3] = jSONArray2.optLong(i3);
jArr2[i3] = jSONArray.optLong(i3);
}
downBean.threadNum = i2;
downBean.startPos = jArr2;
downBean.endPos = jArr;
downBean.download_special_source = jSONObject.optInt("download_special_source");
} catch (JSONException e2) {
e2.printStackTrace();
}
}
public static void a(String str, List<DownBean> list) throws Exception {
JSONArray optJSONArray = new JSONObject(str).optJSONArray("pkgs");
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
String optString2 = optJSONObject.optString("md5");
String optString3 = optJSONObject.optString(SocialConstants.PARAM_URL);
String optString4 = optJSONObject.optString(RankingItem.KEY_VER);
try {
long parseLong = Long.parseLong(optJSONObject.optString("length"));
int parseInt = Integer.parseInt(optJSONObject.optString("ishas"));
Iterator<DownBean> it = list.iterator();
while (true) {
if (it.hasNext()) {
DownBean next = it.next();
if (next.packageName.equals(optString)) {
next.size = parseLong;
next.md5 = optString2;
next.downloadUrl = optString3;
try {
next.versionCode = Integer.valueOf(optString4).intValue();
} catch (Exception e) {
e.printStackTrace();
next.versionCode = 0L;
}
if (parseInt == 1) {
as.a(next);
} else {
next.threadNum = 1;
next.startPos = new long[]{0};
next.endPos = new long[]{next.size - 1};
}
}
}
}
} catch (Exception unused) {
}
}
}
public static AppDownLoadInfoBean a(String str, List<DownBean> list, Context context) throws Exception {
JSONArray jSONArray;
String optString;
String optString2;
long parseLong;
int parseInt;
AppDownLoadInfoBean appDownLoadInfoBean;
long j;
int i;
String str2;
String str3;
JSONArray optJSONArray = new JSONObject(str).optJSONArray("pkgs");
HashMap hashMap = new HashMap();
AppDownLoadInfoBean appDownLoadInfoBean2 = null;
int i2 = 0;
while (i2 < optJSONArray.length()) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
int optInt = optJSONObject.optInt("IsMulitApk");
String optString3 = optJSONObject.optString(WebActionRouter.KEY_PKG);
String optString4 = optJSONObject.optString(RankingItem.KEY_VER);
String optString5 = optJSONObject.optString("ishas");
if (optInt == 1) {
JSONObject optJSONObject2 = optJSONObject.optJSONObject("mulit_apk");
appDownLoadInfoBean = new AppDownLoadInfoBean();
JSONObject optJSONObject3 = optJSONObject2.optJSONObject("BASE");
String optString6 = optJSONObject3.optString("name");
parseLong = optJSONObject3.optLong("length");
optString2 = optJSONObject3.optString(SocialConstants.PARAM_URL);
optString = optJSONObject3.optString("md5");
try {
parseInt = Integer.parseInt(optString5);
Iterator<DownBean> it = list.iterator();
while (true) {
if (!it.hasNext()) {
jSONArray = optJSONArray;
str2 = null;
str3 = null;
break;
}
jSONArray = optJSONArray;
DownBean next = it.next();
Iterator<DownBean> it2 = it;
if (next.packageName.equals(optString3)) {
str3 = next.appName;
str2 = next.filePath;
break;
}
optJSONArray = jSONArray;
it = it2;
}
appDownLoadInfoBean.appName = str3;
appDownLoadInfoBean.isHas = parseInt;
appDownLoadInfoBean.versionCode = optString4;
appDownLoadInfoBean.pkg = optString3;
appDownLoadInfoBean.versionName = optJSONObject.optString(RankingItem.KEY_VER_NAME);
AppDownLoadInfoChildBean appDownLoadInfoChildBean = new AppDownLoadInfoChildBean();
appDownLoadInfoChildBean.type = "BASE";
appDownLoadInfoChildBean.name = optString6;
appDownLoadInfoChildBean.pkg = optString3;
appDownLoadInfoChildBean.md5 = optString;
appDownLoadInfoChildBean.versionCode = optString4;
appDownLoadInfoChildBean.url = optString2;
appDownLoadInfoChildBean.isHas = parseInt;
appDownLoadInfoChildBean.size = parseLong;
appDownLoadInfoChildBean.filePath = str2;
appDownLoadInfoBean.mBase = appDownLoadInfoChildBean;
JSONArray optJSONArray2 = optJSONObject2.optJSONArray("multi");
int i3 = 0;
long j2 = 0;
while (i3 < optJSONArray2.length()) {
JSONObject optJSONObject4 = optJSONArray2.optJSONObject(i3);
AppDownLoadInfoChildBean appDownLoadInfoChildBean2 = new AppDownLoadInfoChildBean();
appDownLoadInfoChildBean2.name = optJSONObject4.optString("name");
appDownLoadInfoChildBean2.size = optJSONObject4.optLong("length");
appDownLoadInfoChildBean2.type = optJSONObject4.optString("type");
appDownLoadInfoChildBean2.md5 = optJSONObject4.optString("md5");
appDownLoadInfoChildBean2.url = optJSONObject4.optString(SocialConstants.PARAM_URL);
appDownLoadInfoChildBean2.pkg = optString3;
appDownLoadInfoChildBean2.isHas = parseInt;
appDownLoadInfoChildBean2.versionCode = optString4;
j2 += appDownLoadInfoChildBean2.size;
appDownLoadInfoBean.mSplits.add(appDownLoadInfoChildBean2);
i3++;
optString = optString;
}
a(hashMap, optJSONObject, optString3);
appDownLoadInfoBean.length = parseLong + j2;
az.d("JsonUtil", "parserDownloadAppInfo appDownLoadInfoBean:" + appDownLoadInfoBean);
} catch (Exception unused) {
jSONArray = optJSONArray;
}
} else {
jSONArray = optJSONArray;
optString = optJSONObject.optString("md5");
optString2 = optJSONObject.optString(SocialConstants.PARAM_URL);
try {
parseLong = Long.parseLong(optJSONObject.optString("length"));
parseInt = Integer.parseInt(optString5);
appDownLoadInfoBean = appDownLoadInfoBean2;
} catch (Exception unused2) {
}
}
Iterator<DownBean> it3 = list.iterator();
while (true) {
if (!it3.hasNext()) {
break;
}
DownBean next2 = it3.next();
if (next2.packageName.equals(optString3)) {
next2.size = parseLong;
next2.md5 = optString;
next2.downloadUrl = optString2;
try {
next2.versionCode = Integer.valueOf(optString4).intValue();
i = 1;
j = 0;
} catch (Exception e) {
e.printStackTrace();
j = 0;
next2.versionCode = 0L;
i = 1;
}
if (parseInt == i) {
as.a(next2);
} else {
next2.threadNum = i;
long[] jArr = new long[i];
jArr[0] = j;
next2.startPos = jArr;
long[] jArr2 = new long[i];
jArr2[0] = next2.size - 1;
next2.endPos = jArr2;
}
a(hashMap, optJSONObject, optString3);
}
}
appDownLoadInfoBean2 = appDownLoadInfoBean;
i2++;
optJSONArray = jSONArray;
}
HashMap hashMap2 = new HashMap();
as.a((Map<String, GameType>) hashMap, context, (Map<String, String>) hashMap2, false);
a(hashMap, hashMap2, context);
return appDownLoadInfoBean2;
}
public static void a(Map<String, GameType> map, JSONObject jSONObject, String str) {
JSONObject optJSONObject = jSONObject.optJSONObject("gamedata");
if (optJSONObject != null) {
GameType gameType = new GameType(str);
gameType.setExt(Integer.valueOf(optJSONObject.optInt("attr")));
gameType.setMain(Integer.valueOf(optJSONObject.optInt("gametype")));
map.put(str, gameType);
}
}
public static void a(final Map<String, GameType> map, final Map<String, String> map2, final Context context) {
tp.f(new Runnable() {
@Override
public void run() {
HashSet hashSet = new HashSet();
for (Map.Entry entry : map.entrySet()) {
GameType j = au.j((String) entry.getKey());
j.setMain(((GameType) entry.getValue()).getMain());
j.setExt(((GameType) entry.getValue()).getExt());
hashSet.add(j);
}
au.a().b(context, hashSet).d(context).f(context);
Iterator it = map2.entrySet().iterator();
HashMap hashMap = new HashMap();
while (it.hasNext()) {
String str = (String) ((Map.Entry) it.next()).getValue();
az.d("JsonUtil", "checkGameTypeNative add list pkg:" + str);
if (str != null) {
int i = 0;
if (map.containsKey(str)) {
GameType gameType = (GameType) map.get(str);
if (gameType != null && gameType.getMain() != null && gameType.getMain().intValue() == 7) {
i = 1;
az.d("JsonUtil", "0 putGameType pkg:" + str + " type:1");
}
if (gameType != null && gameType.getExt() != null) {
if ((gameType.getExt().intValue() & 128) == 128) {
i |= 2;
az.d("JsonUtil", "1 putGameType pkg:" + str + " type:" + i);
}
if ((gameType.getExt().intValue() & 8192) == 8192) {
i |= 4;
az.d("JsonUtil", "2 putGameType pkg:" + str + " type:" + i);
}
if ((gameType.getExt().intValue() & 262144) == 262144) {
i |= 8;
az.d("JsonUtil", "3 putGameType pkg:" + str + " type:" + i);
}
}
}
hashMap.put(str, Integer.valueOf(i));
az.d("JsonUtil", "2 putGameType pkg:" + str + " type:" + i);
}
}
for (Map.Entry entry2 : hashMap.entrySet()) {
final String str2 = (String) entry2.getKey();
final int intValue = ((Integer) entry2.getValue()).intValue();
com.excelliance.kxqp.repository.a.a(context).a().runInTransaction(new Runnable() {
@Override
public void run() {
ExcellianceAppInfo b2 = com.excelliance.kxqp.repository.a.a(context).b(str2);
if (b2 != null) {
b2.shortcut_type = intValue;
com.excelliance.kxqp.repository.a.a(context).b(b2);
}
}
});
}
}
});
}
public static JSONArray b(String str, List<ExcellianceAppInfo> list) throws Exception {
JSONArray jSONArray = new JSONArray();
JSONArray jSONArray2 = new JSONObject(str).getJSONArray("pkgs");
for (int i = 0; i < jSONArray2.length(); i++) {
JSONObject jSONObject = jSONArray2.getJSONObject(i);
String optString = jSONObject.optString(WebActionRouter.KEY_PKG);
jSONObject.optString("md5");
String optString2 = jSONObject.optString(SocialConstants.PARAM_URL);
String optString3 = jSONObject.optString(RankingItem.KEY_VER);
try {
Long.parseLong(jSONObject.optString("length"));
Integer.parseInt(jSONObject.optString("ishas"));
int optInt = jSONObject.optInt(RankingItem.KEY_FORCEUPDATE, 0);
Iterator<ExcellianceAppInfo> it = list.iterator();
while (true) {
if (it.hasNext()) {
ExcellianceAppInfo next = it.next();
if (TextUtils.equals(next.getAppPackageName(), optString)) {
try {
if (((Integer.valueOf(optString3).intValue() > next.getVersionCode() && next.getVersionCode() > 0) || com.excelliance.kxqp.bitmap.a.a.a(optInt)) && !TextUtils.isEmpty(optString2)) {
jSONArray.put(jSONObject);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
} catch (Exception unused) {
}
}
return jSONArray;
}
public static JSONArray a(String str, Context context) throws Exception {
JSONArray jSONArray = new JSONArray();
JSONArray optJSONArray = new JSONObject(str).optJSONArray("pkgs");
if (optJSONArray != null) {
for (int i = 0; i < optJSONArray.length(); i++) {
try {
JSONObject jSONObject = optJSONArray.getJSONObject(i);
Log.d("JsonUtil", "parserUpdateObbInfo: " + jSONObject);
JSONObject optJSONObject = jSONObject.optJSONObject("main");
JSONObject optJSONObject2 = jSONObject.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
int optInt = jSONObject.optInt(RankingItem.KEY_VER);
String optString = jSONObject.optString(WebActionRouter.KEY_PKG);
int optInt2 = jSONObject.optInt("appId");
if (b.S(context) && optInt2 != 0) {
az.d("JsonUtil", "downloadObb yalp main: " + optJSONObject + " patch: " + optJSONObject2 + " versionCode: " + optInt);
com.excelliance.kxqp.gs.m.a.f b2 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(optInt2));
if (b2 != null) {
if (optJSONObject == null || b2.c()) {
az.d("JsonUtil", "parserUpdateObbInfo mainobb is null content: " + jSONObject.toString());
} else {
com.excelliance.kxqp.gs.m.a.c cVar = b2.p;
if (a(context, cVar, new File(cVar.g))) {
jSONArray.put(jSONObject);
az.d("JsonUtil", "parserUpdateObbInfo exit mainobb content: " + jSONObject);
}
}
if (optJSONObject2 == null || b2.d()) {
az.d("JsonUtil", "parserUpdateObbInfo patchobb is null content: " + jSONObject.toString());
} else {
com.excelliance.kxqp.gs.m.a.c cVar2 = b2.q;
if (a(context, cVar2, new File(cVar2.g))) {
jSONArray.put(jSONObject);
az.d("JsonUtil", "parserUpdateObbInfo exit patchobb content: " + jSONObject);
}
}
} else {
az.d("JsonUtil", "parserUpdateObbInfo yapp is null content: " + jSONObject.toString());
}
} else {
az.d("JsonUtil", "downloadObb main: " + optJSONObject + " patch: " + optJSONObject2 + " versionCode: " + optInt);
if (optJSONObject != null) {
int optInt3 = optJSONObject.optInt("obbver");
if (optInt3 > 0) {
optInt = optInt3;
}
DownBean b3 = b(optJSONObject, context, optString, "main.", optInt);
if (a(context, b3, new File(b3.filePath))) {
a(context, jSONArray, jSONObject);
}
}
if (optJSONObject2 != null) {
int optInt4 = optJSONObject.optInt("obbver");
if (optInt4 <= 0) {
optInt4 = optInt;
}
DownBean b4 = b(optJSONObject2, context, optString, "patch.", optInt4);
if (a(context, b4, new File(b4.filePath))) {
a(context, jSONArray, jSONObject);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return jSONArray;
}
private static boolean a(final Context context, final com.excelliance.kxqp.gs.m.a.c cVar, final File file) {
AppExtraBean d = com.excelliance.kxqp.util.master.e.d(context, cVar.f7206a, 0);
if (cVar.e == null) {
return false;
}
if (!file.exists() || file.length() != cVar.d) {
return true;
}
if (TextUtils.isEmpty(d.getCachedObbFileSHA(cVar.g))) {
tp.g(new Runnable() {
@Override
public void run() {
byte[] a2 = com.excelliance.kxqp.gs.m.e.e.a(file);
if (a2 != null) {
String arrays = Arrays.toString(a2);
if (TextUtils.isEmpty(arrays) || !TextUtils.equals(arrays, Arrays.toString(cVar.e))) {
return;
}
com.excelliance.kxqp.util.master.e.a(context, file, cVar.f7206a, 0, null, arrays);
}
}
});
return false;
}
return !TextUtils.equals(r0, Arrays.toString(cVar.e));
}
private static boolean a(final Context context, final DownBean downBean, final File file) {
final String str = downBean.packageName;
AppExtraBean d = com.excelliance.kxqp.util.master.e.d(context, str, 0);
if (!file.exists() || file.length() != downBean.size) {
return true;
}
if (TextUtils.isEmpty(d.getCachedObbFileMd5(downBean.filePath))) {
tp.g(new Runnable() {
@Override
public void run() {
String a2 = an.a(DownBean.this.filePath);
if (TextUtils.isEmpty(a2) || !TextUtils.equals(a2, DownBean.this.md5)) {
return;
}
com.excelliance.kxqp.util.master.e.a(context, file, str, 0, a2, null);
}
});
return false;
}
return !TextUtils.equals(r2, downBean.md5);
}
public static Map<String, JSONObject> b(String str, Context context) {
ArrayList<ExcellianceAppInfo> a2 = InitialData.a(context).a();
as.b(a2);
HashMap hashMap = new HashMap();
Iterator<ExcellianceAppInfo> it = a2.iterator();
while (it.hasNext()) {
ExcellianceAppInfo next = it.next();
if (as.h(context, next.getPath()) != 0) {
boolean a3 = bm.a(next.getAppPackageName());
if ((bs.a(next.getAppPackageName()) == -1 && TextUtils.equals(next.getGameType(), "1")) || TextUtils.equals(next.getGameType(), "5")) {
Log.d("JsonUtil", "parserUpdateObbInfoNoCompare: " + next);
if (!a3) {
if (next.getDownloadStatus() == 2) {
ProxyDelayService.a("JsonUtil", "parserUpdateObbInfoNoCompare: onging remove pkg:" + next.getAppPackageName());
} else if (next.appId != 0) {
com.excelliance.kxqp.gs.m.a.f b2 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(next.appId));
if (b2 != null && b2.f == next.getVersionCode()) {
ProxyDelayService.a("JsonUtil", "parserUpdateObbInfoNoCompare: add app:" + b2);
hashMap.put(next.getAppPackageName(), next);
} else {
StringBuilder sb = new StringBuilder();
sb.append("parserUpdateObbInfoNoCompare: vercode to low || old versioncode!=remove app:");
Object obj = b2;
if (b2 == null) {
obj = "null";
}
sb.append(obj);
ProxyDelayService.a("JsonUtil", sb.toString());
}
}
}
}
}
}
HashMap hashMap2 = new HashMap();
try {
JSONArray optJSONArray = new JSONObject(str).optJSONArray("pkgs");
if (optJSONArray != null) {
ProxyDelayService.a("JsonUtil", "parserUpdateObbInfoNoCompare: pkgs:" + optJSONArray.toString());
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject = optJSONArray.getJSONObject(i);
az.d("JsonUtil", "parserUpdateObbInfoNoCompare: " + jSONObject);
int optInt = jSONObject.optInt("appId");
String optString = jSONObject.optString(WebActionRouter.KEY_PKG);
if (optInt != 0 && hashMap.containsKey(optString)) {
com.excelliance.kxqp.gs.m.a.f b3 = com.excelliance.kxqp.gs.m.d.a.a().b(context, "appId", String.valueOf(optInt));
if (b3 == null || (b3.d() && b3.c())) {
az.d("JsonUtil", "parserUpdateObbInfoNoCompare: yapp is null or patch && main is null content:" + jSONObject);
} else {
az.d("JsonUtil", "parserUpdateObbInfoNoCompare: add content:" + jSONObject);
hashMap2.put(optString, jSONObject);
}
}
}
}
} catch (JSONException e) {
e.printStackTrace();
az.d("JsonUtil", "parserUpdateObbInfoNoCompare: json fail" + e);
}
return hashMap2;
}
public static Map<String, JSONObject> c(String str, Context context) {
HashMap hashMap = new HashMap();
try {
JSONArray optJSONArray = new JSONObject(str).optJSONArray("pkgs");
if (optJSONArray != null) {
ProxyDelayService.a("JsonUtil", "parserUpdateObbInfotoMap: pkgs:" + optJSONArray.toString());
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject = optJSONArray.getJSONObject(i);
az.d("JsonUtil", "parserUpdateObbInfotoMap: " + jSONObject);
hashMap.put(jSONObject.optString(WebActionRouter.KEY_PKG), jSONObject);
}
}
} catch (JSONException e) {
e.printStackTrace();
az.d("JsonUtil", "parserUpdateObbInfotoMap: json fail" + e);
}
return hashMap;
}
private static void a(Context context, JSONArray jSONArray, JSONObject jSONObject) {
String optString = jSONObject.optString(WebActionRouter.KEY_PKG);
JSONObject optJSONObject = jSONObject.optJSONObject("main");
JSONObject optJSONObject2 = jSONObject.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
int optInt = jSONObject.optInt(RankingItem.KEY_VER);
long j = optJSONObject != null ? b(optJSONObject, context, optString, "main.", optInt).size : 0L;
if (optJSONObject2 != null) {
j += b(optJSONObject2, context, optString, "patch.", optInt).size;
}
try {
jSONObject.put("size_desc", j);
} catch (JSONException e) {
e.printStackTrace();
}
jSONArray.put(jSONObject);
}
public static boolean a(Context context, String str, List<DownBean> list) {
boolean z = false;
try {
JSONObject optJSONObject = new JSONObject(str).optJSONObject("obb");
JSONObject optJSONObject2 = optJSONObject.optJSONObject("main");
JSONObject optJSONObject3 = optJSONObject.optJSONObject(ExcellianceAppInfo.KEY_PATCH);
int optInt = optJSONObject.optInt(RankingItem.KEY_VER);
String optString = optJSONObject.optString(WebActionRouter.KEY_PKG);
if (optJSONObject2 != null) {
int optInt2 = optJSONObject2.optInt("obbver");
if (optInt2 > 0) {
optInt = optInt2;
}
az.d("JsonUtil", "downloadObb main: " + optJSONObject2 + " patch: " + optJSONObject3 + " obbver: " + optInt);
DownBean b2 = b(optJSONObject2, context, optString, "main.", optInt);
z = TextUtils.isEmpty(b2.downloadUrl) ^ true;
list.add(b2);
}
if (optJSONObject3 != null) {
int optInt3 = optJSONObject3.optInt("obbver");
if (optInt3 <= 0) {
optInt3 = optInt;
}
DownBean b3 = b(optJSONObject3, context, optString, "patch.", optInt3);
if (!TextUtils.isEmpty(b3.downloadUrl)) {
z = true;
}
list.add(b3);
}
} catch (Exception e) {
e.printStackTrace();
}
return z;
}
public static PatchDownBean a(JSONObject jSONObject, Context context, String str, String str2, int i) {
PatchDownBean patchDownBean = new PatchDownBean();
DownBean a2 = a(patchDownBean, jSONObject, context, str, str2, i);
a2.name += PatchDownBean.KEY_SUFFIX;
a2.filePath += PatchDownBean.KEY_SUFFIX;
if (jSONObject != null) {
patchDownBean.oldMd5 = jSONObject.optString(PatchDownBean.KEY_OLD_MD5);
}
if (a2 == patchDownBean) {
return patchDownBean;
}
return null;
}
public static DownBean b(JSONObject jSONObject, Context context, String str, String str2, int i) {
return a(new DownBean(), jSONObject, context, str, str2, i);
}
public static DownBean a(DownBean downBean, JSONObject jSONObject, Context context, String str, String str2, int i) {
Integer num;
if (downBean == null) {
downBean = new DownBean();
}
String optString = jSONObject.optString("ishas");
downBean.packageName = str;
downBean.name = str2 + i + "." + str;
downBean.type = 4;
downBean.downloadUrl = jSONObject.optString(SocialConstants.PARAM_URL);
downBean.size = jSONObject.optLong("length");
downBean.md5 = jSONObject.optString("md5");
downBean.versionCode = (long) i;
int optInt = jSONObject.optInt("obbver");
if (optInt > 0) {
downBean.versionCode = optInt;
}
try {
num = Integer.valueOf(optString);
} catch (Exception unused) {
num = 1;
}
if (num.intValue() == 1) {
as.a(downBean);
} else {
downBean.threadNum = 1;
downBean.startPos = new long[]{0};
downBean.endPos = new long[]{downBean.size - 1};
}
String c = bn.c(context, str);
if (!new File(c).exists()) {
new File(c).mkdirs();
}
downBean.filePath = c + downBean.name + ResponseData.KEY_OBB_SUFFIX;
JSONObject optJSONObject = jSONObject.optJSONObject(PatchDownBean.KEY_SELF);
if (optJSONObject != null) {
downBean.patchDownBean = a(optJSONObject, context, str, str2, i);
if (downBean.patchDownBean != null) {
downBean.patchDownBean.targetObb = downBean;
}
}
return downBean;
}
private static List<ReginBean> a(JSONObject jSONObject) {
ArrayList arrayList = new ArrayList();
if (jSONObject == null || jSONObject.optInt("status") != 1) {
return arrayList;
}
try {
JSONArray optJSONArray = jSONObject.optJSONArray("iptarget");
if (optJSONArray != null && optJSONArray.length() > 0) {
int length = optJSONArray.length();
for (int i = 0; i < length; i++) {
ReginBean reginBean = new ReginBean();
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
reginBean.pri = optJSONObject.optInt("pri");
reginBean.aTry = optJSONObject.optInt("try");
JSONObject optJSONObject2 = optJSONObject.optJSONObject("route");
reginBean.ip = optJSONObject2.optString("ip");
reginBean.key = optJSONObject2.optString("key");
reginBean.port = optJSONObject2.optString(ClientCookie.PORT_ATTR);
reginBean.pwd = optJSONObject2.optString("up");
reginBean.outUp = jSONObject.optString("outUp");
a(optJSONObject2.optString(GameType.TYPE_KEY_EXT), reginBean);
arrayList.add(reginBean);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return arrayList;
}
private static void a(String str, ReginBean reginBean) {
if (TextUtils.isEmpty(str)) {
return;
}
try {
JSONObject jSONObject = new JSONObject(bp.a(str, "fuck_snsslmm_bslznw", "utf-8"));
reginBean.extIp = jSONObject.optString(com.umeng.analytics.pro.am.aC);
reginBean.extPort = jSONObject.optInt("p");
reginBean.extUsr = jSONObject.optString(com.umeng.analytics.pro.am.aG);
reginBean.extPwd = jSONObject.optString(com.umeng.analytics.pro.am.aB);
reginBean.extType = jSONObject.optInt(com.umeng.analytics.pro.am.aH);
} catch (JSONException e) {
e.printStackTrace();
}
}
public static LoginAreaBean g(String str) {
if (!TextUtils.isEmpty(str)) {
try {
return (LoginAreaBean) new Gson().a(str, new TypeToken<LoginAreaBean>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
public static DownloadAreaBean h(String str) {
if (!TextUtils.isEmpty(str)) {
try {
return (DownloadAreaBean) new Gson().a(str, new TypeToken<DownloadAreaBean>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
public static AppAreaBean i(String str) {
AppAreaBean appAreaBean = new AppAreaBean();
if (!TextUtils.isEmpty(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
JSONArray optJSONArray = jSONObject.optJSONArray("all_area");
ArrayList arrayList = new ArrayList();
if (optJSONArray != null && optJSONArray.length() > 0) {
az.d("JsonUtil", "getStartAppArea jsonArray_all:" + optJSONArray.toString());
for (int i = 0; i < optJSONArray.length(); i++) {
String optString = optJSONArray.optString(i);
if (!cd.a(optString)) {
arrayList.add(optString);
}
}
}
try {
JSONObject optJSONObject = jSONObject.optJSONObject(AppExtraBean.KEY_AREA);
JSONObject optJSONObject2 = optJSONObject.optJSONObject("vip");
JSONObject optJSONObject3 = optJSONObject.optJSONObject(AdPlatBeanResult.COMMON);
appAreaBean.vipConfig = new AppAreaBean.AreaConfig();
appAreaBean.vipConfig.s1 = a(optJSONObject2, "s1");
appAreaBean.vipConfig.s2 = a(optJSONObject2, "s2");
appAreaBean.commonConfig = new AppAreaBean.AreaConfig();
appAreaBean.commonConfig.s1 = a(optJSONObject3, "s1");
appAreaBean.commonConfig.s2 = a(optJSONObject3, "s2");
} catch (Exception e) {
e.printStackTrace();
}
try {
JSONObject optJSONObject4 = jSONObject.optJSONObject("areaMap");
JSONObject optJSONObject5 = optJSONObject4.optJSONObject("vip");
JSONObject optJSONObject6 = optJSONObject4.optJSONObject(AdPlatBeanResult.COMMON);
appAreaBean.vipConfigLogin = new AppAreaBean.LoginAreaConfig();
appAreaBean.vipConfigLogin.s1 = b(optJSONObject5, "s1");
appAreaBean.vipConfigLogin.s2 = b(optJSONObject5, "s2");
appAreaBean.commonConfigLogin = new AppAreaBean.LoginAreaConfig();
appAreaBean.commonConfigLogin.s1 = b(optJSONObject6, "s1");
appAreaBean.commonConfigLogin.s2 = b(optJSONObject6, "s2");
} catch (Exception e2) {
e2.printStackTrace();
}
String optString2 = jSONObject.optString("pkgname");
int optInt = jSONObject.optInt(AppAreaBean.LIMIT_FREE);
int optInt2 = jSONObject.optInt("check_res");
appAreaBean.pkg = optString2;
appAreaBean.areas_all = arrayList;
appAreaBean.limitFree = optInt;
appAreaBean.check = optInt2;
} catch (Exception e3) {
e3.printStackTrace();
az.d("JsonUtil", "getProxyArea/ex:" + e3);
}
}
return appAreaBean;
}
public static void a(String str, List<String> list, Context context, Map<String, String> map) {
if (TextUtils.isEmpty(str)) {
return;
}
try {
JSONObject optJSONObject = new JSONObject(str).optJSONObject("game");
if (optJSONObject != null) {
by a2 = by.a(context, "sp_native_unable_and_native_install_app_gametype");
for (String str2 : list) {
JSONObject optJSONObject2 = optJSONObject.optJSONObject(str2);
if (optJSONObject2 != null) {
az.d("JsonUtil", " parserGameTypeUnableAndNativeInstallNative pkg:" + str2 + " libNameObject:" + optJSONObject2.toString());
if (map != null && map.size() > 0 && map.containsKey(str2)) {
String str3 = map.get(str2);
az.d("JsonUtil", " parserGameTypeUnableAndNativeInstallNative sign:" + str3 + " pkg:" + str2);
if (!cd.a(str3)) {
az.d("JsonUtil", " parserGameTypeUnableAndNativeInstallNative put sign:" + str3 + " pkg:" + str2);
optJSONObject2.put("sign_native", str3);
a2.a(str2, optJSONObject2.toString());
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
az.d("JsonUtil", " parserGameTypeUnableAndNativeInstallNative error content:" + str);
}
}
public static UnableAndNativeInstallVpnResultBean a(String str, Context context, String str2) {
UnableAndNativeInstallVpnResultBean unableAndNativeInstallVpnResultBean = new UnableAndNativeInstallVpnResultBean();
if (!cd.a(str2)) {
try {
JSONObject jSONObject = new JSONObject(str2);
az.d("JsonUtil", "parserGameTypeUnableAndNativeInstallNativeSp content: " + str2);
String g = cd.g(bs.c(context, GameUtil.getIntance().l(context, str)));
String optString = jSONObject.optString("sign_native");
az.d("JsonUtil", "parserGameTypeUnableAndNativeInstallNativeSp sign: " + g + " sign_Native:" + optString + "pkg:" + str);
if (g != null && optString != null && g.equals(optString)) {
int optInt = jSONObject.optInt("gametype");
int a2 = au.a(str, jSONObject.optJSONObject("recheck"), context);
az.d("JsonUtil", "parserGameTypeUnableAndNativeInstallNativeSp recheckGameType: " + a2 + " gametype:" + optInt);
if (a2 < 0) {
if (jSONObject.has("recheck")) {
az.d("JsonUtil", "parserGameTypeUnableAndNativeInstallNativeSp/crack version: ");
unableAndNativeInstallVpnResultBean.crackType = 153;
}
a2 = optInt;
}
unableAndNativeInstallVpnResultBean.gameType = Integer.valueOf(a2);
unableAndNativeInstallVpnResultBean.checkType = 1;
} else {
unableAndNativeInstallVpnResultBean.checkType = 3;
}
} catch (Exception e) {
e.printStackTrace();
unableAndNativeInstallVpnResultBean.checkType = 3;
az.d("JsonUtil", " parserGameTypeUnableAndNativeInstallNativeSp error content:" + str2);
}
} else {
unableAndNativeInstallVpnResultBean.checkType = 3;
}
return unableAndNativeInstallVpnResultBean;
}
public static List<String> a(JSONObject jSONObject, String str) {
ArrayList arrayList = new ArrayList();
if (jSONObject != null) {
try {
JSONArray optJSONArray = jSONObject.optJSONArray(str);
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
arrayList.add(optJSONArray.optString(i));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return arrayList;
}
public static List<AppAreaBean.LoginNodeConfig> b(JSONObject jSONObject, String str) {
ArrayList arrayList = new ArrayList();
if (jSONObject != null) {
try {
JSONArray optJSONArray = jSONObject.optJSONArray(str);
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
AppAreaBean.LoginNodeConfig j = j(optJSONArray.optString(i));
if (j != null) {
arrayList.add(j);
} else {
az.d("JsonUtil", " parseLoginAreaConfigList null LoginNodeConfig");
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return arrayList;
}
public static AppAreaBean.LoginNodeConfig j(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
AppAreaBean.LoginNodeConfig loginNodeConfig = new AppAreaBean.LoginNodeConfig();
try {
JSONObject jSONObject = new JSONObject(str);
loginNodeConfig.server = jSONObject.optString("server", "");
loginNodeConfig.gameNode = jSONObject.optString("gameNode", "");
JSONObject jSONObject2 = new JSONObject(jSONObject.optString("loginIp", ""));
loginNodeConfig.ipPort = new AppAreaBean.LoginIpPort();
loginNodeConfig.ipPort.id = jSONObject2.optString("id", "");
loginNodeConfig.ipPort.ip = jSONObject2.optString("ip", "");
loginNodeConfig.ipPort.port = jSONObject2.optInt(ClientCookie.PORT_ATTR, 0);
loginNodeConfig.ipPort.key = jSONObject2.optString("key", "");
loginNodeConfig.ipPort.up = jSONObject2.optString("up", "");
loginNodeConfig.ipPort.outUp = jSONObject2.optString("outUp", "");
} catch (Exception e) {
e.printStackTrace();
}
if (TextUtils.isEmpty(loginNodeConfig.gameNode)) {
return null;
}
return loginNodeConfig;
}
public static List<TextFeature> k(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
try {
ArrayList arrayList = new ArrayList();
JSONArray jSONArray = new JSONArray(str);
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
TextFeature textFeature = new TextFeature();
textFeature.title = optJSONObject.optString("title");
textFeature.content = optJSONObject.optString("content");
arrayList.add(textFeature);
}
return arrayList;
} catch (Exception e) {
az.e("JsonUtil", "ex:" + e);
return null;
}
}
public static List<PermissionBean> l(String str) {
ArrayList arrayList = new ArrayList();
if (!cd.a(str)) {
az.d("JsonUtil", "getPermissions/permissions:" + str);
try {
JSONArray jSONArray = new JSONArray(str);
if (jSONArray.length() > 0) {
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
PermissionBean permissionBean = new PermissionBean();
String optString = optJSONObject.optString(AppAreaBean.PERMISSION_KEY);
String optString2 = optJSONObject.optString(AppAreaBean.PERMISSION_NAME);
String optString3 = optJSONObject.optString(AppAreaBean.PERMISSION_CONTENT);
boolean optBoolean = optJSONObject.optBoolean(AppAreaBean.PERMISSION_GRANT);
boolean optBoolean2 = optJSONObject.optBoolean(AppAreaBean.PERMISSION_RATIONALE);
boolean optBoolean3 = optJSONObject.optBoolean(AppAreaBean.PERMISSION_FORCE);
permissionBean.key = optString;
permissionBean.name = optString2;
permissionBean.content = optString3;
permissionBean.grant = optBoolean;
permissionBean.rationale = optBoolean2;
permissionBean.force = optBoolean3;
arrayList.add(permissionBean);
}
}
} else {
az.d("JsonUtil", "getPermissions/jsonArray is null");
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return arrayList;
}
public static GameType a(Context context, GameAttrsResponse.PkgsBean pkgsBean, GameAttrsRequest gameAttrsRequest) {
az.i("JsonUtil", "parserGameTypeList() called with: thread = 【" + Thread.currentThread() + "】, context = 【" + context + "】, pkgBean = 【" + pkgsBean + "】, request = 【" + gameAttrsRequest + "】");
GameType gameType = new GameType(pkgsBean.getPkg());
if (pkgsBean == null) {
return gameType;
}
gameType.setExt(Integer.valueOf(a(pkgsBean.getAttr(), 0)));
if (b(pkgsBean.getVmType(), 0) >= 0) {
gameType.setTransmitvm(Long.valueOf(b(pkgsBean.getVmType(), 0)));
}
if (b(pkgsBean.getVmFlagCanCheck(), 0) >= 0) {
gameType.setVmFlagCanCheck(Long.valueOf(b(pkgsBean.getVmFlagCanCheck(), 0)));
}
JSONObject jSONObject = null;
try {
if (!TextUtils.isEmpty(pkgsBean.getRecheck())) {
jSONObject = new JSONObject(pkgsBean.getRecheck());
}
} catch (JSONException e) {
e.printStackTrace();
}
au.a();
int a2 = au.a(pkgsBean.getPkg(), jSONObject, context, gameAttrsRequest);
az.d("JsonUtil", "parserGameTypeToMap recheckGameType: " + a2);
int a3 = a(pkgsBean.getGametype(), 0);
if (a3 > 0) {
gameType.setOriginMain(Integer.valueOf(a3));
}
if (a2 < 0) {
if (!cd.a(pkgsBean.getRecheck())) {
Log.d("JsonUtil", "parserGameTypeToMap/crack version: ");
gameType.setCrack(153);
}
a2 = a3;
}
if ((a2 & 16) == 16 && TextUtils.equals("5", at.b(context, pkgsBean.getPkg()))) {
a2 &= 15;
}
if (a2 >= 0) {
gameType.setMain(Integer.valueOf(a2));
}
int a4 = a(pkgsBean.getSignCheckFail(), 0);
if (a4 > 0) {
gameType.setSignCheckFail(Integer.valueOf(a4));
}
if (pkgsBean.getOnline() > 0) {
gameType.setOnline(Integer.valueOf(pkgsBean.getOnline()));
}
if (gameAttrsRequest.imported() && !gameAttrsRequest.fromSdCard()) {
Integer main = gameType.getMain();
az.d("JsonUtil", "checkGameType libName: " + gameType.getPackageName() + " type: " + main);
if (main != null && (main.intValue() & 16) == 16) {
Integer valueOf = Integer.valueOf(main.intValue() & 15);
az.d("JsonUtil", String.format("GameTypeHelper/checkGameType:thread(%s) after clear type(%s)", Thread.currentThread().getName(), valueOf));
if (valueOf.intValue() >= 0) {
gameType.setMain(valueOf);
}
} else {
gameType.setMain(main);
}
}
az.i("JsonUtil", "JsonUtil/parserGameTypeList() gameType: gameType = 【" + gameType + "】");
return gameType;
}
public static GameType a(GameAttrsResponse.PkgsBean pkgsBean) {
GameType gameType = new GameType(pkgsBean.getPkg());
if (pkgsBean == null) {
return gameType;
}
int a2 = a(pkgsBean.getAttr(), 0);
int a3 = a(pkgsBean.getGametype(), 0);
gameType.setAccelerate(Integer.valueOf(pkgsBean.getAccelerate()));
if (a2 >= 0) {
gameType.setExt(Integer.valueOf(a2));
}
if (a3 >= 0) {
gameType.setMain(Integer.valueOf(a3));
}
return gameType;
}
public static Map<String, Integer> m(String str) {
HashMap hashMap = new HashMap();
if (!cd.a(str)) {
az.d("JsonUtil", "getVirtualOrder/str:" + str);
try {
JSONArray jSONArray = new JSONArray(str);
if (jSONArray.length() > 0) {
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
String optString = optJSONObject.optString("key");
int optInt = optJSONObject.optInt("value");
if (!cd.a(optString)) {
hashMap.put(optString, Integer.valueOf(optInt));
}
}
}
} else {
az.d("JsonUtil", "getVirtualOrder/jsonArray is null");
}
} catch (JSONException e) {
az.d("JsonUtil", "getVirtualOrder/json is exception");
e.printStackTrace();
}
} else {
az.d("JsonUtil", "getVirtualOrder/str is null");
}
return hashMap;
}
public static Map<String, Integer> a(Context context) {
String b2 = by.a(context, "sp_total_info").b("fgo_wait_for_import_pkg", "");
Log.d("JsonUtil", "refreshWaitForImportPkg pkgs: " + b2);
HashMap hashMap = new HashMap();
if (TextUtils.isEmpty(b2)) {
return hashMap;
}
try {
JSONArray jSONArray = new JSONArray(b2);
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (optJSONObject != null) {
hashMap.put(optJSONObject.optString(WebActionRouter.KEY_PKG), Integer.valueOf(optJSONObject.optInt(ClientCookie.VERSION_ATTR)));
}
}
return hashMap;
} catch (JSONException e) {
e.printStackTrace();
return hashMap;
}
}
public static void a(Map<String, Integer> map, Context context) {
String jSONArray;
if (map == null) {
return;
}
if (map.size() > 0) {
try {
JSONArray jSONArray2 = new JSONArray();
int i = 0;
for (String str : map.keySet()) {
JSONObject jSONObject = new JSONObject();
jSONObject.put(WebActionRouter.KEY_PKG, str);
jSONObject.put(ClientCookie.VERSION_ATTR, map.get(str));
jSONArray2.put(i, jSONObject);
i++;
}
jSONArray = jSONArray2.toString();
} catch (JSONException e) {
e.printStackTrace();
Log.d("JsonUtil", "GameTypeHelper saveWaitForImportPkgs: " + e.getMessage());
}
Log.d("JsonUtil", "GameTypeHelper saveWaitForImportPkgs: " + jSONArray);
by.a(context, "sp_total_info").a("fgo_wait_for_import_pkg", jSONArray);
}
jSONArray = "";
Log.d("JsonUtil", "GameTypeHelper saveWaitForImportPkgs: " + jSONArray);
by.a(context, "sp_total_info").a("fgo_wait_for_import_pkg", jSONArray);
}
public static List<CardReginBean> n(String str) {
ArrayList arrayList = new ArrayList();
if (TextUtils.isEmpty(str)) {
return arrayList;
}
Log.d("JsonUtil", "parserCardRegin CardReginBean: " + str);
try {
JSONArray optJSONArray = new JSONObject(str).optJSONArray("regins");
if (optJSONArray != null && optJSONArray.length() > 0) {
int length = optJSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
if (optJSONObject != null) {
CardReginBean cardReginBean = new CardReginBean();
String optString = optJSONObject.optString("name");
int optInt = optJSONObject.optInt("state");
String optString2 = optJSONObject.optString("link");
cardReginBean.setName(optString);
cardReginBean.setState(optInt);
cardReginBean.setImgurl(optString2);
JSONArray optJSONArray2 = optJSONObject.optJSONArray("card");
if (optJSONArray2 != null && optJSONArray2.length() > 0) {
int length2 = optJSONArray2.length();
ArrayList arrayList2 = new ArrayList();
for (int i2 = 0; i2 < length2; i2++) {
JSONObject optJSONObject2 = optJSONArray2.optJSONObject(i2);
CardBean cardBean = new CardBean();
cardBean.setName(optJSONObject2.optString("name"));
cardBean.setMoney(optJSONObject2.optDouble("money"));
cardBean.setNumber(optJSONObject2.optInt("number"));
cardBean.setCid(optJSONObject2.optInt("cid"));
cardBean.setState(optInt == 0 ? 0 : optJSONObject2.optInt("state"));
arrayList2.add(cardBean);
}
cardReginBean.setCard(arrayList2);
}
arrayList.add(cardReginBean);
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return arrayList;
}
public static boolean o(String str) {
try {
if (TextUtils.isEmpty(str)) {
return false;
}
return new JSONObject(str).optBoolean("allow");
} catch (JSONException e) {
e.printStackTrace();
return false;
}
}
public static MyCardBean p(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
az.d("JsonUtil", "parserMyCardBean myCardInfo: " + str);
MyCardBean myCardBean = new MyCardBean();
try {
JSONObject jSONObject = new JSONObject(str);
myCardBean.setQq(jSONObject.optString("qq"));
JSONArray optJSONArray = jSONObject.optJSONArray("successList");
ArrayList arrayList = new ArrayList();
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i);
SuccessBean successBean = new SuccessBean();
successBean.setBuyTime(optJSONObject.optLong("buyTime") * 1000);
successBean.setCardCode(optJSONObject.optString("cardCode"));
successBean.setFace(optJSONObject.optDouble("face"));
successBean.setFaceValue(optJSONObject.optString("faceValue"));
successBean.setName(optJSONObject.optString("name"));
arrayList.add(successBean);
}
}
myCardBean.setSuccessList(arrayList);
JSONArray optJSONArray2 = jSONObject.optJSONArray("failList");
ArrayList arrayList2 = new ArrayList();
if (optJSONArray2 != null && optJSONArray2.length() > 0) {
for (int i2 = 0; i2 < optJSONArray2.length(); i2++) {
JSONObject optJSONObject2 = optJSONArray2.optJSONObject(i2);
FailureBean failureBean = new FailureBean();
failureBean.setBuyTime(optJSONObject2.optLong("buyTime") * 1000);
failureBean.setNum(optJSONObject2.optInt("num"));
failureBean.setFace(optJSONObject2.optDouble("face"));
failureBean.setFaceValue(optJSONObject2.optString("faceValue"));
failureBean.setName(optJSONObject2.optString("name"));
arrayList2.add(failureBean);
}
}
myCardBean.setFailList(arrayList2);
} catch (JSONException e) {
e.printStackTrace();
}
return myCardBean;
}
public static GAccountCombineBean a(String str, GGAccBean gGAccBean) {
GAccountCombineBean gAccountCombineBean = new GAccountCombineBean();
if (TextUtils.isEmpty(str) || gGAccBean == null) {
return gAccountCombineBean;
}
try {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("data")) {
JSONObject optJSONObject = jSONObject.optJSONObject("data");
gAccountCombineBean.allow = gGAccBean.isAllow();
gAccountCombineBean.type = optJSONObject.optInt("type");
gAccountCombineBean.permax = gGAccBean.getPermax();
gAccountCombineBean.totalmax = gGAccBean.getTotalmax();
gAccountCombineBean.goodsId = optJSONObject.optInt("goodsid");
gAccountCombineBean.combination_title = optJSONObject.optString("combination_title");
gAccountCombineBean.combination_price = optJSONObject.optDouble("combination_price");
gAccountCombineBean.combination_original = optJSONObject.optString("combination_original");
gAccountCombineBean.combination_day_price = optJSONObject.optString("combination_day_price");
return gAccountCombineBean;
}
} catch (Exception e) {
e.printStackTrace();
}
return gAccountCombineBean;
}
public static com.excelliance.kxqp.gs.ui.gaccount.c a(Context context, String str) {
com.excelliance.kxqp.gs.ui.gaccount.c cVar = new com.excelliance.kxqp.gs.ui.gaccount.c();
ArrayList arrayList = new ArrayList();
cVar.a(arrayList);
if (TextUtils.isEmpty(str)) {
return cVar;
}
try {
JSONObject jSONObject = new JSONObject(str);
JSONArray optJSONArray = jSONObject.optJSONArray("account");
if (optJSONArray != null && optJSONArray.length() > 0) {
int length = optJSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
if (jSONObject2 != null) {
String optString = jSONObject2.optString("user");
String optString2 = jSONObject2.optString("pwd");
long optLong = jSONObject2.optLong("time") * 1000;
boolean optBoolean = jSONObject2.optBoolean("success");
com.excelliance.kxqp.gs.ui.gaccount.b bVar = new com.excelliance.kxqp.gs.ui.gaccount.b(optString, optString2, jSONObject2.optString("email"), optLong, optBoolean, jSONObject2.optString(AdPlatBeanResult.FIRST), jSONObject2.optString("last"), jSONObject2.optInt("is_replace_period"));
bVar.a(optBoolean);
arrayList.add(bVar);
}
}
}
String optString3 = jSONObject.optString("qq");
String optString4 = jSONObject.optString("qgk", "H8Qe-TgUgfVfPQrfSUxdthmbHWkxoh5v");
int optInt = jSONObject.optInt("bind");
String optString5 = jSONObject.optString("notice");
cVar.b(optString3);
cVar.a(optString4);
cVar.a(optInt);
cVar.c(optString5);
if (!TextUtils.isEmpty(optString3) && context != null) {
by.a(context, "sp_total_info").a("google_account_sell_qq", optString3);
by.a(context, "sp_total_info").a("google_account_sell_qq_qgk", optString4);
}
} catch (JSONException e) {
e.printStackTrace();
}
return cVar;
}
public static List<UpFileLoadBean> q(String str) {
JSONArray optJSONArray;
ArrayList arrayList = new ArrayList();
if (!TextUtils.isEmpty(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
jSONObject.optInt("code");
if (TextUtils.equals(jSONObject.optString("msg"), "success") && (optJSONArray = jSONObject.optJSONArray("data")) != null) {
int length = optJSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject jSONObject2 = optJSONArray.getJSONObject(i);
if (jSONObject2 != null) {
UpFileLoadBean upFileLoadBean = new UpFileLoadBean(jSONObject2.optString("action"), jSONObject2.optString("filename"), jSONObject2.optString(WebActionRouter.KEY_PKG), jSONObject2.optString("token"), jSONObject2.optString(com.alipay.sdk.cons.c.f));
if (upFileLoadBean.isUsable()) {
arrayList.add(upFileLoadBean);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return arrayList;
}
public static List<String> b(Context context, String str) {
JSONArray optJSONArray;
ArrayList arrayList = new ArrayList();
try {
if (!TextUtils.isEmpty(str) && (optJSONArray = new JSONObject(str).optJSONArray("prestart")) != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject = optJSONArray.getJSONObject(i);
if (jSONObject != null) {
String optString = jSONObject.optString("name");
if (!TextUtils.isEmpty(optString)) {
arrayList.add(optString);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return arrayList;
}
public static List<String> c(Context context, String str) {
JSONArray optJSONArray;
ArrayList arrayList = new ArrayList();
try {
if (!TextUtils.isEmpty(str) && (optJSONArray = new JSONObject(str).optJSONArray("allowinnerinstall")) != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
JSONObject jSONObject = optJSONArray.getJSONObject(i);
if (jSONObject != null) {
String optString = jSONObject.optString("name");
if (!TextUtils.isEmpty(optString)) {
arrayList.add(optString);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return arrayList;
}
public static String d(String str, Context context) {
try {
if (TextUtils.isEmpty(str)) {
return null;
}
return new JSONObject(str).optString("gpDownload");
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static List<ReginBean> a(JSONArray jSONArray, String str) {
az.i("JsonUtil", "JsonUtil/parserProxyConfig() called with: thread = 【" + Thread.currentThread() + "】, target = 【" + jSONArray + "】, cityId = 【" + str + "】");
ArrayList arrayList = new ArrayList();
if (jSONArray == null) {
return arrayList;
}
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject jSONObject = (JSONObject) jSONArray.opt(i);
if (jSONObject != null && !TextUtils.isEmpty(str)) {
ReginBean reginBean = new ReginBean();
a(reginBean, str, jSONObject);
arrayList.add(reginBean);
}
}
return arrayList;
}
public static void a(ReginBean reginBean, String str, JSONObject jSONObject) {
reginBean.id = str;
reginBean.region = jSONObject.optString("region");
reginBean.avail = jSONObject.optInt("avail");
reginBean.ip = jSONObject.optString("ip");
reginBean.key = jSONObject.optString("key");
if (aq.v() || aq.e()) {
reginBean.pwd = jSONObject.optString("pwd");
} else {
reginBean.pwd = jSONObject.optString("up");
}
reginBean.outUp = jSONObject.optString("outUp");
reginBean.port = jSONObject.optString(ClientCookie.PORT_ATTR);
reginBean.sort = jSONObject.optInt("sort");
reginBean.is_hide = jSONObject.optInt("is_hide");
reginBean.user = jSONObject.optString("user");
reginBean.groupid = jSONObject.optString("groupid");
reginBean.vipgroup = jSONObject.optInt("vipgroup");
reginBean.supportKcp = jSONObject.optInt("supportKcp");
reginBean.spareProxyId = jSONObject.optString("spareProxyId");
}
public static List<ReginBean> r(String str) {
az.i("JsonUtil", "JsonUtil/parserRegisterProxyBean() called with: thread = 【" + Thread.currentThread() + "】, config = 【" + str + "】");
ArrayList arrayList = new ArrayList();
if (TextUtils.isEmpty(str)) {
return arrayList;
}
try {
return a(new JSONObject(str));
} catch (Exception e) {
e.printStackTrace();
return arrayList;
}
}
public static LastSaveProxyInfo d(Context context, String str) {
String b2 = by.a(context, "sp_game_proxy_bind_info").b("sp_key_game_proxy_and_other_proxy_bind_info", "");
az.d("JsonUtil", "getLastGameProxyAllInfo proxyInfo:" + b2 + " areaId:" + str);
LastSaveProxyInfo lastSaveProxyInfo = new LastSaveProxyInfo();
lastSaveProxyInfo.arearId = str;
if (TextUtils.isEmpty(b2)) {
return lastSaveProxyInfo;
}
try {
JSONObject jSONObject = new JSONObject(b2);
lastSaveProxyInfo.dareaInfo = jSONObject.optString(str);
JSONObject optJSONObject = jSONObject.optJSONObject("download_area_info");
if (optJSONObject != null) {
lastSaveProxyInfo.downloadAreaInfo = optJSONObject.optString(str);
}
} catch (JSONException e) {
e.printStackTrace();
}
az.d("JsonUtil", "getLastGameProxyAllInfo proxyInfo:" + b2);
return lastSaveProxyInfo;
}
public static void a(Context context, LastSaveProxyInfo lastSaveProxyInfo) {
JSONObject jSONObject;
String b2 = by.a(context, "sp_game_proxy_bind_info").b("sp_key_game_proxy_and_other_proxy_bind_info", "");
az.d("JsonUtil", "putLastGameProxyAllInfo proxyInfo:" + b2 + " lastSaveProxyInfo:" + lastSaveProxyInfo);
try {
new JSONObject();
if (TextUtils.isEmpty(b2)) {
jSONObject = new JSONObject();
jSONObject.put(lastSaveProxyInfo.arearId, lastSaveProxyInfo.dareaInfo);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put(lastSaveProxyInfo.arearId, lastSaveProxyInfo.downloadAreaInfo);
jSONObject.put("download_area_info", jSONObject2);
} else {
JSONObject jSONObject3 = new JSONObject(b2);
jSONObject3.put(lastSaveProxyInfo.arearId, lastSaveProxyInfo.dareaInfo);
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put(lastSaveProxyInfo.arearId, lastSaveProxyInfo.downloadAreaInfo);
jSONObject3.put("download_area_info", jSONObject4);
jSONObject = jSONObject3;
}
az.d("JsonUtil", "putLastGameProxyAllInfo jsonObject:" + jSONObject.toString());
by.a(context, "sp_game_proxy_bind_info").a("sp_key_game_proxy_and_other_proxy_bind_info", jSONObject.toString());
} catch (JSONException e) {
e.printStackTrace();
}
}
public static String a(LoginAreaBean loginAreaBean) {
String a2;
if (loginAreaBean != null) {
try {
a2 = new Gson().a(loginAreaBean);
} catch (Exception e) {
e.printStackTrace();
}
Log.d("JsonUtil", "strGameDArea dAreaStr:" + a2);
return a2;
}
a2 = null;
Log.d("JsonUtil", "strGameDArea dAreaStr:" + a2);
return a2;
}
public static String a(DownloadAreaBean downloadAreaBean) {
String a2;
if (downloadAreaBean != null) {
try {
a2 = new Gson().a(downloadAreaBean);
} catch (Exception e) {
e.printStackTrace();
}
Log.d("JsonUtil", "strGameDownloadArea dAreaStr:" + a2);
return a2;
}
a2 = null;
Log.d("JsonUtil", "strGameDownloadArea dAreaStr:" + a2);
return a2;
}
public static String a(ReginBean reginBean) {
String a2;
if (reginBean != null) {
try {
a2 = new Gson().a(reginBean);
} catch (Exception e) {
e.printStackTrace();
}
az.d("JsonUtil", "strReginBean reginBeanStr:" + a2);
return a2;
}
a2 = null;
az.d("JsonUtil", "strReginBean reginBeanStr:" + a2);
return a2;
}
public static ReginBean s(String str) {
ReginBean reginBean;
if (!TextUtils.isEmpty(str)) {
try {
reginBean = (ReginBean) new Gson().a(str, new TypeToken<ReginBean>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
}
az.d("JsonUtil", "getReginBean reginBean:" + reginBean);
return reginBean;
}
reginBean = null;
az.d("JsonUtil", "getReginBean reginBean:" + reginBean);
return reginBean;
}
public static ResourcesDownloadInfo t(String str) {
ResourcesDownloadInfo resourcesDownloadInfo;
if (!TextUtils.isEmpty(str)) {
try {
resourcesDownloadInfo = (ResourcesDownloadInfo) new Gson().a(str, new TypeToken<ResourcesDownloadInfo>() {
}.getType());
} catch (Exception e) {
e.printStackTrace();
}
az.d("JsonUtil", "getAppResourcesInfo resourcesInfo:" + resourcesDownloadInfo);
return resourcesDownloadInfo;
}
resourcesDownloadInfo = null;
az.d("JsonUtil", "getAppResourcesInfo resourcesInfo:" + resourcesDownloadInfo);
return resourcesDownloadInfo;
}
}