X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f

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


package K6;

import B.hRCx.IaBiDJU;
import F6.AbstractC1142k;
import F6.AbstractC1143l;
import F6.C;
import F6.C1141j;
import F6.C1145n;
import F7.C1160d;
import F7.w;
import P.AbstractC1363o;
import P.F0;
import P.InterfaceC1357l;
import P.P0;
import W6.hV.wLxQBPugaQkCAi;
import Y5.QIb.FKYtKvr;
import Z2.gV.aVJUUIozox;
import android.net.Uri;
import com.lonelycatgames.Xplore.FileSystem.h;
import h7.AbstractC6736y;
import h7.C6709J;
import i7.Q;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import t6.k;
import u6.AbstractC7556B;
import u6.F;
import v7.p;
import w7.AbstractC7771k;
import w7.AbstractC7777q;
import w7.AbstractC7780t;
import w7.AbstractC7781u;
import x5.C7868B;
import z.InterfaceC7946a;
import z6.AbstractC7990b;
import z6.AbstractC7992d;
import z6.C7989a;

public final class g extends K6.c implements AbstractC7992d.j {

    public static final b f6799A0 = new b(null);

    public static final int f6800B0 = 8;

    private static final AbstractC7990b.C0993b f6801C0 = new AbstractC7990b.C0993b(AbstractC7556B.f55714c1, "MediaFire", a.f6807I, false, 8, null);

    private static final SimpleDateFormat f6802D0 = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss", Locale.US);

    private static final TimeZone f6803E0 = TimeZone.getTimeZone("US/Central");

    private JSONObject f6804x0;

    private final String f6805y0;

    private final HashMap f6806z0;

    class a extends AbstractC7777q implements p {

        public static final a f6807I = new a();

        a() {
            super(2, g.class, "<init>", "<init>(Lcom/lonelycatgames/Xplore/FileSystem/net/CloudFileSystem;Landroid/net/Uri;)V", 0);
        }

        @Override
        public final g r(C7989a c7989a, Uri uri) {
            AbstractC7780t.f(c7989a, "p0");
            AbstractC7780t.f(uri, "p1");
            return new g(c7989a, uri, null);
        }
    }

    public static final class b {
        private b() {
        }

        public b(AbstractC7771k abstractC7771k) {
            this();
        }

        public final JSONObject c(JSONObject jSONObject) {
            try {
                JSONObject jSONObject2 = jSONObject.getJSONObject("response");
                if (AbstractC7780t.a(jSONObject2.getString("result"), wLxQBPugaQkCAi.MzWMmwQEzNTAe)) {
                    throw new IOException(jSONObject2.optString("message"));
                }
                AbstractC7780t.c(jSONObject2);
                return jSONObject2;
            } catch (JSONException e9) {
                throw new IOException(e9);
            }
        }

        public final boolean e(C c9) {
            AbstractC7780t.d(c9, "null cannot be cast to non-null type com.lonelycatgames.Xplore.FileSystem.net.ServerEntry.ServerEntryWithId");
            AbstractC7992d.j jVar = (AbstractC7992d.j) c9;
            return jVar.o("in_trash") || jVar.o("trash");
        }

        public final AbstractC7990b.C0993b d() {
            return g.f6801C0;
        }
    }

    public final class c extends AbstractC7992d.b {

        public static final class a extends AbstractC7781u implements p {

            final InterfaceC7946a f6810c;

            final b0.g f6811d;

            final int f6812e;

            a(InterfaceC7946a interfaceC7946a, b0.g gVar, int i9) {
                super(2);
                this.f6810c = interfaceC7946a;
                this.f6811d = gVar;
                this.f6812e = i9;
            }

            public final void a(InterfaceC1357l interfaceC1357l, int i9) {
                c.this.k1(this.f6810c, this.f6811d, interfaceC1357l, F0.a(this.f6812e | 1));
            }

            @Override
            public Object r(Object obj, Object obj2) {
                a((InterfaceC1357l) obj, ((Number) obj2).intValue());
                return C6709J.f49946a;
            }
        }

        public c() {
            super(g.this, "", 0L, r6, 4, null);
            Map e9;
            e9 = Q.e(AbstractC6736y.a("trash", ""));
        }

        @Override
        public Object clone() {
            return super.clone();
        }

