萝莉来了 v1.2.1版本的 MD5 值为:6055c21e001561c5b114d0da5b392fcb

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


package org.cocos2dx.c;

import android.content.SharedPreferences;
import cn.cmgame.billing.util.Const;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.cocos2dx.PBInstance;
import org.cocos2dx.PBRedeemListener;
import org.cocos2dx.d.c;
import org.json.JSONObject;

public final class a {
    private static String a = null;
    private static PBRedeemListener b = null;

    public static String a(String str) {
        String str2 = "";
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            httpURLConnection.setConnectTimeout(15000);
            httpURLConnection.setReadTimeout(Const.dp);
            str2 = httpURLConnection.getResponseMessage();
            httpURLConnection.connect();
            return new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream())).readLine();
        } catch (Exception e) {
            String str3 = str2;
            e.printStackTrace();
            return str3;
        }
    }

    public static void a(String str, int i) {
        SharedPreferences sharedPreferences = c.a().getSharedPreferences("RedeemCode", 0);
        if (sharedPreferences == null) {
            return;
        }
        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.putInt(str, i);
        edit.commit();
    }

    public static void a(String str, PBRedeemListener pBRedeemListener) {
        int i = 1;
        b = pBRedeemListener;
        if (str == null || str.length() == 0) {
            b.RedeemFailed(2, "The code is invalid");
            PBInstance.LogD("PBRedeem", "Redeem code is invalid!");
            return;
        }
        SharedPreferences sharedPreferences = c.a().getSharedPreferences("RedeemCode", 0);
        int i2 = sharedPreferences == null ? 1 : sharedPreferences.getInt(str, 1);
        switch (i2) {
            case 1:
            case 2:
                i = i2;
                break;
            case 3:
                b.RedeemFailed(1, "The code has been used");
                PBInstance.LogD("PBRedeem", "Redeem code has been used!");
                return;
        }
        a(str, 2);
        new b(b(str, i), str).start();
    }

    public static String b(String str, int i) {
        String str2 = "";
        switch (i) {
            case 1:
                str2 = "unused";
                break;
            case 2:
                str2 = "locked";
                break;
            case 3:
                str2 = "used";
                break;
        }
        String format = String.format("%d", Long.valueOf(System.currentTimeMillis()));
        a = format;
        String b2 = c.b();
        String c = c.c();
        String g = c.g();
        return String.valueOf(PBInstance.getTestUrlEnabled() ? "http://117.121.57.82/exchange/?exchangecode/codeVerifi/" : "http://excode.appget.cn/?exchangecode/codeVerifi/") + String.format("code=%s&timestamp=%s&canal=%s&appid=%s&uid=%s&status=%s&sign=%s", str, format, c, b2, g, str2, String.format("%d", Long.valueOf(e(String.format("%s,%s,%s,%s,%s,%s", str, format, c, b2, g, str2)))));
    }

    public static String b(String str, String str2) {
        try {
            return new JSONObject(str).getString(str2);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public static long e(String str) {
        if (str == null || str.length() == 0) {
            return 1L;
        }
        long j = 0;
        for (int length = str.length() - 1; length >= 0; length--) {
            long charAt = str.charAt(length);
            j = ((j << 6) & 268435455) + charAt + (charAt << 14);
            long j2 = 266338304 & j;
            if (j2 != 0) {
                j ^= j2 >> 21;
            }
        }
        return j;
    }
}