CarrotChat v2.8.80.240429版本的 MD5 值为:fdf98761f01e715a89df24b85b0d206e

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


package com.kinggrid.commonrequestauthority;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import com.kinggrid.iapppdf.droids.mupdf.codec.cosobject.PdfBoolean;
import java.io.File;
import java.io.UnsupportedEncodingException;
import org.apache.commons.httpclient.cookie.CookieSpec;

public class j extends AppRegister {
    private static String G;
    private static String H;
    private static String I;
    private static File L;
    private static j T;
    private l J;
    private String K;
    private String M;
    private String N;
    private String O;
    private String P;
    private String Q;
    private String R;
    private String S = "http://www.kinggrid.com:8080/iWebRegister/AppRegister?AuthCode=WDDSED12KINGGRID&UUID=";

    private j(Context context, String str, String str2) {
        H = f.a(context);
        I = f.e(context);
        if (!TextUtils.isEmpty(str)) {
            G = str;
        }
        if (!TextUtils.isEmpty(str2)) {
            AppRegister.licFilePath = str2;
        }
        a();
    }

    public static j a(Context context, String str, String str2) {
        if (T == null) {
            T = new j(context, str, str2);
        }
        return T;
    }

    private boolean b() {
        l lVar = this.J;
        if (lVar == null) {
            return false;
        }
        boolean equals = lVar.d().trim().equals(this.M.trim());
        boolean equals2 = this.J.f().trim().equals(this.O.trim());
        boolean equals3 = this.J.e().trim().equals(H.trim());
        if (!equals) {
            Log.v(AppRegister.TAG, "File companySn:" + this.J.d().trim() + "==App companySn:" + this.M.trim());
        } else if (!equals2) {
            Log.v(AppRegister.TAG, "File licCode:" + this.J.f().trim() + "==App licCode:" + this.O.trim());
        } else if (!equals3) {
            Log.v(AppRegister.TAG, "File hardSn:" + this.J.e().trim() + "==App hardSn:" + H.trim());
        }
        Log.v(AppRegister.TAG, "File companySn:" + equals + equals2 + equals3);
        return equals && equals2 && equals3;
    }

    private SparseArray<String> c() {
        int i10;
        SparseArray<String> sparseArray = new SparseArray<>();
        l lVar = this.J;
        String str = "";
        if (lVar != null) {
            String g10 = lVar.g();
            if (!TextUtils.isEmpty(g10)) {
                if (AppRegister.DEBUG) {
                    Log.v(AppRegister.TAG, "has exts and has file,the licType==" + g10);
                }
                i10 = b(g10);
            } else {
                i10 = f();
            }
            if (AppRegister.DEBUG) {
                Log.v(AppRegister.TAG, "doAppRegister_hasLicCode_and_hasLicFile,code_key==" + i10);
            }
            if (i10 != 200) {
                if (i10 != 201) {
                    if (i10 == 300) {
                        str = "" + this.K;
                    }
                } else {
                    str = String.valueOf(String.valueOf("" + getAuthorizationType(this.J.g()) + ",") + f.b(this.J.d()) + ",") + this.validTime;
                }
            } else {
                str = String.valueOf(String.valueOf("" + getAuthorizationType(this.J.g()) + ",") + f.b(this.J.d()) + ",") + this.validTime;
            }
        } else {
            if (AppRegister.DEBUG) {
                Log.v(AppRegister.TAG, "doAppRegister_hasLicCode_and_hasLicFile() responceLic is null");
            }
            i10 = 0;
        }
        sparseArray.put(i10, str);
        return sparseArray;
    }

    private int d() {
        if (a(false)) {
            long j10 = this.validTime;
            if (j10 <= 30 && j10 != -1) {
                return 200;
            }
            return 201;
        }
        if (f.a()) {
            return b(true);
        }
        return 106;
    }

    private int e() {
        if (b()) {
            this.validTime = -1L;
            return 201;
        }
        return 105;
    }

    private int f() {
        if (f.a()) {
            return b(false);
        }
        return 106;
    }

    private SparseArray<String> g() {
        int i10;
        SparseArray<String> sparseArray = new SparseArray<>();
        if (f.a()) {
            i10 = b(false);
        } else {
            i10 = 106;
        }
        StringBuilder sb2 = new StringBuilder(String.valueOf("" + getAuthorizationType(this.N) + ","));
        sb2.append(this.R);
        sb2.append(",");
        String sb3 = sb2.toString();
        if (i10 != 200) {
            if (i10 != 201) {
                if (i10 == 300) {
                    sb3 = String.valueOf(sb3) + this.K;
                }
            } else {
                sb3 = String.valueOf(sb3) + this.validTime;
            }
        } else {
            sb3 = String.valueOf(sb3) + this.validTime;
        }
        if (AppRegister.DEBUG) {
            Log.v(AppRegister.TAG, "doAppRegister_hasLicCode_and_noLicFile(),code==" + i10 + ",value==" + sb3);
        }
        sparseArray.put(i10, sb3);
        return sparseArray;
    }

    @Override
    public SparseArray<String> doInBackground(Void... voidArr) {
        if (!TextUtils.isEmpty(G)) {
            if (AppRegister.DEBUG) {
                Log.v(AppRegister.TAG, "doAppRegister(...) has licCode");
            }
            return a(G);
        }
        SparseArray<String> sparseArray = new SparseArray<>();
        sparseArray.put(107, "");
        return sparseArray;
    }

