OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

以下内容为反编译后的 b.java 源代码,内容仅作参考


package com.excelliance.game.collection.search.result;

import android.content.Context;
import com.excelliance.game.collection.bean.CollectionSearchGameBean;
import com.excelliance.game.collection.search.result.a;
import com.excelliance.kxqp.bitmap.bean.RankingItem;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.sdk.StatisticsBase;
import com.excelliance.kxqp.util.a.d;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import org.apache.http.HttpHeaders;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class b implements a.InterfaceC0083a {

    private Context f2067a;

    private a.b f2068b;

    @Override
    public void a() {
    }

    public b(Context context, a.b bVar) {
        this.f2067a = context;
        this.f2068b = bVar;
    }

    public void a(final String str) {
        tp.f(new Runnable() {
            @Override
            public void run() {
                final ArrayList arrayList = new ArrayList();
                final boolean z = false;
                try {
                    JSONObject a2 = b.this.a(str, "", "&supportMulti=" + URLEncoder.encode("1", "UTF-8").replaceAll("\\+", "%20") + "&vc=" + URLEncoder.encode("" + com.excelliance.kxqp.util.a.a.getApkVersion(b.this.f2067a), "UTF-8").replaceAll("\\+", "%20") + "&vn=" + URLEncoder.encode(com.excelliance.kxqp.util.a.a.getApkVersionName(b.this.f2067a), "UTF-8").replaceAll("\\+", "%20") + "&child=" + URLEncoder.encode("" + com.excelliance.kxqp.util.a.a.getMainChId(b.this.f2067a), "UTF-8").replaceAll("\\+", "%20") + "&subchid=" + URLEncoder.encode("" + com.excelliance.kxqp.util.a.a.getSubChId(b.this.f2067a), "UTF-8").replaceAll("\\+", "%20") + "&controlapi=" + URLEncoder.encode("1", "UTF-8").replaceAll("\\+", "%20") + "&isFromDomestic=" + URLEncoder.encode("1", "UTF-8").replaceAll("\\+", "%20") + "&uid=" + URLEncoder.encode(b.this.f2067a.getSharedPreferences("userInfo", 4).getString("uid", null), "UTF-8").replaceAll("\\+", "%20"));
                    if (a2 != null) {
                        JSONArray optJSONArray = a2.optJSONArray("data");
                        for (int i = 0; i < optJSONArray.length(); i++) {
                            arrayList.add(b.this.a(optJSONArray.getJSONObject(i)));
                        }
                        z = true;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                tp.i(new Runnable() {
                    @Override
                    public void run() {
                        if (b.this.f2068b != null) {
                            b.this.f2068b.a(z, arrayList);
                        }
                    }
                });
            }
        });
    }

    public JSONObject a(String str, String str2, String str3) {
        String a2 = a("http://api.ourplay.com.cn/rank/searchapp", "q=" + d.a(str, "null") + "&r=" + d.a(str2, "null") + str3);
        if (a2 == null) {
            return null;
        }
        try {
            return new JSONObject(a2.substring(a2.indexOf(123), a2.lastIndexOf(StatisticsBase.UA_VIP_ENRIE_TIPS_SELECT) + 1));
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    private String a(String str, String str2) {
        BufferedReader bufferedReader;
        DataOutputStream dataOutputStream;
        BufferedReader bufferedReader2;
        HttpURLConnection httpURLConnection;
        DataOutputStream dataOutputStream2 = null;
        try {
            try {
                try {
                    httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                    httpURLConnection.setDoOutput(true);
                    httpURLConnection.setDoInput(true);
                    httpURLConnection.setUseCaches(false);
                    httpURLConnection.setRequestMethod("POST");
                    httpURLConnection.setRequestProperty("Content-Type", URLEncodedUtils.CONTENT_TYPE);
                    httpURLConnection.setRequestProperty("Connection", HTTP.CONN_KEEP_ALIVE);
                    httpURLConnection.setRequestProperty("Charset", "UTF-8");
                    httpURLConnection.setRequestProperty(HttpHeaders.ACCEPT_LANGUAGE, "en-US");
                    httpURLConnection.setConnectTimeout(5000);
                    httpURLConnection.setReadTimeout(5000);
                    httpURLConnection.connect();
                    dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    dataOutputStream.writeBytes(str2);
                    dataOutputStream.flush();
                    dataOutputStream.close();
                } catch (MalformedURLException e) {
                    e = e;
                    bufferedReader2 = null;
                } catch (IOException e2) {
                    e = e2;
                    bufferedReader2 = null;
                } catch (Throwable th2) {
                    th = th2;
                    bufferedReader = null;
                    dataOutputStream2 = dataOutputStream;
                    if (dataOutputStream2 != null) {
                        try {
                            dataOutputStream2.close();
                        } catch (IOException e3) {
                            e3.printStackTrace();
                        }
                    }
                    if (bufferedReader != null) {
                        throw th;
                    }
                    try {
                        bufferedReader.close();
                        throw th;
                    } catch (IOException e4) {
                        e4.printStackTrace();
                        throw th;
                    }
                }
            } catch (MalformedURLException e5) {
                e = e5;
                dataOutputStream = null;
                bufferedReader2 = null;
            } catch (IOException e6) {
                e = e6;
                dataOutputStream = null;
                bufferedReader2 = null;
            } catch (Throwable th3) {
                th = th3;
                bufferedReader = null;
                if (dataOutputStream2 != null) {
                }
                if (bufferedReader != null) {
                }
            }
        } catch (IOException e7) {
            e7.printStackTrace();
        }
        if (200 != httpURLConnection.getResponseCode()) {
            try {
                dataOutputStream.close();
            } catch (IOException e8) {
                e8.printStackTrace();
            }
            return null;
        }
        StringBuffer stringBuffer = new StringBuffer();
        new String();
        bufferedReader2 = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream(), "UTF-8"));
        while (true) {
            try {
                String readLine = bufferedReader2.readLine();
                if (readLine == null) {
                    break;
                }
                stringBuffer.append(readLine);
                stringBuffer.append("\n");
            } catch (MalformedURLException e9) {
                e = e9;
                e.printStackTrace();
                if (dataOutputStream != null) {
                    try {
                        dataOutputStream.close();
                    } catch (IOException e10) {
                        e10.printStackTrace();
                    }
                }
                if (bufferedReader2 != null) {
                    bufferedReader2.close();
                }
                return null;
            } catch (IOException e11) {
                e = e11;
                e.printStackTrace();
                if (dataOutputStream != null) {
                    try {
                        dataOutputStream.close();
                    } catch (IOException e12) {
                        e12.printStackTrace();
                    }
                }
                if (bufferedReader2 != null) {
                    bufferedReader2.close();
                }
                return null;
            }
        }
        bufferedReader2.close();
        String stringBuffer2 = stringBuffer.toString();
        try {
            dataOutputStream.close();
        } catch (IOException e13) {
            e13.printStackTrace();
        }
        try {
            bufferedReader2.close();
        } catch (IOException e14) {
            e14.printStackTrace();
        }
        return stringBuffer2;
    }

    public CollectionSearchGameBean a(JSONObject jSONObject) {
        if (jSONObject == null) {
            return null;
        }
        try {
            CollectionSearchGameBean collectionSearchGameBean = new CollectionSearchGameBean();
            collectionSearchGameBean.appId = jSONObject.optInt("id");
            collectionSearchGameBean.imageUrl = jSONObject.optString(RankingItem.KEY_ICON);
            collectionSearchGameBean.name = jSONObject.optString("title");
            collectionSearchGameBean.pkg = jSONObject.optString("pkgname");
            return collectionSearchGameBean;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}