        @Override
        public void k1(InterfaceC7946a interfaceC7946a, b0.g gVar, InterfaceC1357l interfaceC1357l, int i9) {
            int i10;
            AbstractC7780t.f(interfaceC7946a, FKYtKvr.BmGJWDSgZanPWO);
            AbstractC7780t.f(gVar, "modifier");
            InterfaceC1357l p9 = interfaceC1357l.p(143431956);
            if ((i9 & 14) == 0) {
                i10 = (p9.P(interfaceC7946a) ? 4 : 2) | i9;
            } else {
                i10 = i9;
            }
            if ((i9 & 112) == 0) {
                i10 |= p9.P(gVar) ? 32 : 16;
            }
            if ((i10 & 91) == 18 && p9.s()) {
                p9.z();
            } else {
                if (AbstractC1363o.G()) {
                    AbstractC1363o.S(143431956, i10, -1, "com.lonelycatgames.Xplore.clouds.MediaFire.TrashEntry.DrawIconOverlay (MediaFire.kt:204)");
                }
                AbstractC1142k.e(interfaceC7946a, gVar, p9, (i10 & 14) | (i10 & 112));
                if (AbstractC1363o.G()) {
                    AbstractC1363o.R();
                }
            }
            P0 v8 = p9.v();
            if (v8 != null) {
                v8.a(new a(interfaceC7946a, gVar, i9));
            }
        }
    }

    public static final class d extends AbstractC7990b.d {

        final HttpURLConnection f6813G;

        d(g gVar, HttpURLConnection httpURLConnection, String str, AbstractC7990b.g gVar2) {
            super(gVar, httpURLConnection, "filename", str, gVar2, -1L, "application/octet-stream", false, 0, 128, null);
            this.f6813G = httpURLConnection;
        }

        @Override
        public void f(int i9) {
            super.f(i9);
            try {
                JSONObject c9 = g.f6799A0.c(AbstractC7990b.f60542s0.g(this.f6813G));
                if (AbstractC7780t.a(c9.getString("result"), "Success")) {
                } else {
                    throw new IOException(c9.optString("message", "Copy failed"));
                }
            } catch (JSONException e9) {
                throw new IOException("Upload failed: " + k.Q(e9));
            }
        }
    }

    private g(C7989a c7989a, Uri uri) {
        super(c7989a, AbstractC7556B.f55714c1);
        this.f6805y0 = "";
        t2(uri);
        this.f6806z0 = new HashMap();
    }

    public g(C7989a c7989a, Uri uri, AbstractC7771k abstractC7771k) {
        this(c7989a, uri);
    }

