翰林优商.apk(点击下载) / d0.java


package com.xlx.speech.m0;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.text.TextUtils;
import com.kuaishou.weapon.p0.h;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

public class d0 {
    /* JADX WARNING: Removed duplicated region for block: B:31:0x0068  */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x006e  */
    public static String a(List<File> list) {
        byte[] bArr;
        String str;
        ByteArrayOutputStream byteArrayOutputStream;
        Throwable th;
        IOException e;
        ArrayList arrayList = new ArrayList(list.size());
        String str2 = null;
        for (File file : list) {
            if (file.exists()) {
                try {
                    BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file), 524288);
                    try {
                        byteArrayOutputStream = new ByteArrayOutputStream();
                        try {
                            byte[] bArr2 = new byte[524288];
                            while (true) {
                                int read = bufferedInputStream.read(bArr2, 0, 524288);
                                if (read == -1) {
                                    break;
                                }
                                byteArrayOutputStream.write(bArr2, 0, read);
                            }
                            bArr = byteArrayOutputStream.toByteArray();
                        } catch (IOException e2) {
                            e = e2;
                            try {
                                e.printStackTrace();
                                bArr = null;
                                g.a(bufferedInputStream);
                                g.a(byteArrayOutputStream);
                                if (bArr == null) {
                                }
                                arrayList.add(str);
                                str2 = str;
                            } catch (Throwable th2) {
                                th = th2;
                                g.a(bufferedInputStream);
                                g.a(byteArrayOutputStream);
                                throw th;
                            }
                        }
                    } catch (IOException e3) {
                        e = e3;
                        byteArrayOutputStream = null;
                        e.printStackTrace();
                        bArr = null;
                        g.a(bufferedInputStream);
                        g.a(byteArrayOutputStream);
                        if (bArr == null) {
                        }
                        arrayList.add(str);
                        str2 = str;
                    } catch (Throwable th3) {
                        th = th3;
                        byteArrayOutputStream = null;
                        g.a(bufferedInputStream);
                        g.a(byteArrayOutputStream);
                        throw th;
                    }
                    g.a(bufferedInputStream);
                    g.a(byteArrayOutputStream);
                } catch (FileNotFoundException e4) {
                    e4.printStackTrace();
                }
                str = bArr == null ? new String(bArr) : null;
                arrayList.add(str);
                if (TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str)) {
                    str2 = str;
                }
            }
            bArr = null;
            if (bArr == null) {
            }
            arrayList.add(str);
            str2 = str;
        }
        if (TextUtils.isEmpty(str2)) {
            return "";
        }
        for (int i = 0; i < arrayList.size(); i++) {
            if (!TextUtils.equals(str2, (String) arrayList.get(i))) {
                g.a(list.get(i), str2, false);
            }
        }
        return str2;
    }

    public static void a(List<File> list, String str) {
        for (int i = 0; i < list.size(); i++) {
            g.a(list.get(i), str, false);
        }
    }

    public static String a(Context context) {
        List singletonList = Collections.singletonList(new File(context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), ".xz.txt"));
        if (w.a(h.j)) {
            String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath();
            File file = new File(absolutePath, ".xz.txt");
            StringBuilder sb = new StringBuilder();
            sb.append(absolutePath);
            String str = File.separator;
            sb.append(str);
            sb.append("Android");
            File file2 = new File(sb.toString(), ".xz.txt");
            List asList = Arrays.asList(file, file2, new File(absolutePath + str + "DCIM", ".xz.txt"));
            String a = a(asList);
            String string = c0.a().getString("minor_uuid", "");
            if (!TextUtils.isEmpty(a)) {
                if (!TextUtils.equals(a, string)) {
                    return a;
                }
                SharedPreferences.Editor edit = c0.a().edit();
                edit.putString("minor_uuid", string);
                edit.apply();
                return a;
            } else if (!TextUtils.isEmpty(string)) {
                a(asList, string);
                a(singletonList, string);
                return string;
            } else {
                String uuid = UUID.randomUUID().toString();
                SharedPreferences.Editor edit2 = c0.a().edit();
                edit2.putString("minor_uuid", uuid);
                edit2.apply();
                a(asList, uuid);
                a(singletonList, uuid);
                return uuid;
            }
        } else {
            String a2 = a(singletonList);
            String string2 = c0.a().getString("minor_uuid", "");
            if (!TextUtils.isEmpty(a2)) {
                if (!TextUtils.equals(a2, string2)) {
                    return a2;
                }
                SharedPreferences.Editor edit3 = c0.a().edit();
                edit3.putString("minor_uuid", string2);
                edit3.apply();
                return a2;
            } else if (!TextUtils.isEmpty(string2)) {
                a(singletonList, string2);
                return string2;
            } else {
                String uuid2 = UUID.randomUUID().toString();
                SharedPreferences.Editor edit4 = c0.a().edit();
                edit4.putString("minor_uuid", uuid2);
                edit4.apply();
                a(singletonList, uuid2);
                return uuid2;
            }
        }
    }
}