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

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


package com.excelliance.kxqp.pay;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import com.alipay.sdk.sys.a;
import com.excelliance.kxqp.GameJNI;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.gs.util.as;
import com.excelliance.kxqp.pay.PayPlatform;
import java.io.File;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class PayManager {

    private static PayManager f12643a = null;

    private static PayPlatform f12644b = null;
    private static PayPlatform c = null;
    private static String d = null;
    private static String e = null;
    private static String f = null;
    private static PayPlatformInfo g = null;
    private static int h = 20;
    private PayCallBack i;
    private Context j;
    private DownloadReceiver k;
    private int l = 0;

    public static void a(boolean z) {
    }

    private PayManager() {
        this.i = null;
        this.j = null;
        this.k = new DownloadReceiver();
        this.i = new PayCallBack();
        this.j = GameUtil.getIntance().getContext();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.excelliance.kxqp.pay.PayService.finished");
        intentFilter.addAction("com.excelliance.kxqp.pay.PayService.error");
        this.j.registerReceiver(this.k, intentFilter);
    }

    public static PayManager a() {
        if (f12643a == null) {
            f12643a = new PayManager();
        }
        return f12643a;
    }

    public static void a(HashMap<String, Object> hashMap) {
        PayPlatform d2 = a().d(g == null ? c() : g.mName);
        if (d2 != null) {
            d2.a((String) hashMap.get("order"), (String) hashMap.get("name"), Integer.parseInt((String) hashMap.get("shopId")), Integer.parseInt((String) hashMap.get("amount")), Integer.parseInt((String) hashMap.get("payType")), Integer.parseInt((String) hashMap.get("productCount")), (PayPlatCallback) hashMap.get("payplatcallback"), (String) hashMap.get("payplatcallbackparam"));
        } else {
            a(false);
        }
    }

    public static String b() {
        if (d == null) {
            String i = GameUtil.i(GameUtil.getIntance().getContext());
            if (i == null || i.length() == 0) {
                i = "NOT_DEFINE";
            }
            d = b(i);
        }
        return d;
    }

    public static String c() {
        if (e == null) {
            e = GameUtil.getIntance().getContext().getSharedPreferences("pay", 0).getString("currentPayPlatform", "");
            if (e == null || e.length() == 0) {
                e = b();
            }
        }
        return e;
    }

    private static String a(String str) {
        if (str.startsWith(PayManager.class.getPackage().getName())) {
            return str;
        }
        return PayManager.class.getPackage().getName() + "." + str;
    }

    private static String b(String str) {
        return str.startsWith(PayManager.class.getPackage().getName()) ? str.substring(str.lastIndexOf(".") + 1) : str;
    }

    public static void a(Map<String, String> map) {
        if (map == null || map.isEmpty()) {
            return;
        }
        Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
        StringBuilder sb = new StringBuilder("http://kxqp.myouxi.com.cn/payment/privatepaycallback.php?");
        while (it.hasNext()) {
            Map.Entry<String, String> next = it.next();
            sb.append(next.getKey());
            sb.append("=");
            sb.append(next.getValue());
            if (it.hasNext()) {
                sb.append(a.f472b);
            }
        }
        sb.toString();
        new Thread() {
            @Override
            public void run() {
            }
        }.start();
    }

    private String d() {
        if (f == null) {
            f = as.a(this.j) + "/.paycache";
        }
        return f;
    }

    public String c(String str) {
        return d() + File.separator + b(str) + ".jar";
    }

    private PayPlatform a(String str, ClassLoader classLoader) {
        try {
            PayPlatform payPlatform = (PayPlatform) Class.forName(a(str)).getDeclaredConstructor(Context.class, PayPlatform.CallBack.class).newInstance(this.j, this.i);
            String a2 = payPlatform.a();
            if (a2 == null || !a2.equals(b(str))) {
                return null;
            }
            return payPlatform;
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        } catch (NoClassDefFoundError e3) {
            Log.d("PayManager", "getPayPlatform NoClassDefFoundError");
            e3.printStackTrace();
            return null;
        }
    }

    private PayPlatform e() {
        if (c == null) {
            c = a(b(), PayManager.class.getClassLoader());
        }
        return c;
    }

    private synchronized PayPlatform d(String str) {
        PayPlatform e2;
        Log.d("PayManager", "thirdparty = " + str);
        if (f12644b == null || !f12644b.a().equals(str)) {
            ClassLoader classLoader = PayManager.class.getClassLoader();
            if (b().equals(str)) {
                f12644b = e();
            } else {
                try {
                    try {
                        String c2 = c(str);
                        if (new File(c2).exists()) {
                            ClassLoader classLoader2 = classLoader;
                            for (Method method : Class.forName("com.excelliance.kxqp.pay.util.HackUtil", false, this.j.getApplicationContext().getClassLoader()).getMethods()) {
                                if (method.getName().equals("addJarToClassLoader")) {
                                    if (!((Boolean) method.invoke(null, c2, d(), d() + "/lib", classLoader2, false)).booleanValue()) {
                                        classLoader2 = null;
                                    }
                                }
                            }
                            if (classLoader2 != null) {
                                f12644b = a(str, classLoader2);
                            }
                        }
                    } catch (Exception e3) {
                        e3.printStackTrace();
                        if (f12644b == null) {
                            e2 = e();
                        }
                    }
                    if (f12644b == null) {
                        e2 = e();
                        f12644b = e2;
                    }
                } catch (Throwable th) {
                    if (f12644b == null) {
                        f12644b = e();
                    }
                    throw th;
                }
            }
        }
        return f12644b;
    }

    private void e(String str) {
        SharedPreferences.Editor edit = this.j.getSharedPreferences("pay", 0).edit();
        edit.clear();
        edit.putString("currentPayPlatform", b(str));
        edit.commit();
    }

    public void a(PayPlatformInfo payPlatformInfo) {
        payPlatformInfo.mName = b(payPlatformInfo.mName);
        g = payPlatformInfo;
        e(payPlatformInfo.mName);
        d(payPlatformInfo.mName);
    }

    public boolean a(File file, PayPlatformInfo payPlatformInfo) {
        if (file.length() != Integer.parseInt(payPlatformInfo.mSize)) {
            Log.e("PayManager", "checkAndVerifyPayPlatformFile fileSize mismatch");
            return false;
        }
        try {
            if (!GameUtil.getIntance().d(file.getAbsolutePath()).equals(payPlatformInfo.mMD5)) {
                Log.e("PayManager", "checkAndVerifyPayPlatformFile MD5 mismatch");
                return false;
            }
            Log.d("PayManager", "checkAndVerifyPayPlatformFile file: " + file + " is OK!!");
            return true;
        } catch (Exception e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public void b(PayPlatformInfo payPlatformInfo) {
        int i = this.l;
        this.l = i + 1;
        if (i > h) {
            Log.e("PayManager", "mDownLoadRetry: " + this.l);
            return;
        }
        Intent intent = new Intent(this.j.getPackageName() + ".action.psjardl");
        payPlatformInfo.mDownLoadPath = c(payPlatformInfo.mName) + ".tmp";
        intent.putExtras(payPlatformInfo.toBundle());
        this.j.startService(intent);
    }

    public static final class PayPlatformInfo {
        private static final String DOWNLOAD_PATH_KEY = "download_path";
        private static final String MD5_KEY = "md5";
        private static final String NAME_KEY = "name";
        private static final String SIZE_KEY = "size";
        private static final String URL_KEY = "url";
        private static final String VERSION_KEY = "version";
        public String mDownLoadPath;
        public String mMD5;
        public String mName;
        public String mSize;
        public String mUrl;
        public String mVersion;

        public PayPlatformInfo(String str, String str2, String str3, String str4, String str5) {
            this.mName = str;
            this.mUrl = str2;
            this.mSize = str3;
            this.mVersion = str4;
            this.mMD5 = str5;
        }

        private PayPlatformInfo(String str, String str2, String str3, String str4, String str5, String str6) {
            this.mName = str;
            this.mUrl = str2;
            this.mSize = str3;
            this.mVersion = str4;
            this.mMD5 = str5;
            this.mDownLoadPath = str6;
        }

        public static PayPlatformInfo fromBundle(Bundle bundle) {
            return new PayPlatformInfo(bundle.getString("name"), bundle.getString("url"), bundle.getString("size"), bundle.getString("version"), bundle.getString("md5"), bundle.getString(DOWNLOAD_PATH_KEY));
        }

        public Bundle toBundle() {
            Bundle bundle = new Bundle();
            bundle.putString("name", this.mName);
            bundle.putString("url", this.mUrl);
            bundle.putString("size", this.mSize);
            bundle.putString("version", this.mVersion);
            bundle.putString("md5", this.mMD5);
            bundle.putString(DOWNLOAD_PATH_KEY, this.mDownLoadPath);
            return bundle;
        }
    }

    public class PayCallBack implements PayPlatform.CallBack {
        @Override
        public void payResult(boolean z) {
        }

        private PayCallBack() {
        }

        @Override
        public void payResultDispatch(Map<String, String> map) {
            PayManager.a(map);
        }

        @Override
        public void sendMessage(Message message) {
            Message message2 = new Message();
            switch (message.what) {
                case 0:
                    message2.what = 12;
                    break;
                case 1:
                    message2.what = 13;
                    break;
                case 2:
                    GameJNI.a((String) message.obj);
                    return;
                default:
                    return;
            }
            GameUtil.getIntance().a(message2);
        }
    }

    private class DownloadReceiver extends BroadcastReceiver {
        private DownloadReceiver() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            PayPlatformInfo fromBundle = PayPlatformInfo.fromBundle(intent.getExtras());
            String c = PayManager.this.c(fromBundle.mName);
            File file = new File(fromBundle.mDownLoadPath);
            if (action.equals("com.excelliance.kxqp.pay.PayService.finished")) {
                if (file.exists() && PayManager.this.a(file, fromBundle)) {
                    file.renameTo(new File(c));
                    PayManager.this.a(fromBundle);
                    return;
                } else {
                    file.delete();
                    PayManager.this.b(fromBundle);
                    return;
                }
            }
            if (action.equals("com.excelliance.kxqp.pay.PayService.error")) {
                PayManager.this.b(fromBundle);
            }
        }
    }
}