3p棋牌.apk(点击下载) / n.java


package com.tencent.smtt.utils;

import android.annotation.TargetApi;
import android.content.Context;
import android.text.TextUtils;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;

public class n {
    private static n c;

    /* renamed from: a  reason: collision with root package name */
    private Context f2322a = null;
    private File b = null;
    private String d = "http://log.tbs.qq.com/ajax?c=pu&v=2&k=";
    private String e = "http://log.tbs.qq.com/ajax?c=pu&tk=";
    private String f = "http://wup.imtt.qq.com:8080";
    private String g = "http://log.tbs.qq.com/ajax?c=dl&k=";
    private String h = "http://cfg.imtt.qq.com/tbs?v=2&mk=";
    private String i = "http://log.tbs.qq.com/ajax?c=ul&v=2&k=";
    private String j = "http://mqqad.html5.qq.com/adjs";
    private String k = "http://log.tbs.qq.com/ajax?c=ucfu&k=";

    @TargetApi(11)
    private n(Context context) {
        TbsLog.w("TbsCommonConfig", "TbsCommonConfig constructing...");
        this.f2322a = context.getApplicationContext();
        g();
    }

    public static synchronized n a() {
        n nVar;
        synchronized (n.class) {
            nVar = c;
        }
        return nVar;
    }

    public static synchronized n a(Context context) {
        n nVar;
        synchronized (n.class) {
            if (c == null) {
                c = new n(context);
            }
            nVar = c;
        }
        return nVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:47:0x00f0 A[SYNTHETIC, Splitter:B:47:0x00f0] */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x00fb A[SYNTHETIC, Splitter:B:54:0x00fb] */
    private synchronized void g() {
        BufferedInputStream bufferedInputStream;
        Throwable th;
        Throwable th2;
        try {
            File h2 = h();
            if (h2 == null) {
                TbsLog.e("TbsCommonConfig", "Config file is null, default values will be applied");
                return;
            }
            bufferedInputStream = new BufferedInputStream(new FileInputStream(h2));
            try {
                Properties properties = new Properties();
                properties.load(bufferedInputStream);
                String property = properties.getProperty("pv_post_url", "");
                if (!"".equals(property)) {
                    this.d = property;
                }
                String property2 = properties.getProperty("wup_proxy_domain", "");
                if (!"".equals(property2)) {
                    this.f = property2;
                }
                String property3 = properties.getProperty("tbs_download_stat_post_url", "");
                if (!"".equals(property3)) {
                    this.g = property3;
                }
                String property4 = properties.getProperty("tbs_downloader_post_url", "");
                if (!"".equals(property4)) {
                    this.h = property4;
                }
                String property5 = properties.getProperty("tbs_log_post_url", "");
                if (!"".equals(property5)) {
                    this.i = property5;
                }
                String property6 = properties.getProperty("tips_url", "");
                if (!"".equals(property6)) {
                    this.j = property6;
                }
                String property7 = properties.getProperty("tbs_cmd_post_url", "");
                if (!"".equals(property7)) {
                    this.k = property7;
                }
                String property8 = properties.getProperty("pv_post_url_tk", "");
                if (!"".equals(property8)) {
                    this.e = property8;
                }
                try {
                    bufferedInputStream.close();
                } catch (IOException e2) {
                    e = e2;
                }
            } catch (Throwable th3) {
                th2 = th3;
                try {
                    StringWriter stringWriter = new StringWriter();
                    th2.printStackTrace(new PrintWriter(stringWriter));
                    TbsLog.e("TbsCommonConfig", "exceptions occurred1:" + stringWriter.toString());
                    if (bufferedInputStream != null) {
                        try {
                            bufferedInputStream.close();
                        } catch (IOException e3) {
                            e = e3;
                        }
                    }
                } catch (Throwable th4) {
                    th = th4;
                    if (bufferedInputStream != null) {
                    }
                    throw th;
                }
            }
        } catch (Throwable th5) {
            bufferedInputStream = null;
            th = th5;
            if (bufferedInputStream != null) {
                try {
                    bufferedInputStream.close();
                } catch (IOException e4) {
                    e4.printStackTrace();
                }
            }
            throw th;
        }
        e.printStackTrace();
    }

    private File h() {
        File file;
        Throwable th;
        File file2;
        try {
            if (this.b == null) {
                String str = this.f2322a.getApplicationContext().getApplicationInfo().packageName;
                if (!TextUtils.isEmpty(str)) {
                    boolean z = false;
                    boolean z2 = this.f2322a.getPackageManager().checkPermission("android.permission.READ_EXTERNAL_STORAGE", str) == 0;
                    if (this.f2322a.getPackageManager().checkPermission("android.permission.WRITE_EXTERNAL_STORAGE", str) == 0) {
                        z = true;
                    }
                    if (!z2) {
                        if (!z) {
                            file2 = new File(f.a(this.f2322a, 8));
                        }
                    }
                    TbsLog.i("TbsCommonConfig", "no permission,use sdcard default folder");
                    file2 = new File(f.a(this.f2322a, 5));
                } else {
                    file2 = new File(f.a(this.f2322a, 8));
                }
                this.b = file2;
                if (this.b == null || !this.b.isDirectory()) {
                    return null;
                }
            }
            file = new File(this.b, "tbsnet.conf");
            if (!file.exists()) {
                TbsLog.e("TbsCommonConfig", "Get file(" + file.getCanonicalPath() + ") failed!");
                return null;
            }
            try {
                TbsLog.w("TbsCommonConfig", "pathc:" + file.getCanonicalPath());
            } catch (Throwable th2) {
                th = th2;
            }
            return file;
        } catch (Throwable th3) {
            th = th3;
            file = null;
            StringWriter stringWriter = new StringWriter();
            th.printStackTrace(new PrintWriter(stringWriter));
            TbsLog.e("TbsCommonConfig", "exceptions occurred2:" + stringWriter.toString());
            return file;
        }
    }

    public String b() {
        return this.d;
    }

    public String c() {
        return this.g;
    }

    public String d() {
        return this.h;
    }

    public String e() {
        return this.i;
    }

    public String f() {
        return this.e;
    }
}