discord-jadx/app/src/main/java/b/f/m/f.java

207 lines
7.5 KiB
Java
Raw Normal View History

2021-12-17 21:59:34 +00:00
package b.f.m;
2021-07-24 02:37:17 +00:00
import android.content.Context;
import android.util.Log;
2021-12-17 21:59:34 +00:00
import b.c.a.a0.d;
import b.f.m.a;
import b.f.m.m;
2021-07-24 02:37:17 +00:00
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/* compiled from: ExtractFromZipSoSource */
public class f extends m {
public final File f;
public final String g;
/* compiled from: ExtractFromZipSoSource */
public static final class b extends m.b implements Comparable {
2021-12-02 18:53:44 +00:00
public final ZipEntry l;
public final int m;
2021-07-24 02:37:17 +00:00
public b(String str, ZipEntry zipEntry, int i) {
super(str, String.format("pseudo-zip-hash-1-%s-%s-%s-%s", zipEntry.getName(), Long.valueOf(zipEntry.getSize()), Long.valueOf(zipEntry.getCompressedSize()), Long.valueOf(zipEntry.getCrc())));
2021-12-02 18:53:44 +00:00
this.l = zipEntry;
this.m = i;
2021-07-24 02:37:17 +00:00
}
@Override // java.lang.Comparable
public int compareTo(Object obj) {
2021-12-02 18:53:44 +00:00
return this.j.compareTo(((b) obj).j);
2021-07-24 02:37:17 +00:00
}
}
/* compiled from: ExtractFromZipSoSource */
public class c extends m.f {
2021-12-02 18:53:44 +00:00
public b[] j;
public final ZipFile k;
public final m l;
2021-07-24 02:37:17 +00:00
/* compiled from: ExtractFromZipSoSource */
public final class a extends m.e {
2021-12-02 18:53:44 +00:00
public int j;
2021-07-24 02:37:17 +00:00
public a(a aVar) {
}
2021-12-17 21:59:34 +00:00
@Override // b.f.m.m.e
2021-07-24 02:37:17 +00:00
public boolean a() {
c.this.c();
2021-12-02 18:53:44 +00:00
return this.j < c.this.j.length;
2021-07-24 02:37:17 +00:00
}
2021-12-17 21:59:34 +00:00
@Override // b.f.m.m.e
2021-07-24 02:37:17 +00:00
public m.d b() throws IOException {
c.this.c();
c cVar = c.this;
2021-12-02 18:53:44 +00:00
b[] bVarArr = cVar.j;
int i = this.j;
this.j = i + 1;
2021-07-24 02:37:17 +00:00
b bVar = bVarArr[i];
2021-12-02 18:53:44 +00:00
InputStream inputStream = cVar.k.getInputStream(bVar.l);
2021-07-24 02:37:17 +00:00
try {
return new m.d(bVar, inputStream);
} catch (Throwable th) {
if (inputStream != null) {
inputStream.close();
}
throw th;
}
}
}
public c(m mVar) throws IOException {
2021-12-02 18:53:44 +00:00
this.k = new ZipFile(f.this.f);
this.l = mVar;
2021-07-24 02:37:17 +00:00
}
2021-12-17 21:59:34 +00:00
@Override // b.f.m.m.f
2021-07-24 02:37:17 +00:00
public final m.c a() throws IOException {
return new m.c(c());
}
2021-12-17 21:59:34 +00:00
@Override // b.f.m.m.f
2021-07-24 02:37:17 +00:00
public final m.e b() throws IOException {
return new a(null);
}
/* JADX WARNING: Removed duplicated region for block: B:41:0x0120 */
/* JADX WARNING: Removed duplicated region for block: B:42:0x0123 */
public final b[] c() {
int i;
boolean z2;
String str;
2021-12-02 18:53:44 +00:00
if (this.j == null) {
2021-07-24 02:37:17 +00:00
LinkedHashSet linkedHashSet = new LinkedHashSet();
HashMap hashMap = new HashMap();
Pattern compile = Pattern.compile(f.this.g);
2022-01-13 08:07:50 +00:00
String[] C0 = d.C0();
2021-12-02 18:53:44 +00:00
Enumeration<? extends ZipEntry> entries = this.k.entries();
2021-07-24 02:37:17 +00:00
while (true) {
i = 0;
if (!entries.hasMoreElements()) {
break;
}
ZipEntry zipEntry = (ZipEntry) entries.nextElement();
Matcher matcher = compile.matcher(zipEntry.getName());
if (matcher.matches()) {
String group = matcher.group(1);
String group2 = matcher.group(2);
while (true) {
2022-01-13 08:07:50 +00:00
if (i >= C0.length) {
2021-07-24 02:37:17 +00:00
i = -1;
break;
}
2022-01-13 08:07:50 +00:00
if (C0[i] != null && group.equals(C0[i])) {
2021-07-24 02:37:17 +00:00
break;
}
i++;
}
if (i >= 0) {
linkedHashSet.add(group);
b bVar = (b) hashMap.get(group2);
2021-12-02 18:53:44 +00:00
if (bVar == null || i < bVar.m) {
2021-07-24 02:37:17 +00:00
hashMap.put(group2, new b(group2, zipEntry, i));
}
}
}
}
2021-12-02 18:53:44 +00:00
m mVar = this.l;
2021-07-24 02:37:17 +00:00
String[] strArr = (String[]) linkedHashSet.toArray(new String[linkedHashSet.size()]);
Objects.requireNonNull(mVar);
b[] bVarArr = (b[]) hashMap.values().toArray(new b[hashMap.size()]);
Arrays.sort(bVarArr);
int i2 = 0;
for (int i3 = 0; i3 < bVarArr.length; i3++) {
b bVar2 = bVarArr[i3];
2021-12-02 18:53:44 +00:00
ZipEntry zipEntry2 = bVar2.l;
String str2 = bVar2.j;
2022-02-02 08:50:56 +00:00
a.C0070a aVar = (a.C0070a) this;
2021-07-24 02:37:17 +00:00
String name = zipEntry2.getName();
if (str2.equals(a.this.d)) {
a.this.d = null;
str = String.format("allowing consideration of corrupted lib %s", str2);
2021-12-02 18:53:44 +00:00
} else if ((aVar.o & 1) == 0) {
2021-12-17 21:59:34 +00:00
str = b.d.b.a.a.w("allowing consideration of ", name, ": self-extraction preferred");
2021-07-24 02:37:17 +00:00
} else {
2021-12-02 18:53:44 +00:00
File file = new File(aVar.n, str2);
2021-07-24 02:37:17 +00:00
if (!file.isFile()) {
str = String.format("allowing considering of %s: %s not in system lib dir", name, str2);
} else {
long length = file.length();
long size = zipEntry2.getSize();
if (length != size) {
str = String.format("allowing consideration of %s: sysdir file length is %s, but the file is %s bytes long in the APK", file, Long.valueOf(length), Long.valueOf(size));
} else {
2021-12-17 21:59:34 +00:00
str = b.d.b.a.a.w("not allowing consideration of ", name, ": deferring to libdir");
2021-07-24 02:37:17 +00:00
z2 = false;
Log.d("ApkSoSource", str);
if (!z2) {
i2++;
} else {
bVarArr[i3] = null;
}
}
}
}
z2 = true;
Log.d("ApkSoSource", str);
if (!z2) {
}
}
b[] bVarArr2 = new b[i2];
int i4 = 0;
while (i < bVarArr.length) {
b bVar3 = bVarArr[i];
if (bVar3 != null) {
bVarArr2[i4] = bVar3;
i4++;
}
i++;
}
2021-12-02 18:53:44 +00:00
this.j = bVarArr2;
2021-07-24 02:37:17 +00:00
}
2021-12-02 18:53:44 +00:00
return this.j;
2021-07-24 02:37:17 +00:00
}
2021-12-17 21:59:34 +00:00
@Override // b.f.m.m.f, java.io.Closeable, java.lang.AutoCloseable
2021-07-24 02:37:17 +00:00
public void close() throws IOException {
2021-12-02 18:53:44 +00:00
this.k.close();
2021-07-24 02:37:17 +00:00
}
}
public f(Context context, String str, File file, String str2) {
super(context, str);
this.f = file;
this.g = str2;
}
}