    private void a() {
        File file = new File(AppRegister.licFilePath);
        L = file;
        if (file.exists()) {
            this.J = f.a(f.a(L), false, "");
        }
    }

    private boolean a(boolean z10) {
        if ((!z10 && !b()) || this.J == null) {
            return false;
        }
        String a10 = f.a(k.f27393c);
        l lVar = this.J;
        String a11 = f.a(lVar, lVar.g());
        if (AppRegister.DEBUG) {
            Log.v(AppRegister.TAG, "currentTime" + a10 + "====xmlTime:" + a11);
        }
        if (a11.equals(PdfBoolean.TRUE)) {
            this.validTime = -1L;
        } else {
            long a12 = f.a(a11, a10);
            if (AppRegister.DEBUG) {
                Log.v(AppRegister.TAG, "validDays:" + a12);
            }
            if (a12 < 1) {
                return false;
            }
            this.validTime = a12;
        }
        return true;
    }

    private int b(String str) {
        if (str.equals("1")) {
            return d();
        }
        if (str.equals("0")) {
            return e();
        }
        Log.v(AppRegister.TAG, "doAppRegister_hasLicCode_and_hasLicFile_and_hasLicType is other");
        return 0;
    }

    private int b(boolean z10) {
        String a10 = a("ext1", "ext2");
        if (a10.equals(PdfBoolean.TRUE)) {
            return a(false, 102);
        }
        if (z10) {
            Log.i(AppRegister.TAG, "failed:" + a10 + ",and read the local file.");
            return a(false, 103);
        }
        this.K = a10;
        return 300;
    }

    private String a(String... strArr) {
        new c().a(c.f27372a);
        try {
            String str = String.valueOf(String.valueOf(String.valueOf(String.valueOf(this.M) + ";" + this.O + ";") + c.a(H.getBytes("UTF-8")) + ";") + c.a(I.getBytes("UTF-8")) + ";") + c.a(f.a("yyyyMMddHHmmsss").getBytes("UTF-8")) + ";";
            if (strArr != null) {
                for (String str2 : strArr) {
                    str = String.valueOf(str) + c.a(str2.getBytes("UTF-8")) + ";";
                }
            }
            String b10 = f.b(g.b(str, k.f27391a), String.valueOf(this.S) + f.a("yyyyMMddHHmmsss"), "");
            if (TextUtils.isEmpty(b10)) {
                return "";
            }
            l lVar = new l(b10, false, "");
            this.J = lVar;
            if (lVar.b().equals("1")) {
                f.a(AppRegister.licFilePath, b10.getBytes("UTF-8"));
                return PdfBoolean.TRUE;
            }
            return this.J.c();
        } catch (UnsupportedEncodingException e10) {
            e10.printStackTrace();
            return "";
        } catch (Exception e11) {
            e11.printStackTrace();
            return "";
        }
    }

    private SparseArray<String> a(String str) {
        String str2 = "";
        SparseArray<String> sparseArray = new SparseArray<>();
        try {
            String[] split = g.a(str, k.f27392b).split(";");
            this.N = split.length > 0 ? split[0] : "";
            this.O = split.length > 1 ? split[1] : "";
            this.P = split.length > 2 ? split[2] : "";
            this.Q = split.length > 3 ? split[3] : "";
            String str3 = split.length > 4 ? split[4] : "";
            this.M = str3;
            this.R = f.b(str3);
            Log.e(AppRegister.TAG, "doAppRegister_hasLicCode(...)");
        } catch (Exception e10) {
            Log.e(AppRegister.TAG, "doAppRegister_hasLicCode(...) error:" + e10.toString());
        }
        if (AppRegister.DEBUG) {
            Log.v(AppRegister.TAG, "licType:" + this.N + ",authCode:" + this.O + ",regDate:" + this.P + ",expireDate:" + this.Q);
        }
        int i10 = 110;
        if (!TextUtils.isEmpty(this.N)) {
            StringBuilder sb2 = new StringBuilder(String.valueOf("" + getAuthorizationType(this.N) + ","));
            sb2.append(this.R);
            sb2.append(",");
            str2 = sb2.toString();
            if (this.N.equals("2")) {
                i10 = 202;
            } else if (this.N.equals("3")) {
                long a10 = f.a(this.Q.replaceAll("-", CookieSpec.PATH_DELIM), f.a(k.f27393c));
                if (AppRegister.DEBUG) {
                    Log.v(AppRegister.TAG, "validDays:" + a10);
                }
                if (a10 >= 1) {
                    this.validTime = a10;
                    i10 = (a10 > 30 || a10 == -1) ? 201 : 200;
                    str2 = String.valueOf(str2) + this.validTime;
                } else {
                    i10 = 100;
                }
            } else if (this.N.equals("1") || this.N.equals("0")) {
                if (AppRegister.DEBUG) {
                    Log.v(AppRegister.TAG, "file.exists()==" + L.exists());
                }
                if (L.exists()) {
                    return c();
                }
                return g();
            }
        }
        sparseArray.put(i10, str2);
        return sparseArray;
    }

    private int a(boolean z10, int i10) {
        if (!a(z10)) {
            return i10;
        }
        long j10 = this.validTime;
        return (j10 > 30 || j10 == -1) ? 201 : 200;
    }
}