    private final String y3(C c9) {
        String str;
        String f9 = AbstractC7990b.f60542s0.f(c9);
        AbstractC7780t.d(f9, "null cannot be cast to non-null type kotlin.String");
        HashMap hashMap = this.f6806z0;
        synchronized (hashMap) {
            try {
                Object obj = hashMap.get(f9);
                if (obj == null) {
                    JSONArray jSONArray = S2("file/get_links.php?link_type=direct_download&quick_key=" + f9).getJSONArray("links");
                    AbstractC7780t.e(jSONArray, "getJSONArray(...)");
                    Iterator it = k.L0(jSONArray).iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            obj = null;
                            break;
                        }
                        String X8 = k.X((JSONObject) it.next(), "direct_download");
                        if (X8 != null) {
                            obj = X8;
                            break;
                        }
                    }
                    hashMap.put(f9, obj);
                }
                str = (String) obj;
            } catch (Throwable th) {
                throw th;
            }
        }
        return str;
    }

    private final boolean z3(String str) {
        return AbstractC7780t.a(S2(str).getString("result"), "Success");
    }

    @Override
    public boolean B2() {
        return true;
    }

    @Override
    public boolean H2(C c9) {
        AbstractC7780t.f(c9, "le");
        return !(c9 instanceof c);
    }

    @Override
    public boolean J2(C c9) {
        AbstractC7780t.f(c9, "le");
        return !f6799A0.e(c9);
    }

    @Override
    public C1141j P2(C1141j c1141j, String str) {
        AbstractC7780t.f(c1141j, "parent");
        AbstractC7780t.f(str, "name");
        String str2 = "folder/create.php?allow_duplicate_name=no&foldername=" + Uri.encode(str);
        String f9 = AbstractC7990b.f60542s0.f(c1141j);
        AbstractC7780t.d(f9, "null cannot be cast to non-null type kotlin.String");
        if (f9.length() > 0) {
            str2 = str2 + "&parent_key=" + f9;
        }
        JSONObject S22 = S2(str2);
        String string = S22.getString("result");
        if (AbstractC7780t.a(string, "Success")) {
            String optString = S22.optString("folder_key", "");
            AbstractC7780t.e(optString, "optString(...)");
            return new AbstractC7992d.b(this, optString, 0L, null, 12, null);
        }
        throw new IOException("Invalid result: " + string);
    }

    @Override
    public HttpURLConnection Q2(String str, String str2) {
        AbstractC7780t.f(str2, "uri");
        if (this.f6804x0 == null) {
            if (w3() == null || v3() == null) {
                throw new h.j(null, 1, null);
            }
            String str3 = w3() + v3() + "42347mtcz9kdjqodpyy9owq84p82ttoj12fo6aoww8kxx";
            try {
                MessageDigest messageDigest = MessageDigest.getInstance(IaBiDJU.HWEDF);
                byte[] bytes = str3.getBytes(C1160d.f4033b);
                AbstractC7780t.e(bytes, "getBytes(...)");
                byte[] digest = messageDigest.digest(bytes);
                AbstractC7780t.c(digest);
                try {
                    URLConnection openConnection = new URL("https://www.mediafire.com/api/1.5/user/get_session_token.php?email=" + Uri.encode(w3()) + "&password=" + Uri.encode(v3()) + "&application_id=42347&signature=" + k.J0(digest, false) + "&response_format=json").openConnection();
                    AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
                    HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
                    int responseCode = httpURLConnection.getResponseCode();
                    if (responseCode >= 300) {
                        throw new h.j("Refresh token HTTP error " + responseCode);
                    }
                    try {
                        this.f6804x0 = AbstractC7990b.f60542s0.g(httpURLConnection).getJSONObject("response");
                    } catch (JSONException e9) {
                        throw new IOException("Can't parse token: " + k.Q(e9));
                    }
                } catch (MalformedURLException e10) {
                    throw new IOException(k.Q(e10));
                }
            } catch (NoSuchAlgorithmException e11) {
                throw new IOException(k.Q(e11));
            }
        }
        try {
            JSONObject jSONObject = this.f6804x0;
            String string = jSONObject != null ? jSONObject.getString("session_token") : null;
            return super.Q2(str, AbstractC7990b.f60542s0.b(str2, "session_token=" + string + "&response_format=json"));
        } catch (JSONException e12) {
            this.f6804x0 = null;
            throw new IOException(k.Q(e12));
        }
    }

    @Override
    public void R2(C c9) {
        String str;
        AbstractC7780t.f(c9, "le");
        String f9 = AbstractC7990b.f60542s0.f(c9);
        String str2 = ((AbstractC7992d.j) c9).o("in_trash") ? "purge" : "delete";
        if (c9.K0()) {
            str = "folder/" + str2 + ".php?folder_key=" + f9;
        } else {
            str = "file/" + str2 + ".php?quick_key=" + f9;
        }
        if (!z3(str)) {
            throw new IOException("Failed to delete");
        }
    }

    @Override
    public OutputStream S1(C c9, String str, long j9, Long l9) {
        AbstractC7780t.f(c9, "le");
        if (j9 == 0) {
            return new C7868B(0);
        }
        String f9 = AbstractC7990b.f60542s0.f(c9);
        Uri.Builder buildUpon = Uri.parse("https://www.mediafire.com/api/1.5/").buildUpon();
        String p02 = str == null ? c9.p0() : str;
        if (str != null) {
            buildUpon.appendEncodedPath("upload/simple.php").appendQueryParameter("action_on_duplicate", "replace");
            if (!AbstractC7780t.a(f9, "")) {
                buildUpon.appendQueryParameter("folder_key", f9);
            }
        } else {
            buildUpon.appendEncodedPath("upload/update.php").appendQueryParameter("quick_key", f9);
        }
        try {
            this.f6804x0 = null;
            String builder = buildUpon.toString();
            AbstractC7780t.e(builder, "toString(...)");
            HttpURLConnection Q22 = Q2("POST", builder);
            Q22.setReadTimeout(0);
            AbstractC7990b.g gVar = new AbstractC7990b.g(new String[0]);
            if (j9 != -1) {
                gVar.e("X-Filesize", String.valueOf(j9));
            }
            return new d(this, Q22, p02, gVar);
        } catch (IOException e9) {
            throw e9;
        } catch (Exception e10) {
            throw new IOException(k.Q(e10));
        }
    }

    @Override
    public JSONObject S2(String str) {
        JSONObject S22;
        AbstractC7780t.f(str, "uri");
        String str2 = "https://www.mediafire.com/api/1.5/" + str;
        try {
            S22 = super.S2(str2);
        } catch (IOException unused) {
            this.f6804x0 = null;
            try {
                S22 = super.S2(str2);
            } catch (IOException e9) {
                e9.printStackTrace();
                throw e9;
            }
        }
        return f6799A0.c(S22);
    }

    @Override
    public AbstractC7990b.C0993b U2() {
        return f6801C0;
    }

    @Override
    public String V1(String str, String str2) {
        boolean D8;
        AbstractC7780t.f(str, "content");
        if (str2 != null) {
            D8 = w.D(str2, "application/json", false, 2, null);
            if (D8) {
                try {
                    String string = new JSONObject(str).getJSONObject("response").getString("message");
                    AbstractC7780t.c(string);
                    if (string.length() > 0) {
                        return string;
                    }
                } catch (JSONException e9) {
                    e9.printStackTrace();
                }
            }
        }
        return super.V1(str, str2);
    }

    @Override
    public String a() {
        return this.f6805y0;
    }

    @Override
    public Object clone() {
        return super.clone();
    }

    @Override
    public boolean e3() {
        return false;
    }

    @Override
    public int i(String str) {
        return AbstractC7992d.j.a.c(this, str);
    }

    @Override
    public void i3(C c9, String str) {
        String str2;
        AbstractC7780t.f(c9, "le");
        AbstractC7780t.f(str, "newName");
        if (AbstractC7780t.a(c9, this)) {
            super.i3(c9, str);
        } else {
            String f9 = AbstractC7990b.f60542s0.f(c9);
            if (c9.K0()) {
                str2 = "folder/update.php?folder_key=" + f9 + "&foldername=";
            } else {
                str2 = "file/update.php?quick_key=" + f9 + "&filename=";
            }
            if (!z3(str2 + Uri.encode(str))) {
                throw new IOException("Failed to rename");
            }
        }
    }

    @Override
    public void j2(h.f fVar) {
        String str;
        String sb;
        String obj;
        ?? r12;
        AbstractC7780t.f(fVar, "lister");
        super.j2(fVar);
        ?? m9 = fVar.m();
        AbstractC7780t.d(m9, "null cannot be cast to non-null type com.lonelycatgames.Xplore.FileSystem.net.ServerEntry.ServerEntryWithId");
        AbstractC7992d.j jVar = (AbstractC7992d.j) m9;
        boolean o9 = jVar.o("trash");
        if (o9) {
            sb = "device/get_trash.php";
        } else {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("folder/get_content.php");
            String a9 = jVar.a();
            if (a9.length() > 0) {
                str = "?folder_key=" + a9;
            } else {
                str = "";
            }
            sb2.append(str);
            sb = sb2.toString();
        }
        String str2 = sb;
        try {
            Map e9 = f6799A0.e(fVar.m()) ? Q.e(AbstractC6736y.a("in_trash", "")) : null;
            JSONObject S22 = S2(AbstractC7990b.f60542s0.b(str2, "content_type=folders"));
            if (!o9) {
                S22 = S22.getJSONObject("folder_content");
                AbstractC7780t.e(S22, "getJSONObject(...)");
            }
            JSONArray jSONArray = S22.getJSONArray("folders");
            AbstractC7780t.c(jSONArray);
            int length = jSONArray.length();
            int i9 = 0;
            int i10 = 0;
            while (i10 < length) {
                JSONObject jSONObject = (JSONObject) jSONArray.get(i10);
                String string = jSONObject.getString("name");
                String optString = jSONObject.optString("folderkey", "");
                AbstractC7780t.e(optString, "optString(...)");
                int i11 = i10;
                int i12 = length;
                ?? r15 = i9;
                AbstractC7992d.b bVar = new AbstractC7992d.b(this, optString, 0L, e9, 4, null);
                if (jSONObject.optInt("folder_count", -1) == 0 && jSONObject.optInt("file_count", -1) == 0) {
                    r12 = bVar;
                    r12.I1(r15);
                } else {
                    r12 = bVar;
                }
                AbstractC7780t.c(string);
                fVar.c(r12, string);
                i10 = i11 + 1;
                i9 = r15 == true ? 1 : 0;
                length = i12;
            }
            int i13 = i9;
            int i14 = 1;
            while (!fVar.r()) {
                JSONObject S23 = S2(AbstractC7990b.f60542s0.b(str2, "content_type=files") + "&chunk=" + i14);
                if (!o9) {
                    S23 = S23.getJSONObject("folder_content");
                    AbstractC7780t.e(S23, "getJSONObject(...)");
                }
                JSONObject jSONObject2 = S23;
                JSONArray jSONArray2 = jSONObject2.getJSONArray("files");
                AbstractC7780t.c(jSONArray2);
                int length2 = jSONArray2.length();
                int i15 = i13;
                while (i15 < length2) {
                    JSONObject jSONObject3 = (JSONObject) jSONArray2.get(i15);
                    String string2 = jSONObject3.getString("filename");
                    String string3 = jSONObject3.getString(aVJUUIozox.MeyvAwYSHUxHq);
                    HashMap hashMap = this.f6806z0;
                    synchronized (hashMap) {
                    }
                    AbstractC7780t.c(string2);
                    int i16 = i15;
                    JSONArray jSONArray3 = jSONArray2;
                    int i17 = length2;
                    int i18 = i14;
                    JSONObject jSONObject4 = jSONObject2;
                    boolean z8 = o9;
                    C1145n Q12 = Q1(fVar, string2, 0L, jSONObject3.getLong("size"), string3, e9);
                    Object opt = jSONObject3.opt("created");
                    if (opt != null && (obj = opt.toString()) != null) {
                        AbstractC7990b.f60542s0.k(Q12, obj, f6802D0, true);
                        if (Q12.m() != 0) {
                            Q12.m1(Q12.m() - f6803E0.getOffset(Q12.m()));
                        }
                    }
                    fVar.c(Q12, string2);
                    i15 = i16 + 1;
                    o9 = z8;
                    i14 = i18;
                    jSONArray2 = jSONArray3;
                    length2 = i17;
                    jSONObject2 = jSONObject4;
                }
                boolean z9 = o9;
                JSONArray jSONArray4 = jSONArray2;
                int i19 = i14;
                int optInt = jSONObject2.optInt("chunk_size", -1);
                if (optInt == -1 || jSONArray4.length() < optInt) {
                    break;
                }
                i14 = i19 + 1;
                o9 = z9;
                i13 = 0;
            }
        } catch (JSONException e10) {
            e10.printStackTrace();
        }
        if (AbstractC7780t.a(jVar, this)) {
            c cVar = new c();
            String string4 = fVar.g().getString(F.f56481s2);
            AbstractC7780t.e(string4, "getString(...)");
            fVar.c(cVar, string4);
        }
    }

    @Override
    public InputStream k2(C c9, int i9, long j9) {
        AbstractC7780t.f(c9, "le");
        String y32 = y3(c9);
        if (y32 != null) {
            return AbstractC7990b.h3(this, y32, j9, false, 4, null);
        }
        throw new IOException("Can't get download link");
    }

    @Override
    public boolean o(String str) {
        return AbstractC7992d.j.a.b(this, str);
    }

    @Override
    public C1141j o2(C c9) {
        JSONObject jSONObject;
        AbstractC7780t.f(c9, "le");
        String f9 = AbstractC7990b.f60542s0.f(c9);
        if (c9.K0()) {
            jSONObject = S2("folder/get_info.php?folder_key=" + f9).getJSONObject("folder_info");
        } else {
            jSONObject = S2("file/get_info.php?quick_key=" + f9).getJSONObject("file_info");
        }
        String optString = jSONObject.optString("parent_folderkey");
        AbstractC7780t.e(optString, "optString(...)");
        return new AbstractC7992d.b(this, optString, 0L, null, 12, null);
    }

    @Override
    protected void r3() {
        try {
            JSONObject jSONObject = S2("user/get_info.php").getJSONObject("user_info");
            m3(new AbstractC1143l.b(jSONObject.getLong("used_storage_size"), jSONObject.getLong("base_storage") + jSONObject.optLong("bonus_storage")));
            Uri a22 = a2();
            if ((a22 != null ? a22.getFragment() : null) == null) {
                String optString = jSONObject.optString("display_name");
                AbstractC7780t.c(optString);
                if (optString.length() > 0) {
                    i3(this, optString);
                }
            }
        } catch (JSONException e9) {
            e9.printStackTrace();
        }
    }

    @Override
    public String s(String str) {
        return AbstractC7992d.j.a.d(this, str);
    }

    @Override
    public Map t() {
        return AbstractC7992d.j.a.a(this);
    }
}