导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - x.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 x.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package eg;

import android.content.Context;
import androidx.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

public final class x {
    public static final jg.a c = new jg.a("AssetPackStorage");
    public final Context a;
    public final t1 b;

    static {
        TimeUnit timeUnit = TimeUnit.DAYS;
        timeUnit.toMillis(14L);
        timeUnit.toMillis(28L);
    }

    public x(Context context, t1 t1Var) {
        this.a = context;
        this.b = t1Var;
    }

    public static long b(File file, boolean z) {
        if (!file.exists()) {
            return -1L;
        }
        ArrayList arrayList = new ArrayList();
        jg.a aVar = c;
        if (z && file.listFiles().length > 1) {
            aVar.e("Multiple pack versions found, using highest version code.", new Object[0]);
        }
        try {
            for (File file2 : file.listFiles()) {
                if (!file2.getName().equals("stale.tmp")) {
                    arrayList.add(Long.valueOf(file2.getName()));
                }
            }
        } catch (NumberFormatException e) {
            aVar.c(e, "Corrupt asset pack directories.", new Object[0]);
        }
        if (arrayList.isEmpty()) {
            return -1L;
        }
        Collections.sort(arrayList);
        return ((Long) arrayList.get(arrayList.size() - 1)).longValue();
    }

    public static void f(File file) {
        if (file.listFiles() == null || file.listFiles().length <= 1) {
            return;
        }
        long b = b(file, false);
        for (File file2 : file.listFiles()) {
            if (!file2.getName().equals(String.valueOf(b)) && !file2.getName().equals("stale.tmp")) {
                g(file2);
            }
        }
    }

    public static boolean g(File file) {
        File[] listFiles = file.listFiles();
        boolean z = true;
        if (listFiles != null) {
            for (File file2 : listFiles) {
                z &= g(file2);
            }
        }
        if (file.delete()) {
            return z;
        }
        return false;
    }

    public final void a(int i, long j, String str) {
        File file = new File(d(), str);
        if (file.exists()) {
            for (File file2 : file.listFiles()) {
                if (!file2.getName().equals(String.valueOf(i)) && !file2.getName().equals("stale.tmp")) {
                    g(file2);
                } else if (file2.getName().equals(String.valueOf(i))) {
                    for (File file3 : file2.listFiles()) {
                        if (!file3.getName().equals(String.valueOf(j))) {
                            g(file3);
                        }
                    }
                }
            }
        }
    }

    public final File c(int i, long j, String str) {
        return new File(new File(new File(new File(d(), "_tmp"), str), String.valueOf(i)), String.valueOf(j));
    }

    public final File d() {
        return new File(this.a.getFilesDir(), "assetpacks");
    }

    public final ArrayList e() {
        ArrayList arrayList = new ArrayList();
        try {
        } catch (IOException e) {
            c.b("Could not process directory while scanning installed packs. %s", e);
        }
        if (d().exists() && d().listFiles() != null) {
            for (File file : d().listFiles()) {
                if (!file.getCanonicalPath().equals(new File(d(), "_tmp").getCanonicalPath())) {
                    arrayList.add(file);
                }
            }
            return arrayList;
        }
        return arrayList;
    }

    public final int h(int i, long j, String str) throws IOException {
        File file = new File(new File(c(i, j, str), "_packs"), "merge.tmp");
        if (!file.exists()) {
            return 0;
        }
        Properties properties = new Properties();
        FileInputStream fileInputStream = new FileInputStream(file);
        try {
            properties.load(fileInputStream);
            fileInputStream.close();
            if (properties.getProperty("numberOfMerges") == null) {
                throw new q0("Merge checkpoint file corrupt.");
            }
            try {
                return Integer.parseInt(properties.getProperty("numberOfMerges"));
            } catch (NumberFormatException e) {
                throw new q0("Merge checkpoint file corrupt.", e);
            }
        } catch (Throwable th2) {
            try {
                fileInputStream.close();
            } catch (Throwable unused) {
            }
            throw th2;
        }
    }

    public final long i(String str) {
        return b(new File(new File(d(), str), String.valueOf((int) b(new File(d(), str), true))), true);
    }

    public final File j(int i, long j, String str) {
        return new File(new File(new File(d(), str), String.valueOf(i)), String.valueOf(j));
    }

    public final File k(long j, String str, String str2, int i) {
        return new File(new File(new File(c(i, j, str), "_slices"), "_unverified"), str2);
    }

    public final File l(long j, String str, String str2, int i) {
        return new File(new File(new File(c(i, j, str), "_slices"), "_verified"), str2);
    }

    @Nullable
    public final String m(String str) throws IOException {
        int length;
        File file = new File(d(), str);
        boolean exists = file.exists();
        jg.a aVar = c;
        if (!exists) {
            aVar.a("Pack not found with pack name: %s", str);
            return null;
        }
        t1 t1Var = this.b;
        File file2 = new File(file, String.valueOf(t1Var.a()));
        if (!file2.exists()) {
            aVar.a("Pack not found with pack name: %s app version: %s", str, Integer.valueOf(t1Var.a()));
            return null;
        }
        File[] listFiles = file2.listFiles();
        if (listFiles == null || (length = listFiles.length) == 0) {
            aVar.a("No pack version found for pack name: %s app version: %s", str, Integer.valueOf(t1Var.a()));
            return null;
        }
        if (length <= 1) {
            return listFiles[0].getCanonicalPath();
        }
        aVar.b("Multiple pack versions found for pack name: %s app version: %s", str, Integer.valueOf(t1Var.a()));
        return null;
    }

    public final HashMap n() {
        HashMap hashMap = new HashMap();
        Iterator it = e().iterator();
        while (it.hasNext()) {
            String name = ((File) it.next()).getName();
            int b = (int) b(new File(d(), name), true);
            long b2 = b(new File(new File(d(), name), String.valueOf(b)), true);
            if (j(b, b2, name).exists()) {
                hashMap.put(name, Long.valueOf(b2));
            }
        }
        return hashMap;
    }
}