X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f
以下内容为反编译后的 j.java 源代码,内容仅作参考
package K6;
import E7.GoWq.crhKwHUeawinK;
import F6.AbstractC1142k;
import F6.AbstractC1143l;
import F6.C;
import F6.C1141j;
import F6.C1145n;
import F7.C1160d;
import F7.t;
import F7.w;
import P.AbstractC1363o;
import P.InterfaceC1357l;
import android.net.Uri;
import b7.K;
import com.lonelycatgames.Xplore.App;
import com.lonelycatgames.Xplore.FileSystem.h;
import com.lonelycatgames.Xplore.a;
import h7.AbstractC6736y;
import h7.C6709J;
import h7.C6730s;
import i7.Q;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import org.xmlpull.v1.XmlPullParserException;
import t6.k;
import u6.AbstractC7556B;
import v7.p;
import w0.VHo.EgGm;
import w7.AbstractC7771k;
import w7.AbstractC7777q;
import w7.AbstractC7780t;
import w7.C7759S;
import z.InterfaceC7946a;
import z6.AbstractC7990b;
import z6.AbstractC7992d;
import z6.C7989a;
public final class j extends K6.c {
public static final c f6828C0 = new c(null);
public static final int f6829D0 = 8;
private static final AbstractC7990b.C0993b f6830E0 = new a(AbstractC7556B.f55804u1, b.f6837I);
private static final SimpleDateFormat f6831F0 = new SimpleDateFormat("y-M-d'T'H:m:s", Locale.US);
private String f6832A0;
private String f6833B0;
private String f6834x0;
private String f6835y0;
private String f6836z0;
public static final class a extends AbstractC7990b.C0993b {
a(int i9, b bVar) {
super(i9, "SugarSync", bVar, false, 8, null);
}
@Override
public boolean a(App app) {
AbstractC7780t.f(app, "app");
return false;
}
}
class b extends AbstractC7777q implements p {
public static final b f6837I = new b();
b() {
super(2, j.class, "<init>", "<init>(Lcom/lonelycatgames/Xplore/FileSystem/net/CloudFileSystem;Landroid/net/Uri;)V", 0);
}
@Override
public final j r(C7989a c7989a, Uri uri) {
AbstractC7780t.f(c7989a, "p0");
AbstractC7780t.f(uri, "p1");
int i9 = 3 << 0;
return new j(c7989a, uri, null);
}
}
public static final class c {
private c() {
}
public c(AbstractC7771k abstractC7771k) {
this();
}
public final String f(String str) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + str;
}
public final K g(HttpURLConnection httpURLConnection) {
try {
InputStream inputStream = httpURLConnection.getInputStream();
AbstractC7780t.e(inputStream, "getInputStream(...)");
return new K(inputStream, null, false);
} catch (XmlPullParserException e9) {
throw new IOException(e9.getMessage());
}
}
public final String h(C c9) {
boolean D8;
AbstractC7780t.d(c9, "null cannot be cast to non-null type com.lonelycatgames.Xplore.FileSystem.net.ServerEntry.ServerEntryWithId");
String a9 = ((AbstractC7992d.j) c9).a();
D8 = w.D(a9, "https://api.sugarsync.com/", false, 2, null);
if (!D8) {
a9 = "https://api.sugarsync.com/" + a9;
}
return a9;
}
public final long j(Date date) {
return date.getTime() + TimeZone.getDefault().getOffset(date.getTime());
}
public final String k(String str) {
boolean D8;
D8 = w.D(str, "https://api.sugarsync.com/", false, 2, null);
if (D8) {
str = str.substring(26);
AbstractC7780t.e(str, "substring(...)");
}
return str;
}
public final AbstractC7990b.C0993b i() {
return j.f6830E0;
}
public final String l(CharSequence charSequence) {
AbstractC7780t.f(charSequence, "t");
StringBuilder sb = new StringBuilder();
for (int i9 = 0; i9 < charSequence.length(); i9++) {
char charAt = charSequence.charAt(i9);
if (charAt == '<') {
sb.append("<");
} else if (charAt == '>') {
sb.append(">");
} else if (charAt == '\"') {
sb.append("&guot;");
} else if (charAt == '&') {
sb.append("&");
} else if (charAt > '~') {
t.h(sb, "&#", Integer.valueOf(charAt), ';');
} else {
sb.append(charAt);
}
}
String sb2 = sb.toString();
AbstractC7780t.e(sb2, "let(...)");
return sb2;
}
}
public static final class d extends AbstractC7992d.b {
final boolean f6839k0;
final String f6840l0;
d(Map map, boolean z8, String str, String str2) {
super(j.this, str2, 0L, map, 4, null);
this.f6839k0 = z8;
this.f6840l0 = str;
}
@Override
public Object clone() {
return super.clone();
}
@Override
public void k1(InterfaceC7946a interfaceC7946a, b0.g gVar, InterfaceC1357l interfaceC1357l, int i9) {
AbstractC7780t.f(interfaceC7946a, "<this>");
AbstractC7780t.f(gVar, "modifier");
interfaceC1357l.e(1141167897);
if (AbstractC1363o.G()) {
AbstractC1363o.S(1141167897, i9, -1, "com.lonelycatgames.Xplore.clouds.SugarSyncServer.createDirEntry.<anonymous>.<no name provided>.DrawIconOverlay (SugarSyncServer.kt:148)");
}
if (this.f6839k0) {
String str = this.f6840l0;
if (AbstractC7780t.a(str, j.this.f6833B0)) {
interfaceC1357l.e(1920757592);
AbstractC1142k.a(interfaceC7946a, gVar, interfaceC1357l, (i9 & 112) | (i9 & 14));
interfaceC1357l.M();
} else if (AbstractC7780t.a(str, j.this.f6836z0)) {
interfaceC1357l.e(1920757670);
AbstractC1142k.e(interfaceC7946a, gVar, interfaceC1357l, (i9 & 112) | (i9 & 14));
interfaceC1357l.M();
} else if (AbstractC7780t.a(str, j.this.f6832A0)) {
interfaceC1357l.e(1920757756);
AbstractC1142k.f(interfaceC7946a, gVar, interfaceC1357l, (i9 & 112) | (i9 & 14));
interfaceC1357l.M();
} else {
interfaceC1357l.e(1920757811);
interfaceC1357l.M();
}
}
if (AbstractC1363o.G()) {
AbstractC1363o.R();
}
interfaceC1357l.M();
}
}
public static final class e extends AbstractC7990b.e {
final C f6841E;
e(HttpURLConnection httpURLConnection, C c9) {
super(j.this, httpURLConnection);
this.f6841E = c9;
}
@Override
public void f(int i9) {
if (i9 >= 300) {
super.f(i9);
}
Cloneable u02 = this.f6841E.u0();
AbstractC7780t.d(u02, "null cannot be cast to non-null type com.lonelycatgames.Xplore.FileSystem.net.CloudFileSystem.EntryWithChildNames");
((C7989a.b) u02).E().add(this.f6841E.p0());
j.this.o3(true);
}
}
private j(C7989a c7989a, Uri uri) {
super(c7989a, AbstractC7556B.f55804u1);
t2(uri);
}
public j(C7989a c7989a, Uri uri, AbstractC7771k abstractC7771k) {
this(c7989a, uri);
}
private final synchronized void B3() {
try {
if (this.f6834x0 == null) {
G3();
}
} catch (Throwable th) {
throw th;
}
}
private final C1141j C3(K.c cVar, boolean z8) {
K.c c9;
K.c c10 = cVar.c("displayName");
d dVar = null;
if (c10 == null || (c9 = cVar.c("ref")) == null) {
return null;
}
String k9 = c9.k();
if (k9 != null) {
dVar = new d(z8 ? Q.e(AbstractC6736y.a("root", "")) : null, z8, k9, f6828C0.k(k9));
String k10 = c10.k();
if (k10 == null) {
throw new IllegalArgumentException("Required value was null.".toString());
}
dVar.c1(k10);
}
return dVar;
}
private final HttpURLConnection D3(String str, String str2) {
HttpURLConnection httpURLConnection;
B3();
URLConnection openConnection = new URL(str).openConnection();
AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection2 = (HttpURLConnection) openConnection;
if (str2 != null) {
httpURLConnection2.setRequestMethod(str2);
}
E3(httpURLConnection2);
int responseCode = httpURLConnection2.getResponseCode();
if (responseCode < 300) {
return httpURLConnection2;
}
if (responseCode == 401 && AbstractC7780t.a(httpURLConnection2.getResponseMessage(), "Unauthorized") && this.f6834x0 != null) {
try {
F3();
URLConnection openConnection2 = new URL(str).openConnection();
AbstractC7780t.d(openConnection2, "null cannot be cast to non-null type java.net.HttpURLConnection");
httpURLConnection = (HttpURLConnection) openConnection2;
} catch (h.d e9) {
e = e9;
}
try {
E3(httpURLConnection);
if (httpURLConnection.getResponseCode() < 300) {
return httpURLConnection;
}
httpURLConnection2 = httpURLConnection;
} catch (h.d e10) {
e = e10;
httpURLConnection2 = httpURLConnection;
e.printStackTrace();
throw new IOException(X1(httpURLConnection2));
}
}
throw new IOException(X1(httpURLConnection2));
}
private final void E3(HttpURLConnection httpURLConnection) {
httpURLConnection.addRequestProperty("User-Agent", V().o0());
String str = this.f6834x0;
if (str != null) {
httpURLConnection.addRequestProperty("Authorization", str);
}
}
private final void F3() {
c cVar = f6828C0;
StringBuilder sb = new StringBuilder();
sb.append("<authRequest><username>");
String w32 = w3();
String str = "";
if (w32 == null) {
w32 = "";
}
sb.append(cVar.l(w32));
sb.append("</username><password>");
String v32 = v3();
if (v32 != null) {
str = v32;
}
sb.append(cVar.l(str));
sb.append("</password><accessKeyId>Mjg4NjMyMzEzMzM1MTQzNjUwOTg</accessKeyId><privateAccessKey>MGUzZDViMDViZTVjNGFkMmJlZWU4ODAxZTRkZWQ1NWQ</privateAccessKey></authRequest>");
String f9 = cVar.f(sb.toString());
this.f6834x0 = null;
try {
HttpURLConnection M32 = M3("https://api.sugarsync.com/authorization", "POST", f9);
this.f6834x0 = M32.getHeaderField("Location");
K.c a9 = cVar.g(M32).a("authorization/user");
if (a9 == null) {
throw new h.j("Invalid authorization");
}
this.f6835y0 = a9.k();
} catch (IOException e9) {
throw new h.j(k.Q(e9));
}
}
private final void G3() {
F3();
try {
r3();
} catch (IOException e9) {
throw new h.j(k.Q(e9));
}
}
private final K H3(String str) {
return f6828C0.g(D3(str, null));
}
private final void I3(h.f fVar, K k9) {
Iterator it = k9.b("collectionContents/collection").iterator();
while (it.hasNext()) {
C1141j C32 = C3((K.c) it.next(), AbstractC7780t.a(fVar.m(), this));
if (C32 != null) {
fVar.d(C32);
}
}
}
private final void J3(h.f fVar) {
I3(fVar, H3(this.f6835y0 + "/folders/contents"));
}
private final HttpURLConnection K3(String str, String str2) {
B3();
return M3(str, "POST", str2);
}
private final void L3(String str, String str2) {
B3();
M3(str, "PUT", str2);
}
private final HttpURLConnection M3(String str, String str2, String str3) {
URLConnection openConnection = new URL(str).openConnection();
AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setRequestMethod(str2);
httpURLConnection.setRequestProperty("Content-Type", "application/xml; charset=UTF-8");
E3(httpURLConnection);
int i9 = 4 >> 1;
httpURLConnection.setDoOutput(true);
byte[] bytes = str3.getBytes(C1160d.f4033b);
AbstractC7780t.e(bytes, "getBytes(...)");
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
try {
OutputStream outputStream = httpURLConnection.getOutputStream();
AbstractC7780t.e(outputStream, "getOutputStream(...)");
t7.b.b(byteArrayInputStream, outputStream, 0, 2, null);
t7.c.a(byteArrayInputStream, null);
if (httpURLConnection.getResponseCode() < 300) {
return httpURLConnection;
}
throw new IOException(X1(httpURLConnection));
} finally {
}
}
@Override
public boolean B2() {
return true;
}
@Override
public boolean F2(C1141j c1141j) {
AbstractC7780t.f(c1141j, "de");
return G2(c1141j);
}
@Override
public boolean G2(C1141j c1141j) {
AbstractC7780t.f(c1141j, "de");
return !AbstractC7780t.a(c1141j, this);
}
@Override
public boolean H2(C c9) {
AbstractC7780t.f(c9, "le");
return (!(c9 instanceof AbstractC7992d.j) || AbstractC7780t.a(c9, this) || ((AbstractC7992d.j) c9).o("root")) ? false : true;
}
@Override
public C1141j P2(C1141j c1141j, String str) {
AbstractC7780t.f(c1141j, "parent");
AbstractC7780t.f(str, "name");
c cVar = f6828C0;
String l9 = cVar.l(str);
C7759S c7759s = C7759S.f58210a;
String format = String.format(Locale.US, "<folder><displayName>%s</displayName></folder>", Arrays.copyOf(new Object[]{l9}, 1));
AbstractC7780t.e(format, "format(...)");
String headerField = K3(cVar.h(c1141j), cVar.f(format)).getHeaderField("Location");
AbstractC7780t.e(headerField, "getHeaderField(...)");
boolean z8 = true & false;
return new AbstractC7992d.b(this, cVar.k(headerField), 0L, null, 12, null);
}
@Override
public void R2(C c9) {
AbstractC7780t.f(c9, "le");
c cVar = f6828C0;
String h9 = cVar.h(c9);
if (!c9.H0()) {
C7759S c7759s = C7759S.f58210a;
String format = String.format(Locale.US, "<file><parent>%s</parent></file>", Arrays.copyOf(new Object[]{this.f6836z0}, 1));
AbstractC7780t.e(format, "format(...)");
try {
L3(h9, cVar.f(format));
return;
} catch (IOException e9) {
e9.printStackTrace();
}
}
D3(h9, "DELETE");
}
@Override
public OutputStream S1(C c9, String str, long j9, Long l9) {
C6730s a9;
AbstractC7780t.f(c9, "le");
if (str == null) {
StringBuilder sb = new StringBuilder();
c cVar = f6828C0;
sb.append(cVar.h(c9));
sb.append(crhKwHUeawinK.JlnHZVWpCbdRuxi);
a9 = AbstractC6736y.a(sb.toString(), cVar.f("<file></file>"));
} else {
if (!(c9 instanceof AbstractC7992d.j)) {
throw new IOException("Can't create file under " + c9);
}
c cVar2 = f6828C0;
String h9 = cVar2.h(c9);
C7759S c7759s = C7759S.f58210a;
Locale locale = Locale.US;
int i9 = 6 & 2;
Object[] objArr = new Object[2];
objArr[0] = cVar2.l(str);
String C02 = V().C0(str);
if (C02 == null) {
C02 = "application/octet-stream";
}
objArr[1] = C02;
String format = String.format(locale, "<file><displayName>%s</displayName><mediaType>%s</mediaType></file>", Arrays.copyOf(objArr, 2));
AbstractC7780t.e(format, "format(...)");
a9 = AbstractC6736y.a(h9, cVar2.f(format));
}
URLConnection openConnection = new URL(K3((String) a9.a(), (String) a9.b()).getHeaderField("Location") + "/data").openConnection();
AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setRequestMethod("PUT");
E3(httpURLConnection);
httpURLConnection.setChunkedStreamingMode(16384);
try {
e eVar = new e(httpURLConnection, c9);
eVar.i();
return eVar;
} catch (IOException e9) {
throw e9;
} catch (Exception e10) {
throw new IOException(k.Q(e10));
}
}
@Override
public AbstractC7990b.C0993b U2() {
return f6830E0;
}
@Override
public Object clone() {
return super.clone();
}
@Override
public void d3(C c9, C1141j c1141j, String str) {
AbstractC7780t.f(c9, "le");
AbstractC7780t.f(c1141j, "newParent");
c cVar = f6828C0;
String h9 = cVar.h(c9);
String h10 = cVar.h(c1141j);
C7759S c7759s = C7759S.f58210a;
String format = String.format(Locale.US, c9.K0() ? "<folder><parent>%s</parent></folder>" : "<file><parent>%s</parent></file>", Arrays.copyOf(new Object[]{h10}, 1));
AbstractC7780t.e(format, "format(...)");
L3(h9, cVar.f(format));
if (str != null) {
i3(c9, str);
}
}
@Override
public void i3(C c9, String str) {
AbstractC7780t.f(c9, "le");
AbstractC7780t.f(str, "newName");
if (AbstractC7780t.a(c9, this)) {
j3(str);
} else {
C7759S c7759s = C7759S.f58210a;
Locale locale = Locale.US;
String str2 = c9.K0() ? "<folder><displayName>%s</displayName></folder>" : EgGm.rfPDKD;
c cVar = f6828C0;
String format = String.format(locale, str2, Arrays.copyOf(new Object[]{cVar.l(str)}, 1));
AbstractC7780t.e(format, "format(...)");
L3(cVar.h(c9), cVar.f(format));
}
}
@Override
public void j2(h.f fVar) {
String v32;
long j9;
String k9;
AbstractC7780t.f(fVar, "lister");
String w32 = w3();
if (w32 == null || w32.length() == 0 || (v32 = v3()) == null || v32.length() == 0) {
throw new h.j(null, 1, null);
}
fVar.C(f6830E0.e());
if (X2()) {
r3();
}
if (AbstractC7780t.a(fVar.m(), this)) {
J3(fVar);
return;
}
K H32 = H3(f6828C0.h(fVar.m()) + "/contents");
I3(fVar, H32);
for (K.c cVar : H32.b("collectionContents/file")) {
K.c c9 = cVar.c("displayName");
K.c c10 = cVar.c("ref");
if (c9 != null && c10 != null) {
String k10 = c9.k();
String str = k10 == null ? "" : k10;
K.c c11 = cVar.c("size");
K.c c12 = cVar.c("lastModified");
long j10 = 0;
if (c11 != null) {
String k11 = c11.k();
j9 = Math.max(0L, k11 != null ? Long.parseLong(k11) : 0L);
} else {
j9 = 0;
}
if (c12 != null && (k9 = c12.k()) != null) {
try {
Date parse = f6831F0.parse(k9);
if (parse != null) {
AbstractC7780t.c(parse);
j10 = f6828C0.j(parse);
C6709J c6709j = C6709J.f49946a;
}
} catch (Exception e9) {
e9.printStackTrace();
C6709J c6709j2 = C6709J.f49946a;
}
}
c cVar2 = f6828C0;
String k12 = c10.k();
String str2 = str;
C1145n R12 = AbstractC7992d.R1(this, fVar, str, j10, j9, cVar2.k(k12 != null ? k12 : ""), null, 32, null);
K.c c13 = cVar.c("presentOnServer");
if (c13 != null && AbstractC7780t.a(c13.k(), "false")) {
if (fVar.t()) {
R12.Z0(true);
}
}
fVar.c(R12, str2);
}
}
}
@Override
public InputStream k2(C c9, int i9, long j9) {
int i10;
AbstractC7780t.f(c9, "le");
String str = f6828C0.h(c9) + "/data";
B3();
URLConnection openConnection = new URL(str).openConnection();
AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
if ((i9 == 1 || i9 == 2) && AbstractC7780t.a(c9.A(), "image/jpeg")) {
a.C0632a c0632a = com.lonelycatgames.Xplore.a.f45553S;
int a9 = i9 == 1 ? c0632a.a() : c0632a.b();
C7759S c7759s = C7759S.f58210a;
String format = String.format(Locale.US, "image/jpeg; pxmax=%d; pymax=10000;", Arrays.copyOf(new Object[]{Integer.valueOf(a9)}, 1));
AbstractC7780t.e(format, "format(...)");
httpURLConnection.addRequestProperty("Accept", format);
}
E3(httpURLConnection);
if (j9 > 0) {
AbstractC7992d.C0994d.b(AbstractC7992d.f60582j0, httpURLConnection, j9, 0L, 2, null);
i10 = 206;
} else {
i10 = 200;
}
if (httpURLConnection.getResponseCode() != i10) {
throw new IOException(X1(httpURLConnection));
}
InputStream inputStream = httpURLConnection.getInputStream();
AbstractC7780t.e(inputStream, "getInputStream(...)");
return inputStream;
}
@Override
public C1141j o2(C c9) {
AbstractC7780t.f(c9, "le");
c cVar = f6828C0;
K.c a9 = H3(cVar.h(c9)).a("file/parent");
String k9 = a9 != null ? a9.k() : null;
if (k9 == null) {
k9 = "";
}
return new AbstractC7992d.b(this, cVar.k(k9), 0L, null, 12, null);
}
@Override
protected void r3() {
String k9;
String k10;
K.c a9 = f6828C0.g(D3("https://api.sugarsync.com/user", null)).a("user");
if (a9 != null) {
K.c c9 = a9.c("deleted");
this.f6836z0 = c9 != null ? c9.k() : null;
K.c c10 = a9.c("magicBriefcase");
this.f6832A0 = c10 != null ? c10.k() : null;
K.c c11 = a9.c("mobilePhotos");
this.f6833B0 = c11 != null ? c11.k() : null;
K.c c12 = a9.c("quota/usage");
long j9 = 0;
long parseLong = (c12 == null || (k10 = c12.k()) == null) ? 0L : Long.parseLong(k10);
K.c c13 = a9.c("quota/limit");
if (c13 != null && (k9 = c13.k()) != null) {
j9 = Long.parseLong(k9);
}
m3(new AbstractC1143l.b(parseLong, j9));
}
o3(false);
}
}