Luскy*Patcher v11.1.8版本的 MD5 值为:260a307cc4cd8550bbc248b8d7c0bddc
以下内容为反编译后的 C2972.java 源代码,内容仅作参考
package p065;
import android.database.sqlite.SQLiteDatabase;
import android.util.Base64;
import com.unity3d.ads.metadata.MediationMetaData;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import net.lingala.zip4j.util.InternalZipConstants;
import org.jf.dexlib2.analysis.RegisterType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import p058.C2799;
import p058.C2800;
import p064.C2880;
import p066.C2979;
import p067.C2984;
import p067.C2985;
import p067.C2986;
import p067.C2989;
import p067.C2990;
import p067.C2991;
import p067.C2994;
import p067.C2995;
import p067.C2996;
import p067.C3003;
import p067.C3004;
import p067.C3005;
import p067.C3006;
import p067.C3007;
import p067.C3009;
import p112.C3305;
import p112.C3348;
import p113.C3923;
import ru.aaaaabbd.installer.R;
import sun.security.x509.PolicyMappingsExtension;
public class C2972 {
public static String f7912 = "Error LP:";
public boolean f7913 = false;
public boolean f7939 = false;
public boolean f7941 = false;
public boolean f7943 = false;
public boolean f7945 = false;
public boolean f7947 = false;
public boolean f7949 = false;
public boolean f7951 = false;
public boolean f7953 = false;
public boolean f7955 = false;
public boolean f7957 = false;
public boolean f7959 = false;
public File f7961 = null;
public File[] f7963 = null;
public File[] f7965 = null;
public File[] f7967 = null;
public ArrayList<File> f7969 = null;
public ArrayList<File> f7971 = new ArrayList<>();
public ArrayList<File> f7973 = new ArrayList<>();
public String f7975 = "";
public String f7977 = "";
public String f7979 = "";
public String f7981 = "";
public File f7983 = null;
public int f7985 = 0;
public int f7986 = 0;
public int f7970 = 0;
public File f7972 = null;
public String f7914 = "not_system";
public String f7942 = "";
public String f7940 = "";
public String f7946 = "";
public String f7944 = "";
public String f7966 = "";
public String f7948 = "";
public String f7952 = "";
public String f7950 = "";
public String f7956 = "";
public String f7954 = "";
public String f7960 = "";
public String f7958 = "";
public boolean f7962 = false;
public boolean f7976 = false;
public boolean f7964 = false;
public boolean f7974 = false;
public ArrayList<File> f7978 = new ArrayList<>();
public File f7980 = null;
public String f7982 = "";
public int f7968 = -1;
public int f7984 = -1;
public int f7915 = -1;
public int f7916 = -1;
public ArrayList<String> f7917 = new ArrayList<>();
public ArrayList<String> f7918 = new ArrayList<>();
public File f7919 = null;
public ArrayList<C2995> f7920 = new ArrayList<>();
public String f7921 = "";
public boolean f7922 = false;
public boolean f7923 = false;
public boolean f7924 = false;
public boolean f7925 = false;
public boolean f7926 = false;
public boolean f7927 = false;
public boolean f7928 = false;
public boolean f7929 = false;
public boolean f7930 = false;
public boolean f7931 = false;
public String f7932 = "";
public boolean f7933 = false;
public String f7934 = "";
public boolean f7935 = false;
public boolean f7936 = false;
public File f7937 = null;
public ArrayList<C3003> f7938 = new ArrayList<>();
public class RunnableC2973 implements Runnable {
RunnableC2973() {
}
@Override
public void run() {
String str = C3348.f9859;
C3348.m12367(C2880.m11423(R.string.warning), C2880.m11423(R.string.messageAndroidManifest));
C3348.f9907 = "";
C3348.m12356(23);
C3348.m12375();
}
}
public class RunnableC2974 implements Runnable {
RunnableC2974() {
}
@Override
public void run() {
String str = C3348.f9859;
C3348.m12367(C2880.m11423(R.string.warning), C2880.m11423(R.string.messageAndroidManifest));
C3348.f9907 = "";
C3348.m12356(23);
C3348.m12375();
}
}
void m11643(int i, ArrayList<String> arrayList, String str, String str2, String str3) {
if (i >= arrayList.size()) {
arrayList.add(i, "");
}
arrayList.set(i, arrayList.get(i).replace(str, str2) + str3);
}
public void m11644(String str) {
try {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step6), "", 6, 6, false);
if (this.f7919.getName().contains("patch.by.sanx_com.maxmpz.audioplayer")) {
C3348.f9870.m12443();
}
if (this.f7919.getName().contains("patch_ren.by.ramzezzz_com.maxmpz.audioplayer.txt")) {
C3348.f9870.m12444();
}
if (this.f7919.getName().contains("patch.by.sanx_com.emulator.fpse")) {
C3348.f9870.m12417();
}
C2880.m11467(this.f7977);
} catch (Exception e) {
e.printStackTrace();
C3348.m12347("luuuuu " + e);
}
}
boolean m11645(File file, FileChannel fileChannel, MappedByteBuffer mappedByteBuffer, byte[] bArr, int i, C3004[] c3004Arr, int i2, C2986 c2986) throws IOException {
byte[] bArr2;
int i3;
byte b;
int i4;
byte b2;
int i5;
int i6;
MappedByteBuffer mappedByteBuffer2 = mappedByteBuffer;
int i7 = 0;
byte b3 = bArr[i + 0];
int i8 = 0;
while (true) {
C3004 c3004 = c3004Arr[i2];
if (b3 != c3004.f8166[i8] && (i6 = c3004.f8167[i8]) != 1 && (i6 <= 1 || b3 != c2986.f8052.get(i6 - 2).byteValue())) {
return false;
}
C3004 c30042 = c3004Arr[i2];
byte[] bArr3 = c30042.f8168;
if (i8 < bArr3.length) {
byte[] bArr4 = c30042.f8169;
bArr4[i8] = bArr3[i8];
try {
i5 = c30042.f8170[i8];
if (i5 == 0) {
bArr4[i8] = b3;
}
} catch (Exception e) {
e.printStackTrace();
}
if (i5 > 1 && i5 < 253) {
byte b4 = bArr3[i8];
if (b4 != 0) {
if (b4 != 1) {
if (b4 == 96) {
try {
bArr4[i8] = c2986.f8052.get(i5 - 2).byteValue();
} catch (Exception unused) {
int i9 = c3004Arr[i2].f8170[i8] - 2;
c2986.m11680("Byte N" + i9 + " not found! Please edit search pattern for byte " + i9 + ".", file);
}
}
} else {
try {
bArr4[i8] = (byte) ((i5 - 2) + b3);
} catch (Exception e2) {
e2.printStackTrace();
c2986.m11680(f7912 + "Cannot read addition a number.", file);
}
}
} else {
try {
bArr4[i8] = (byte) (b3 - (i5 - 2));
} catch (Exception e3) {
e3.printStackTrace();
c2986.m11680(f7912 + "Cannot read subtract a number.", file);
}
}
e.printStackTrace();
}
C3004 c30043 = c3004Arr[i2];
int i10 = c30043.f8170[i8];
if (i10 == 253) {
byte[] bArr5 = c30043.f8169;
int i11 = b3 & RegisterType.DOUBLE_HI;
bArr5[i8] = (byte) (i11 + (i11 * 16));
}
if (i10 == 255) {
int i12 = c30043.f8171[i8];
if (b3 < 16) {
c30043.f8169[i8] = (byte) ((b3 & RegisterType.DOUBLE_HI) + (i12 * 16));
} else {
if (i8 >= 7 && (((b = (bArr2 = c30043.f8166)[i8 - 1]) == 10 || b == 12) && ((b2 = bArr2[i8 - 7]) == 110 || b2 == 111 || b2 == 113 || b2 == 114 || b2 == 116 || b2 == 117 || b2 == 118 || b2 == 119 || b2 == 120))) {
byte[] bArr6 = c30043.f8169;
bArr6[i4] = 0;
bArr6[i8 - 6] = 0;
bArr6[i8 - 5] = 0;
bArr6[i8 - 4] = 0;
bArr6[i8 - 3] = 19;
bArr6[i8 - 2] = b3;
bArr6[i3] = (byte) ((b3 & RegisterType.DOUBLE_HI) + (i12 * 16));
bArr6[i8] = 0;
}
byte b5 = c30043.f8166[i8 - 1];
if (b5 != 10 && b5 != 12) {
c30043.f8169[i8] = (byte) ((b3 & RegisterType.DOUBLE_HI) + (i12 * 16));
}
}
}
}
i8++;
C3004 c30044 = c3004Arr[i2];
byte[] bArr7 = c30044.f8166;
if (i8 == bArr7.length) {
if (c30044.f8175 || c30044.f8168.length != bArr7.length) {
C3348.m12347("run insert logic patch");
try {
mappedByteBuffer2.position((i + i8) - 1);
int size = ((int) fileChannel.size()) - mappedByteBuffer.position();
byte[] bArr8 = new byte[size];
mappedByteBuffer2.get(bArr8, 0, size);
ByteBuffer wrap = ByteBuffer.wrap(bArr8);
C3004 c30045 = c3004Arr[i2];
int length = c30045.f8168.length;
int length2 = c30045.f8166.length;
if (length >= length2) {
while (true) {
C3004 c30046 = c3004Arr[i2];
byte[] bArr9 = c30046.f8168;
if (i8 >= bArr9.length) {
break;
}
c30046.f8169[i8] = bArr9[i8];
i8++;
}
fileChannel.position(r0 + (length - length2));
} else {
i7 = length2 - length;
fileChannel.position(r0 - i7);
}
fileChannel.write(wrap);
fileChannel.truncate(fileChannel.size() - i7);
mappedByteBuffer2 = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) fileChannel.size());
} catch (Throwable th) {
th.printStackTrace();
}
}
fileChannel.position(i);
fileChannel.write(ByteBuffer.wrap(c3004Arr[i2].f8169));
mappedByteBuffer2.force();
return true;
}
int i13 = i + i8;
if (i13 >= bArr.length) {
return false;
}
b3 = bArr[i13];
}
}
public void m11646() {
String m11556;
?? arrayList;
C2880.m11467(this.f7977);
try {
C2880.m11292(this.f7983, new File(this.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + this.f7977 + ".apk"));
m11556 = C2880.m11556(this.f7977);
arrayList = new ArrayList();
} catch (Exception e) {
e.printStackTrace();
}
if (this.f7980.exists()) {
int i = 0;
Object obj = null;
try {
try {
if (!this.f7954.contains("DeepWork")) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_progress_strings_analisis), "%1d/%2d", 3, 6, false);
String[] m12294 = new C3305().m12294(this.f7980);
String[] m12295 = new C3305().m12295(this.f7980);
if (m12294 != null && m12294.length > 0) {
for (String str : m12294) {
arrayList.add(str);
}
}
if (m12295 != null && m12295.length > 0) {
for (String str2 : m12295) {
arrayList.add(str2);
}
}
String[] strArr = (String[]) arrayList.toArray(new String[arrayList.size()]);
arrayList = strArr;
if (!new C3305().m12292(this.f7980, this.f7977, m11556)) {
C3348.m12347("LP error: package name not changed:(");
arrayList = strArr;
}
} else {
String[] m122942 = new C3305().m12294(this.f7980);
String[] m122952 = new C3305().m12295(this.f7980);
if (m122942 != null && m122942.length > 0) {
for (int i2 = 0; i2 < m122942.length; i2++) {
if (!m122942[i2].contains(this.f7977)) {
arrayList.add(m122942[i2]);
}
}
}
if (m122952 != null && m122952.length > 0) {
for (int i3 = 0; i3 < m122952.length; i3++) {
if (!m122952[i3].contains(this.f7977)) {
arrayList.add(m122952[i3]);
}
}
}
arrayList.add(this.f7977);
arrayList.add("Java_" + this.f7977.replaceAll("\\.", "_"));
arrayList.add(this.f7977.replaceAll("\\.", "\\/"));
String[] strArr2 = (String[]) arrayList.toArray(new String[arrayList.size()]);
C2880.m11498(this.f7980.getAbsolutePath(), strArr2);
arrayList = strArr2;
}
} catch (Exception e2) {
e = e2;
obj = arrayList;
e.printStackTrace();
arrayList = obj;
if (!this.f7954.contains("DeepWork")) {
}
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step3), "%1d/%2d", 3, 6, false);
if (!this.f7980.exists()) {
}
}
} catch (Exception e3) {
e = e3;
}
if (!this.f7954.contains("DeepWork")) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_progress_strings_analisis), "%1d/%2d", 3, 6, false);
for (File file : this.f7963) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_progress_strings_analisis), "%1d/%2d", 3, 6, false);
C3348.m12347("String analysis.");
if (C2880.m11589(file.getAbsolutePath(), this.f7977, m11556) > 0) {
C3348.m12347("classes.dex changed!");
}
if (C2880.m11498(file.getAbsolutePath(), arrayList) > 0) {
C3348.m12347("global classes.dex changed!");
}
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step3), "%1d/%2d", 3, 6, false);
if (!this.f7973.contains(file)) {
this.f7973.add(file);
}
}
for (File file2 : this.f7965) {
if (C2880.m11498(file2.getAbsolutePath(), arrayList) > 0) {
C3348.m12347(file2.getName() + " resource changed!");
if (!this.f7973.contains(file2)) {
this.f7973.add(file2);
}
}
}
File[] fileArr = this.f7967;
if (fileArr != null) {
int length = fileArr.length;
while (i < length) {
File file3 = fileArr[i];
if (C2880.m11498(file3.getAbsolutePath(), arrayList) > 0) {
C3348.m12347(file3.getName() + " lib changed!");
if (!this.f7973.contains(file3)) {
this.f7973.add(file3);
}
}
i++;
}
}
} else {
File[] fileArr2 = this.f7963;
int length2 = fileArr2.length;
while (i < length2) {
File file4 = fileArr2[i];
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_progress_strings_analisis), "%1d/%2d", 3, 6, false);
C3348.m12347("String analysis.");
if (C2880.m11498(file4.getAbsolutePath(), arrayList) > 0) {
C3348.m12347("classes.dex changed!");
}
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step3), "%1d/%2d", 3, 6, false);
if (!this.f7973.contains(file4)) {
this.f7973.add(file4);
}
i++;
}
}
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step3), "%1d/%2d", 3, 6, false);
if (!this.f7980.exists()) {
C3348.m12347("Found androidmanifest");
if (!this.f7973.contains(this.f7980)) {
this.f7973.add(this.f7980);
return;
}
return;
}
return;
}
throw new FileNotFoundException();
}
public java.util.ArrayList<p067.C3005> m11647(p067.C3007 r41, java.io.File r42) {
throw new UnsupportedOperationException("Method not decompiled: p065.C2972.m11647(ʼי.ﹶ, java.io.File):java.util.ArrayList");
}
public void m11648() {
if (!this.f7980.exists()) {
if (C3348.f9870 != null) {
C3348.m12359(new RunnableC2973());
return;
}
return;
}
try {
new C3305().m12293(this.f7980, this.f7917, this.f7918);
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
if (C3348.f9870 != null) {
C3348.m12359(new RunnableC2974());
return;
}
return;
}
if (!this.f7973.contains(this.f7980)) {
C3348.m12347("add androidManifest to patchedFiles.");
this.f7973.add(this.f7980);
}
}
public void m11649(String str) {
String str2;
Enumeration<C2799> enumeration;
boolean z;
InputStream m11032;
C2972 c2972 = this;
String str3 = "/arm/";
ArrayList<File> arrayList = c2972.f7969;
if (arrayList != null && arrayList.size() > 0) {
Iterator<File> it = c2972.f7969.iterator();
while (it.hasNext()) {
try {
C2800 c2800 = new C2800(it.next());
Enumeration<C2799> m11030 = c2800.m11030();
while (m11030.hasMoreElements()) {
C2799 nextElement = m11030.nextElement();
String name = nextElement.getName();
if (name.startsWith("lib/")) {
StringBuilder sb = new StringBuilder();
enumeration = m11030;
sb.append(C2880.m11357(c2972.f7983).getAbsolutePath());
sb.append(InternalZipConstants.ZIP_FILE_SEPARATOR);
str2 = str3;
try {
sb.append(name.replace("/armeabi-v7a/", str3).replace("/armeabi/", str3).replace("/arm64-v8a/", "/arm64/"));
File file = new File(sb.toString());
if ((!file.exists() || file.length() == nextElement.getSize()) && file.exists()) {
z = false;
if (!nextElement.isDirectory() && z) {
m11032 = c2800.m11032(nextElement);
if (C2880.m11293(m11032, file)) {
m11032.close();
} else {
m11032.close();
C2880.m11438("chmod", "755", file.getAbsolutePath());
C2880.m11438("chown", "1000.1000", file.getAbsolutePath());
C2880.m11438("chown", "1000:1000", file.getAbsolutePath());
new C2880("");
C2880.m11523(str + "lib", file.getAbsolutePath(), "755", true);
new C2880("");
C2880.m11522(str + "lib", file.getAbsolutePath(), "1000:1000", true);
new File(str + name);
C2880.m11508("ln", file.getAbsolutePath(), new File(str + "lib/" + file.getName()).getAbsolutePath());
}
}
}
z = true;
if (!nextElement.isDirectory()) {
m11032 = c2800.m11032(nextElement);
if (C2880.m11293(m11032, file)) {
}
}
} catch (IOException e) {
e = e;
e.printStackTrace();
c2972 = this;
str3 = str2;
}
} else {
enumeration = m11030;
str2 = str3;
}
c2972 = this;
m11030 = enumeration;
str3 = str2;
}
str2 = str3;
c2800.close();
} catch (IOException e2) {
e = e2;
str2 = str3;
}
c2972 = this;
str3 = str2;
}
}
}
public void m11650() {
Iterator<File> it = this.f7973.iterator();
while (it.hasNext()) {
File next = it.next();
if (next.getName().endsWith(".dex")) {
if (!C3348.f9948.booleanValue()) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step3) + "\n" + next.getName(), "%1d/%2d", 3, 6, false);
}
C2880.m11324(next);
}
}
}
public void m11651() {
throw new UnsupportedOperationException("Method not decompiled: p065.C2972.m11651():void");
}
public void m11652() {
boolean z;
boolean z2;
String str;
int i;
boolean z3;
Iterator<C2986> it;
String str2;
int i2;
String str3;
int i3;
ArrayList<String> arrayList = new ArrayList<>();
if (this.f7974) {
this.f7948 += "SU Java-Code Running! javaroot.utils.custompatch\n";
}
String[] split = this.f7948.split("next_custom_patch_maker_for_split");
this.f7948 = "";
int i4 = 0;
int i5 = 1;
String[] strArr = split;
boolean z4 = false;
boolean z5 = true;
int i6 = 0;
int i7 = 0;
while (i6 < this.f7920.size()) {
C2995 c2995 = this.f7920.get(i6);
if (!c2995.f8117) {
z = false;
} else {
z = z5;
}
if (c2995.f8118) {
z2 = true;
} else {
z2 = z4;
}
if (c2995.f8099 == 0) {
m11643(c2995.f8116, arrayList, "", "", c2995.f8102);
}
if (c2995.f8099 == 12) {
i7++;
if (i6 + 1 != this.f7920.size()) {
String str4 = (("\n****************************************\n") + C2880.m11423(R.string.custom_patch_log_next_custom_patch) + ":\n") + "****************************************\n\n";
if (i7 >= strArr.length) {
ArrayList arrayList2 = new ArrayList();
for (String str5 : strArr) {
arrayList2.add(str5);
}
arrayList2.add("");
strArr = (String[]) arrayList2.toArray(new String[arrayList2.size()]);
}
str = ":\n";
m11643(c2995.f8116, arrayList, "", "", str4);
z = true;
z2 = false;
String str6 = "---------------------------------\n\n";
String str7 = "---------------------------------\n";
String str8 = " ";
if (c2995.f8099 == i5) {
C2986 c2986 = c2995.f8104.get(i4);
Iterator<File> it2 = c2986.f8049.iterator();
while (it2.hasNext()) {
File next = it2.next();
StringBuilder sb = new StringBuilder();
sb.append("" + str7);
sb.append(C2979.m11674("Patch for"));
sb.append(str8);
sb.append(next.getName());
String str9 = str;
sb.append(str9);
m11643(c2995.f8116, arrayList, "", "", ((sb.toString() + str6) + c2995.f8102) + c2986.m11681(next));
str8 = str8;
str6 = str6;
str = str9;
str7 = str7;
z = z;
strArr = strArr;
i7 = i7;
c2986 = c2986;
}
}
String str10 = str8;
String[] strArr2 = strArr;
int i8 = i7;
boolean z6 = z;
String str11 = str;
String str12 = str7;
String str13 = str6;
i = c2995.f8099;
int i9 = 11;
int i10 = 2;
if ((i != 2 || i == 6 || i == 7 || i == 11 || i == 8 || i == 27 || i == 9) && (z3 = this.f7974) && z3) {
it = c2995.f8104.iterator();
while (it.hasNext()) {
C2986 next2 = it.next();
Iterator<File> it3 = next2.f8049.iterator();
while (it3.hasNext()) {
File next3 = it3.next();
String str14 = "" + str12;
int i11 = c2995.f8099;
if (i11 != i10) {
if (i11 != i9) {
if (i11 != 27) {
switch (i11) {
case 6:
str14 = str14 + C2979.m11674("Patch for libraries") + " (armeabi)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
break;
case 7:
str14 = str14 + C2979.m11674("Patch for libraries") + " (armeabi-v7a)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
break;
case 8:
str14 = str14 + C2979.m11674("Patch for libraries") + " (MIPS)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
break;
case 9:
str14 = str14 + C2979.m11674("Patch for libraries") + " (x86)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
break;
}
} else {
str14 = str14 + C2979.m11674("Patch for libraries") + " (x86_64)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
}
} else {
str14 = str14 + C2979.m11674("Patch for libraries") + " (arm64-v8a)\n" + next3.getAbsolutePath().replace(this.f7960, "") + str11;
}
} else {
str14 = str14 + C2979.m11674("Patch for libraries") + str10 + next3.getAbsolutePath().replace(this.f7960, "") + str11;
}
m11643(c2995.f8116, arrayList, "", "", ((str14 + str13) + c2995.f8102) + next2.m11681(next3));
next2 = next2;
i10 = 2;
i9 = 11;
}
}
}
String str15 = "---------------------------\n";
if (c2995.f8099 == 10) {
if (!this.f7974) {
str2 = "---------------------------\n";
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Patch for file from apk:\n") + "---------------------------\n\n") + "You must run rebuild for this application with custom patch, then patch will work.\n\n") + c2995.f8102);
if (c2995.f8099 == 24) {
if (this.f7974) {
Iterator<C2984> it4 = c2995.f8109.iterator();
while (it4.hasNext()) {
C2984 next4 = it4.next();
m11643(c2995.f8116, arrayList, "", "", ((("" + str2) + "Add file " + new File(next4.f8037).getName() + " to apk:\n") + "---------------------------\n\n") + c2995.f8102 + next4.f8039);
}
} else {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Add file to apk:\n") + "---------------------------\n\n") + "You must run rebuild for this application with custom patch, then the file will be added.\n\n") + c2995.f8102);
}
}
if (c2995.f8099 == 25) {
if (this.f7974) {
Iterator<C2990> it5 = c2995.f8110.iterator();
while (it5.hasNext()) {
C2990 next5 = it5.next();
m11643(c2995.f8116, arrayList, "", "", ((("" + str2) + "Rename file " + next5.f8077 + str11) + "---------------------------\n\n") + c2995.f8102 + next5.f8079);
}
} else {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Rename file to apk:\n") + "---------------------------\n\n") + "You must run rebuild for this application with custom patch, then the file will be renamed.\n\n") + c2995.f8102);
}
}
if (c2995.f8099 == 26) {
if (this.f7974) {
Iterator<String> it6 = c2995.f8107.iterator();
while (it6.hasNext()) {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Delete file " + it6.next() + str11) + "---------------------------\n\n") + "If the file was found, it is deleted.\n\n") + c2995.f8102);
}
} else {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Delete file to apk:\n") + "---------------------------\n\n") + "You must run rebuild for this application with custom patch, then the file will be deleted.\n\n") + c2995.f8102);
}
}
if (c2995.f8099 == 28) {
if (this.f7974) {
Iterator<String> it7 = c2995.f8108.iterator();
while (it7.hasNext()) {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Delete folder " + it7.next() + str11) + "---------------------------\n\n") + "If the folder was found, it is deleted.\n\n") + c2995.f8102);
}
} else {
m11643(c2995.f8116, arrayList, "", "", (((("" + str2) + "Delete folder to apk:\n") + "---------------------------\n\n") + "You must run rebuild for this application with custom patch, then the folder will be deleted.\n\n") + c2995.f8102);
}
}
if (c2995.f8099 == 19 && !this.f7974) {
m11643(c2995.f8116, arrayList, "", "", (("" + str2) + C2880.m11423(R.string.custom_patch_log_add_custom_patch_to_boot_list) + "\n") + "---------------------------\n\n");
}
if (c2995.f8099 != 20 && !this.f7974) {
i2 = i6;
str3 = "\n\n";
m11643(c2995.f8116, arrayList, "", "", ((("" + str2) + C2880.m11423(R.string.custom_patch_log_change_components) + str11) + "---------------------------\n\n") + c2995.f8102);
if (c2995.f8112.size() > 0) {
Iterator<C2994> it8 = c2995.f8112.iterator();
while (it8.hasNext()) {
C2994 next6 = it8.next();
if (next6.f8098) {
m11643(c2995.f8116, arrayList, "", "", C2880.m11423(R.string.enabled) + str11 + next6.f8097 + str3);
} else {
m11643(c2995.f8116, arrayList, "", "", C2880.m11423(R.string.disabled) + str11 + next6.f8097 + str3);
}
}
}
} else {
i2 = i6;
str3 = "\n\n";
}
if (c2995.f8099 == 21) {
m11643(c2995.f8116, arrayList, "", "", (("" + str2) + C2880.m11423(R.string.custom_patch_log_change_preferences) + str11) + "---------------------------\n\n");
if (c2995.f8114.size() > 0) {
Iterator<C2989> it9 = c2995.f8114.iterator();
while (it9.hasNext()) {
C2989 next7 = it9.next();
if (next7.f8075) {
m11643(c2995.f8116, arrayList, "", "", next7.f8074 + "\n");
} else {
c2995.f8117 = false;
m11643(c2995.f8116, arrayList, "", "", f7912 + C2880.m11423(R.string.custom_patch_log_change_preference_not_found_file) + str10 + next7.f8067 + str3);
}
}
}
}
if (c2995.f8099 == 17) {
Iterator<C2985> it10 = c2995.f8106.iterator();
while (it10.hasNext()) {
C2985 next8 = it10.next();
m11643(c2995.f8116, arrayList, "", "", ((("" + str2) + "Copy file " + next8.f8042 + " to:\n" + next8.f8043 + "\n") + "---------------------------\n\n") + c2995.f8102 + next8.f8044);
}
}
if (c2995.f8099 != 4) {
i3 = i2;
if (this.f7920.size() - 1 == i3) {
if (c2995.f8099 == 12) {
}
}
i6 = i3 + 1;
z4 = z2;
z5 = z6;
strArr = strArr2;
i7 = i8;
i4 = 0;
i5 = 1;
} else {
i3 = i2;
}
m11643(c2995.f8116, arrayList, "for_insert_result_end_" + c2995.f8116 + "\n", "", strArr2[c2995.f8116]);
if (!arrayList.get(c2995.f8116).contains(f7912)) {
m11643(c2995.f8116, arrayList, "for_insert_result_end_" + c2995.f8116, "", c2995.f8102);
} else {
m11643(c2995.f8116, arrayList, "for_insert_result_end_" + c2995.f8116, "", "");
if (arrayList.get(c2995.f8116).contains("for_insert_result_not_all_patch_" + c2995.f8116)) {
m11643(c2995.f8116, arrayList, "for_insert_result_not_all_patch_" + c2995.f8116, C2880.m11423(R.string.custom_patch_result_not_all_patches_apply) + "\n" + C2880.m11423(R.string.custom_patch_result_all_dont_patch), "");
} else {
if (arrayList.get(c2995.f8116).contains("for_insert_result_all_not_patch_" + c2995.f8116) && !z2) {
m11643(c2995.f8116, arrayList, "for_insert_result_all_not_patch_" + c2995.f8116, C2880.m11423(R.string.custom_patch_result_all_dont_patch), "");
} else {
if (z2 && !z6) {
m11643(c2995.f8116, arrayList, "for_insert_result_all_not_patch_" + c2995.f8116, "", C2880.m11423(R.string.custom_patch_result_not_all_patches_apply) + "\n" + C2880.m11423(R.string.custom_patch_result_all_dont_patch));
}
if (!z6 && !z2) {
m11643(c2995.f8116, arrayList, "for_insert_result_all_not_patch_" + c2995.f8116, "", C2880.m11423(R.string.custom_patch_result_all_dont_patch));
}
}
}
}
m11643(c2995.f8116, arrayList, "", "", "\n");
i6 = i3 + 1;
z4 = z2;
z5 = z6;
strArr = strArr2;
i7 = i8;
i4 = 0;
i5 = 1;
} else {
Iterator<C2986> it11 = c2995.f8104.iterator();
while (it11.hasNext()) {
C2986 next9 = it11.next();
Iterator<File> it12 = next9.f8049.iterator();
while (it12.hasNext()) {
File next10 = it12.next();
m11643(c2995.f8116, arrayList, "", "", (((("" + str12) + C2979.m11674("Patch for") + str10 + next10.getName() + str11) + str13) + c2995.f8102) + next9.m11681(next10));
str15 = str15;
str13 = str13;
next9 = next9;
}
}
}
}
str2 = str15;
if (c2995.f8099 == 24) {
}
if (c2995.f8099 == 25) {
}
if (c2995.f8099 == 26) {
}
if (c2995.f8099 == 28) {
}
if (c2995.f8099 == 19) {
m11643(c2995.f8116, arrayList, "", "", (("" + str2) + C2880.m11423(R.string.custom_patch_log_add_custom_patch_to_boot_list) + "\n") + "---------------------------\n\n");
}
if (c2995.f8099 != 20) {
}
i2 = i6;
str3 = "\n\n";
if (c2995.f8099 == 21) {
}
if (c2995.f8099 == 17) {
}
if (c2995.f8099 != 4) {
}
m11643(c2995.f8116, arrayList, "for_insert_result_end_" + c2995.f8116 + "\n", "", strArr2[c2995.f8116]);
if (!arrayList.get(c2995.f8116).contains(f7912)) {
}
m11643(c2995.f8116, arrayList, "", "", "\n");
i6 = i3 + 1;
z4 = z2;
z5 = z6;
strArr = strArr2;
i7 = i8;
i4 = 0;
i5 = 1;
}
}
str = ":\n";
String str62 = "---------------------------------\n\n";
String str72 = "---------------------------------\n";
String str82 = " ";
if (c2995.f8099 == i5) {
}
String str102 = str82;
String[] strArr22 = strArr;
int i82 = i7;
boolean z62 = z;
String str112 = str;
String str122 = str72;
String str132 = str62;
i = c2995.f8099;
int i92 = 11;
int i102 = 2;
if (i != 2) {
}
it = c2995.f8104.iterator();
while (it.hasNext()) {
}
String str152 = "---------------------------\n";
if (c2995.f8099 == 10) {
}
str2 = str152;
if (c2995.f8099 == 24) {
}
if (c2995.f8099 == 25) {
}
if (c2995.f8099 == 26) {
}
if (c2995.f8099 == 28) {
}
if (c2995.f8099 == 19) {
}
if (c2995.f8099 != 20) {
}
i2 = i6;
str3 = "\n\n";
if (c2995.f8099 == 21) {
}
if (c2995.f8099 == 17) {
}
if (c2995.f8099 != 4) {
}
m11643(c2995.f8116, arrayList, "for_insert_result_end_" + c2995.f8116 + "\n", "", strArr22[c2995.f8116]);
if (!arrayList.get(c2995.f8116).contains(f7912)) {
}
m11643(c2995.f8116, arrayList, "", "", "\n");
i6 = i3 + 1;
z4 = z2;
z5 = z62;
strArr = strArr22;
i7 = i82;
i4 = 0;
i5 = 1;
}
Iterator<String> it13 = arrayList.iterator();
while (it13.hasNext()) {
this.f7948 += it13.next();
}
this.f7948 = C2979.m11675(this.f7948);
}
public void m11653() {
String str;
String str2;
this.f7948 = "SU Java-Code Running! javaroot.utils.custompatch\n";
int i = 0;
boolean z = false;
boolean z2 = true;
while (i < this.f7920.size()) {
C2995 c2995 = this.f7920.get(i);
if (c2995.f8118) {
z = true;
}
if (!c2995.f8117) {
z2 = false;
}
String str3 = "";
if (c2995.f8099 == 12) {
if (i + 1 != this.f7920.size()) {
this.f7948 += ("next_custom_patch_maker_for_split\n");
}
z = false;
z2 = true;
}
int i2 = c2995.f8099;
String str4 = "---------------------------------\n";
if (i2 == 2 || i2 == 6 || i2 == 7 || i2 == 11 || i2 == 8 || i2 == 27 || i2 == 9) {
Iterator<C2986> it = c2995.f8104.iterator();
while (it.hasNext()) {
C2986 next = it.next();
Iterator<File> it2 = next.f8049.iterator();
while (true) {
Iterator<C2986> it3 = it;
int i3 = i;
boolean z3 = z2;
if (it2.hasNext()) {
Iterator<File> it4 = it2;
File next2 = it2.next();
boolean z4 = z;
String str5 = str3 + str4;
String str6 = str4;
int i4 = c2995.f8099;
String str7 = str3;
if (i4 != 2) {
if (i4 != 11) {
if (i4 != 27) {
switch (i4) {
case 6:
str5 = str5 + C2979.m11674("Patch for libraries") + " (armeabi)\n" + next2.getName() + ":\n";
break;
case 7:
str5 = str5 + C2979.m11674("Patch for libraries") + " (armeabi-v7a)\n" + next2.getName() + ":\n";
break;
case 8:
str5 = str5 + C2979.m11674("Patch for libraries") + " (MIPS)\n" + next2.getName() + ":\n";
break;
case 9:
str5 = str5 + C2979.m11674("Patch for libraries") + " (x86)\n" + next2.getName() + ":\n";
break;
}
} else {
str5 = str5 + C2979.m11674("Patch for libraries") + " (x86_64)\n" + next2.getName() + ":\n";
}
} else {
str5 = str5 + C2979.m11674("Patch for libraries") + " (arm64-v8a)\n" + next2.getName() + ":\n";
}
} else {
str5 = str5 + C2979.m11674("Patch for libraries") + " " + next2.getName() + ":\n";
}
this.f7948 += (((str5 + "---------------------------------\n\n") + c2995.f8102) + next.m11681(next2));
z = z4;
it = it3;
i = i3;
z2 = z3;
it2 = it4;
str4 = str6;
str3 = str7;
} else {
boolean z5 = z;
String str8 = str3;
String str9 = str4;
if (next.f8049.size() == 0) {
StringBuilder sb = new StringBuilder();
str = str8;
sb.append(str);
sb.append(str9);
String sb2 = sb.toString();
int i5 = c2995.f8099;
if (i5 != 2) {
if (i5 != 11) {
if (i5 != 27) {
switch (i5) {
case 6:
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (armeabi)\n" + next.f8045 + ":\n";
break;
case 7:
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (armeabi-v7a)\n" + next.f8045 + ":\n";
break;
case 8:
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (MIPS)\n" + next.f8045 + ":\n";
break;
case 9:
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (x86)\n" + next.f8045 + ":\n";
break;
}
} else {
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (x86_64)\n" + next.f8045 + ":\n";
}
} else {
sb2 = sb2 + C2979.m11674("Patch for libraries") + " (arm64-v8a)\n" + next.f8045 + ":\n";
}
} else {
sb2 = sb2 + C2979.m11674("Patch for libraries") + " " + next.f8045 + ":\n";
}
this.f7948 += (((sb2 + "---------------------------------\n\n") + c2995.f8102) + next.f8059);
} else {
str = str8;
}
str3 = str;
z = z5;
it = it3;
i = i3;
z2 = z3;
str4 = str9;
}
}
}
}
int i6 = i;
boolean z6 = z;
boolean z7 = z2;
String str10 = str3;
String str11 = str4;
if (c2995.f8099 == 18) {
Iterator<C2986> it5 = c2995.f8104.iterator();
while (it5.hasNext()) {
C2986 next3 = it5.next();
Iterator<File> it6 = next3.f8049.iterator();
while (it6.hasNext()) {
File next4 = it6.next();
this.f7948 += (((((str10 + str11) + C2979.m11674("Patch for") + " " + next4.getName() + ":\n") + "---------------------------------\n\n") + c2995.f8102) + next3.m11681(next4));
}
String str12 = str11;
if (next3.f8049.size() == 0) {
this.f7948 += (((((str10 + str12) + C2979.m11674("Patch for") + " " + next3.f8045 + ":\n") + "---------------------------------\n\n") + c2995.f8102) + next3.f8059);
}
str11 = str12;
}
}
String str13 = str11;
if (c2995.f8099 == 22) {
this.f7948 += ((((str10 + str13) + C2979.m11674("Patch for files from directory") + "\n") + "---------------------------------\n\n") + c2995.f8102);
Iterator<C2986> it7 = c2995.f8104.iterator();
while (it7.hasNext()) {
C2986 next5 = it7.next();
ArrayList<File> arrayList = next5.f8049;
if (arrayList == null || arrayList.size() == 0) {
this.f7948 += next5.f8059;
}
Iterator<File> it8 = next5.f8049.iterator();
while (it8.hasNext()) {
File next6 = it8.next();
this.f7948 += (((((str10 + str13) + C2979.m11674("Patch for") + " " + next6.getName() + ":\n") + "---------------------------------\n\n") + c2995.f8102) + next5.m11681(next6));
}
}
}
if (c2995.f8099 == 23) {
this.f7948 += ((((str10 + str13) + C2979.m11674("Blocking internet hosts") + ":\n") + "---------------------------------\n\n") + c2995.f8102);
}
if (c2995.f8099 == 14) {
Iterator<C2986> it9 = c2995.f8104.iterator();
while (it9.hasNext()) {
C2986 next7 = it9.next();
Iterator<File> it10 = next7.f8049.iterator();
while (it10.hasNext()) {
File next8 = it10.next();
this.f7948 += (((((str10 + str13) + C2979.m11674("Patch for") + " " + next8.getName() + ":\n") + "---------------------------------\n\n") + c2995.f8102) + next7.m11681(next8));
}
}
}
if (c2995.f8099 == 16) {
Iterator<C2991> it11 = c2995.f8105.iterator();
while (it11.hasNext()) {
C2991 next9 = it11.next();
this.f7948 += ((((str10 + "---------------------------\n") + "Set permissions " + next9.f8081 + " for file:\n" + next9.f8080 + "\n") + "---------------------------\n\n") + c2995.f8102);
}
}
if (c2995.f8099 == 17) {
Iterator<C2985> it12 = c2995.f8106.iterator();
while (it12.hasNext()) {
C2985 next10 = it12.next();
this.f7948 += (((((str10 + "---------------------------\n") + "Copy file " + next10.f8042 + " to:\n" + next10.f8043 + "\n") + "---------------------------\n\n") + c2995.f8102 + next10.f8044) + "\n");
}
}
if (c2995.f8099 == 15) {
Iterator<C2996> it13 = c2995.f8113.iterator();
String str14 = str10;
while (it13.hasNext()) {
C2996 next11 = it13.next();
if (!str14.equals(next11.f8119)) {
str14 = next11.f8119;
str2 = (((str10 + "---------------------------\n") + "Open SqLite database\n" + next11.f8119 + "\n") + "---------------------------\n\n") + c2995.f8102;
} else {
str2 = str10;
}
if (next11.f8121) {
str2 = str2 + "Execute:\n" + next11.f8120 + "\n";
}
this.f7948 += (str2 + "\n");
}
}
if (c2995.f8099 == 21) {
Iterator<C2989> it14 = c2995.f8114.iterator();
String str15 = str10;
while (it14.hasNext()) {
C2989 next12 = it14.next();
if (!str15.equals(next12.f8067)) {
String str16 = next12.f8067;
File file = next12.f8068;
if (file != null && file.exists()) {
this.f7948 += "\nfound_pref_file_for_edit_" + c2995.f8116 + "\n" + next12.f8068.getAbsolutePath() + "\n";
} else {
next12.f8075 = false;
}
str15 = str16;
}
}
}
if (c2995.f8099 == 4) {
if (z6 && !z7) {
this.f7948 += "for_insert_result_not_all_patch_" + c2995.f8116 + "\n";
}
if (!z7 && !z6) {
this.f7948 += "for_insert_result_all_not_patch_" + c2995.f8116 + "\n";
}
}
i = i6 + 1;
z = z6;
z2 = z7;
}
}
public C3006 m11654(C2995 c2995, String str, int i) {
String str2;
C2995 c29952;
String str3;
C2995 c29953 = c2995;
int i2 = i;
String str4 = "+";
String trim = str.trim();
String[] strArr = new String[trim.split("[ \t]+").length];
String[] split = trim.split("[ \t]+");
int[] iArr = new int[split.length];
byte[] bArr = new byte[split.length];
int[] iArr2 = new int[split.length];
int i3 = 0;
int i4 = 0;
while (i4 < split.length) {
iArr2[i4] = i3;
if (split[i4].contains("*") && !split[i4].contains("**")) {
ArrayList<C2986> arrayList = c29953.f8104;
arrayList.get(arrayList.size() - 1).f8054 = true;
split[i4] = "60";
}
byte[] bArr2 = bArr;
if (i2 != 0) {
str2 = str4;
if (i2 != 1) {
if (i2 != 2) {
c29952 = c2995;
} else {
try {
} catch (Exception e) {
e = e;
str3 = str2;
}
try {
if (!split[i4].contains("**") && !split[i4].matches("\\?+")) {
iArr[i4] = 1;
if (split[i4].toLowerCase().contains("sq")) {
split[i4] = "60";
iArr[i4] = 253;
}
if (split[i4].toUpperCase().contains("S") && !split[i4].toUpperCase().contains("SQ")) {
iArr[i4] = 255;
iArr2[i4] = Integer.valueOf(split[i4].toUpperCase().replace("S", ""), 10).intValue();
split[i4] = "60";
}
if (!split[i4].contains("W") || split[i4].contains("w") || split[i4].contains("R") || split[i4].contains("R")) {
iArr[i4] = Integer.valueOf(split[i4].toLowerCase().replace("w", "").replace(InternalZipConstants.READ_MODE, "")).intValue() + 2;
split[i4] = "60";
}
if (split[i4].contains("-")) {
iArr[i4] = Integer.valueOf(split[i4].toLowerCase().replace("-", "")).intValue() + 2;
split[i4] = "0";
}
str3 = str2;
if (split[i4].contains(str3)) {
iArr[i4] = Integer.valueOf(split[i4].toLowerCase().replace(str3, "")).intValue() + 2;
split[i4] = "1";
}
bArr2[i4] = Integer.valueOf(split[i4], 16).byteValue();
c29952 = c2995;
}
if (split[i4].contains(str3)) {
}
bArr2[i4] = Integer.valueOf(split[i4], 16).byteValue();
c29952 = c2995;
} catch (Exception e2) {
e = e2;
e.printStackTrace();
c29952 = c2995;
c29952.m11685("Exception " + e.toString());
str2 = str3;
i4++;
i2 = i;
c29953 = c29952;
bArr = bArr2;
str4 = str2;
i3 = 0;
}
split[i4] = "60";
iArr[i4] = 0;
if (split[i4].toLowerCase().contains("sq")) {
}
if (split[i4].toUpperCase().contains("S")) {
iArr[i4] = 255;
iArr2[i4] = Integer.valueOf(split[i4].toUpperCase().replace("S", ""), 10).intValue();
split[i4] = "60";
}
if (!split[i4].contains("W")) {
}
iArr[i4] = Integer.valueOf(split[i4].toLowerCase().replace("w", "").replace(InternalZipConstants.READ_MODE, "")).intValue() + 2;
split[i4] = "60";
if (split[i4].contains("-")) {
}
str3 = str2;
}
} else {
c29952 = c2995;
str3 = str2;
try {
if (!split[i4].contains("**") && !split[i4].matches("\\?+")) {
iArr[i4] = 0;
if (split[i4].toUpperCase().contains("R")) {
iArr[i4] = Integer.valueOf(split[i4].replace("R", "")).intValue() + 2;
split[i4] = "60";
}
bArr2[i4] = Integer.valueOf(split[i4], 16).byteValue();
}
split[i4] = "60";
iArr[i4] = 1;
if (split[i4].toUpperCase().contains("R")) {
}
bArr2[i4] = Integer.valueOf(split[i4], 16).byteValue();
} catch (Exception e3) {
e3.printStackTrace();
c29952.m11685("search pattern read: " + e3);
}
}
str2 = str3;
} else {
str2 = str4;
c29952 = c2995;
try {
if (!split[i4].contains("**") && !split[i4].matches("\\?+")) {
try {
iArr[i4] = 0;
} catch (Exception e4) {
e = e4;
e.printStackTrace();
c29952.m11685(" " + e);
i4++;
i2 = i;
c29953 = c29952;
bArr = bArr2;
str4 = str2;
i3 = 0;
}
} else {
split[i4] = "60";
iArr[i4] = 1;
}
if (split[i4].contains("W") || split[i4].contains("w") || split[i4].contains("R") || split[i4].contains(InternalZipConstants.READ_MODE)) {
iArr[i4] = Integer.valueOf(split[i4].toLowerCase().replace("w", "").replace(InternalZipConstants.READ_MODE, "")).intValue() + 2;
split[i4] = "60";
}
bArr2[i4] = Integer.valueOf(split[i4], 16).byteValue();
} catch (Exception e5) {
e = e5;
}
}
i4++;
i2 = i;
c29953 = c29952;
bArr = bArr2;
str4 = str2;
i3 = 0;
}
return new C3006(bArr, iArr, iArr2);
}
public ArrayList<File> m11655() {
ArrayList<File> arrayList = new ArrayList<>();
try {
for (File file : new File(this.f7960).listFiles()) {
if (file.getName().toLowerCase().startsWith("classes") && file.getName().endsWith(".dex")) {
arrayList.add(file);
}
}
} catch (FileNotFoundException unused) {
C3348.m12347(f7912 + " unzip classes.dex fault!\n\n");
} catch (Exception e) {
C3348.m12347("Extract classes.dex error: " + e.toString());
}
if (arrayList.size() != 0) {
if (arrayList.size() > 0) {
Iterator<File> it = arrayList.iterator();
while (it.hasNext()) {
if (!it.next().exists()) {
throw new FileNotFoundException();
}
}
}
C3348.m12347("get classes.dex " + arrayList.size());
return arrayList;
}
throw new FileNotFoundException();
}
public String m11656(String str) {
try {
return new C2971(this.f7983, new File(this.f7960)).m11642(str);
} catch (Exception e) {
C3348.m12347("File select error: " + e.toString());
return "";
}
}
public boolean m11657() {
Iterator<C2995> it = this.f7920.iterator();
while (it.hasNext()) {
int i = it.next().f8099;
if (i == 2 || i == 6 || i == 7 || i == 9 || i == 27 || i == 8 || i == 11) {
return true;
}
}
return false;
}
public boolean m11658() {
Iterator<C2995> it = this.f7920.iterator();
while (it.hasNext()) {
int i = it.next().f8099;
if (i == 1 || i == 21 || i == 17 || this.f7925 || this.f7923) {
return true;
}
}
return false;
}
public boolean m11659(File file, C2995 c2995, C2986 c2986) {
boolean z;
String str;
String str2;
String str3;
ArrayList arrayList;
String str4;
String str5;
C2995 c29952;
String str6;
String str7;
String str8;
String str9;
int i;
MappedByteBuffer mappedByteBuffer;
boolean z2;
String str10;
String str11;
C3004[] c3004Arr;
String str12;
String str13;
C2995 c29953;
String str14;
byte[] bArr;
String str15;
String str16;
String str17;
int i2;
String str18;
ArrayList arrayList2;
String str19;
String str20;
C3004 c3004;
String str21;
String str22;
byte b;
C2995 c29954;
int i3;
String str23;
String str24;
int i4;
String str25;
String str26;
String str27;
C2995 c29955;
boolean z3;
int i5;
int i6;
int i7;
C3004[] c3004Arr2;
String str28;
String str29;
String str30;
String str31;
int i8;
int i9;
String str32;
String str33;
String str34;
MappedByteBuffer mappedByteBuffer2;
byte[] bArr2;
String str35;
int i10;
int i11;
int i12;
C2995 c29956;
int i13;
byte[] bArr3;
String str36;
File file2 = file;
C2995 c29957 = c2995;
String str37 = "Pattern";
C3348.m12347("patch file " + file.getName());
String str38 = " ";
if (C3348.f9948.booleanValue()) {
C2880.m11517("Size file:" + file.length());
} else {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step2) + " " + file.getName(), "%1d/%2d bytes", 0, (int) file.length(), false);
}
try {
FileChannel channel = new RandomAccessFile(file2, InternalZipConstants.WRITE_MODE).getChannel();
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
Iterator<C3004> it = c2986.f8050.iterator();
while (true) {
str = "";
if (!it.hasNext()) {
break;
}
try {
if (!it.next().f8181.equals("")) {
break;
}
} catch (FileNotFoundException unused) {
z = true;
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.", file2);
return z;
} catch (BufferUnderflowException unused2) {
return true;
} catch (Exception e) {
e = e;
z = true;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file2);
return z;
}
}
map.position(0);
byte[] m11361 = C2880.m11361(file);
ArrayList arrayList3 = new ArrayList();
ArrayList<C3004> arrayList4 = c2986.f8050;
String str39 = ")\n";
String str40 = " \n(";
String str41 = ": ";
String str42 = ":\n";
String str43 = "\n";
try {
if (arrayList4 != null) {
try {
if (arrayList4.size() > 0) {
ArrayList<C3004> arrayList5 = c2986.f8050;
MappedByteBuffer mappedByteBuffer3 = map;
C3004[] c3004Arr3 = (C3004[]) arrayList5.toArray(new C3004[arrayList5.size()]);
byte[] bArr4 = m11361;
str2 = " N";
int i14 = 0;
int i15 = 0;
boolean z4 = false;
while (i15 < c3004Arr3.length) {
C3004 c30042 = c3004Arr3[i15];
String str44 = str42;
c30042.f8172 = false;
if (!c30042.f8174.equals(str)) {
str10 = str40;
if (c30042.f8174.toLowerCase().equals(file.getName().toLowerCase())) {
arrayList3.add(c30042);
}
} else {
str10 = str40;
arrayList3.add(c30042);
}
if (c29957.f8099 == 1 && c2986.f8056 && c30042.f8173.equals(str)) {
C3004 c30043 = c3004Arr3[i15];
StringBuilder sb = new StringBuilder();
str11 = str39;
sb.append("multi_");
sb.append(i14);
c30043.f8173 = sb.toString();
i14++;
} else {
str11 = str39;
}
int i16 = i14;
try {
if (c30042.f8177 != -1) {
try {
C3004 c30044 = c3004Arr3[i15];
byte[] bArr5 = c30042.f8168;
int[] iArr = new int[bArr5.length];
c30044.f8167 = iArr;
c30044.f8166 = new byte[bArr5.length];
try {
Arrays.fill(iArr, 1);
Arrays.fill(c3004Arr3[i15].f8166, (byte) -103);
str14 = str37;
byte[] bArr6 = bArr4;
c3004 = c30042;
c3004Arr = c3004Arr3;
str21 = str10;
str19 = str11;
arrayList2 = arrayList3;
str22 = str44;
b = 0;
str12 = str;
str17 = str41;
int i17 = i15;
int i18 = i15;
str20 = str38;
try {
if (m11645(file, channel, mappedByteBuffer3, bArr6, c30042.f8177, c3004Arr, i17, c2986)) {
bArr = bArr6;
try {
if (bArr.length != channel.size()) {
mappedByteBuffer3 = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
bArr = C2880.m11361(file);
C3348.m12347("re-read file to memory");
}
c2986.m11680(C2979.m11674("Offset") + str20 + Integer.toHexString(c3004.f8177) + str17 + C2979.m11674("Patch done!") + "\n", file2);
i3 = i18;
try {
c2986.f8050.get(i3).f8172 = true;
c29954 = c2995;
} catch (Throwable th) {
th = th;
c29953 = c2995;
i2 = i3;
str16 = str21;
str15 = str22;
z = true;
String str45 = str19;
str13 = str20;
str18 = str45;
try {
th.printStackTrace();
int i19 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i19;
c29957 = c29953;
i14 = i16;
str = str12;
} catch (FileNotFoundException unused3) {
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.", file2);
return z;
} catch (BufferUnderflowException unused4) {
return z;
} catch (Exception e2) {
e = e2;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file2);
return z;
}
}
} catch (Throwable th2) {
th = th2;
c29953 = c2995;
i2 = i18;
str16 = str21;
str15 = str22;
z = true;
String str452 = str19;
str13 = str20;
str18 = str452;
th.printStackTrace();
int i192 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i192;
c29957 = c29953;
i14 = i16;
str = str12;
}
try {
c29954.f8118 = true;
z4 = true;
} catch (Throwable th3) {
th = th3;
c29953 = c29954;
i2 = i3;
str16 = str21;
str15 = str22;
z = true;
String str4522 = str19;
str13 = str20;
str18 = str4522;
th.printStackTrace();
int i1922 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i1922;
c29957 = c29953;
i14 = i16;
str = str12;
}
} else {
c29954 = c2995;
i3 = i18;
bArr = bArr6;
}
} catch (Throwable th4) {
th = th4;
bArr = bArr6;
}
} catch (Throwable th5) {
th = th5;
c3004Arr = c3004Arr3;
str12 = str;
str14 = str37;
bArr = bArr4;
str19 = str11;
arrayList2 = arrayList3;
C2995 c29958 = c29957;
str17 = str41;
int i20 = i15;
str20 = str38;
c29953 = c29958;
i2 = i20;
str15 = str44;
str16 = str10;
z = true;
String str45222 = str19;
str13 = str20;
str18 = str45222;
th.printStackTrace();
int i19222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i19222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th6) {
th = th6;
c3004Arr = c3004Arr3;
str12 = str;
str14 = str37;
bArr = bArr4;
str19 = str11;
}
} else {
c3004Arr = c3004Arr3;
str12 = str;
str14 = str37;
str22 = str44;
str19 = str11;
str21 = str10;
b = 0;
c3004 = c30042;
arrayList2 = arrayList3;
bArr = bArr4;
C2995 c29959 = c29957;
str17 = str41;
c29954 = c29959;
int i21 = i15;
str20 = str38;
i3 = i21;
}
} catch (Throwable th7) {
th = th7;
c3004Arr = c3004Arr3;
str12 = str;
str13 = str38;
c29953 = c29957;
str14 = str37;
bArr = bArr4;
str15 = str44;
str16 = str10;
str17 = str41;
i2 = i15;
str18 = str11;
z = true;
arrayList2 = arrayList3;
}
if (c3004.f8178 && file.getName().endsWith(".dex") && file.length() > 112) {
C3348.m12347(c3004.f8181 + str20 + c3004.f8189);
if (c3004Arr[i3].f8189) {
MappedByteBuffer mappedByteBuffer4 = mappedByteBuffer3;
int i22 = 0;
while (i22 < c3004Arr[i3].f8184.size()) {
try {
C3004 c30045 = c3004Arr[i3];
if (c30045.f8166 == null) {
try {
int intValue = c30045.f8185.get(i22).intValue();
byte[] bArr7 = new byte[intValue];
boolean z5 = false;
int i23 = 0;
while (i23 < intValue) {
int i24 = intValue - i23;
try {
byte[] bArr8 = c3004Arr[i3].f8168;
byte[] bArr9 = bArr;
try {
if (i24 <= bArr8.length) {
int length = bArr8.length;
boolean z6 = z5;
int i25 = i23;
int i26 = 0;
while (i26 < length) {
bArr7[i25] = bArr8[i26];
if (i25 < intValue) {
i25++;
}
i26++;
z6 = true;
}
i23 = i25;
z5 = z6;
} else {
bArr7[i23] = b;
}
i23++;
bArr = bArr9;
} catch (Throwable th8) {
th = th8;
c29953 = c29954;
i2 = i3;
bArr = bArr9;
str16 = str21;
str15 = str22;
z = true;
mappedByteBuffer3 = mappedByteBuffer4;
String str452222 = str19;
str13 = str20;
str18 = str452222;
th.printStackTrace();
int i192222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i192222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th9) {
th = th9;
c29953 = c29954;
i2 = i3;
}
}
byte[] bArr10 = bArr;
if (z5) {
try {
int intValue2 = c3004Arr[i3].f8186.get(i22).intValue();
if (intValue2 > 0) {
C3348.m12347(5);
mappedByteBuffer4.position(intValue2);
byte[] bArr11 = new byte[2];
bArr11[b] = b;
bArr11[1] = b;
mappedByteBuffer4.put(bArr11);
mappedByteBuffer4.force();
mappedByteBuffer4.position(c3004Arr[i3].f8187.get(i22).intValue());
mappedByteBuffer4.put(C2880.m11596(c3004Arr[i3].f8185.get(i22).intValue() / 2));
mappedByteBuffer4.force();
}
mappedByteBuffer4.position(c3004Arr[i3].f8184.get(i22).intValue());
mappedByteBuffer4.put(bArr7);
mappedByteBuffer4.force();
StringBuilder sb2 = new StringBuilder();
sb2.append(C2979.m11674("Method patch"));
str15 = str22;
try {
sb2.append(str15);
sb2.append(c3004Arr[i3].f8183);
sb2.append("\n");
sb2.append(C2979.m11674("Patch done!"));
str23 = str21;
try {
sb2.append(str23);
sb2.append(C2979.m11674("Offset"));
sb2.append(str17);
sb2.append(Integer.toHexString(c3004Arr[i3].f8184.get(i22).intValue()));
str24 = str19;
try {
sb2.append(str24);
c2986.m11680(sb2.toString(), file2);
c3004Arr[i3].f8172 = true;
c29954.f8118 = true;
z4 = true;
} catch (Throwable th10) {
th = th10;
i2 = i3;
str13 = str20;
bArr = bArr10;
mappedByteBuffer3 = mappedByteBuffer4;
str18 = str24;
str16 = str23;
c29953 = c29954;
z = true;
th.printStackTrace();
int i1922222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i1922222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th11) {
th = th11;
i2 = i3;
bArr = bArr10;
mappedByteBuffer3 = mappedByteBuffer4;
str16 = str23;
c29953 = c29954;
z = true;
String str4522222 = str19;
str13 = str20;
str18 = str4522222;
th.printStackTrace();
int i19222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i19222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th12) {
th = th12;
c29953 = c29954;
i2 = i3;
bArr = bArr10;
str16 = str21;
z = true;
mappedByteBuffer3 = mappedByteBuffer4;
String str45222222 = str19;
str13 = str20;
str18 = str45222222;
th.printStackTrace();
int i192222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i192222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th13) {
th = th13;
str15 = str22;
}
} else {
str23 = str21;
str24 = str19;
str15 = str22;
}
i4 = i3;
str25 = str20;
bArr = bArr10;
str26 = str24;
str27 = str23;
c29955 = c29954;
} catch (Throwable th14) {
th = th14;
str15 = str22;
c29953 = c29954;
i2 = i3;
}
} else {
byte[] bArr12 = bArr;
String str46 = str21;
String str47 = str19;
str15 = str22;
try {
int intValue3 = c30045.f8184.get(i22).intValue() - 1;
int intValue4 = (c3004Arr[i3].f8184.get(i22).intValue() + c3004Arr[i3].f8185.get(i22).intValue()) - c3004Arr[i3].f8168.length;
byte[] bArr13 = bArr12;
mappedByteBuffer3 = mappedByteBuffer4;
while (true) {
int i27 = intValue3 + 1;
if (i27 > intValue4) {
break;
}
byte[] bArr14 = bArr13;
int i28 = intValue4;
str13 = str20;
str18 = str47;
String str48 = str46;
i2 = i3;
try {
if (m11645(file, channel, mappedByteBuffer3, bArr14, i27, c3004Arr, i3, c2986)) {
bArr = bArr14;
try {
if (bArr.length != channel.size()) {
mappedByteBuffer3 = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
bArr = C2880.m11361(file);
C3348.m12347("re-read file to memory");
}
bArr13 = bArr;
try {
str16 = str48;
file2 = file;
try {
c2986.m11680(C2979.m11674("Method patch") + str15 + c3004Arr[i2].f8183 + "\n" + C2979.m11674("Patch done!") + str48 + C2979.m11674("Offset") + str17 + Integer.toHexString(i27) + str18, file2);
z = true;
try {
c3004Arr[i2].f8172 = true;
c29953 = c2995;
try {
c29953.f8118 = true;
c29954 = c29953;
str46 = str16;
str47 = str18;
i3 = i2;
intValue3 = i27;
intValue4 = i28;
str20 = str13;
z4 = true;
} catch (Throwable th15) {
th = th15;
bArr = bArr13;
th.printStackTrace();
int i1922222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i1922222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} catch (Throwable th16) {
th = th16;
c29953 = c2995;
}
} catch (Throwable th17) {
th = th17;
c29953 = c2995;
z = true;
}
} catch (Throwable th18) {
th = th18;
c29953 = c2995;
str16 = str48;
z = true;
file2 = file;
}
} catch (Throwable th19) {
th = th19;
c29953 = c2995;
str16 = str48;
z = true;
file2 = file;
th.printStackTrace();
int i19222222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i19222222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
} else {
c29954 = c2995;
bArr13 = bArr14;
str46 = str48;
str47 = str18;
i3 = i2;
intValue3 = i27;
intValue4 = i28;
str20 = str13;
file2 = file;
}
} catch (Throwable th20) {
th = th20;
c29953 = c2995;
str16 = str48;
bArr = bArr14;
}
}
bArr = bArr13;
i4 = i3;
str25 = str20;
str26 = str47;
str27 = str46;
c29955 = c29954;
mappedByteBuffer4 = mappedByteBuffer3;
} catch (Throwable th21) {
th = th21;
i2 = i3;
str13 = str20;
str18 = str47;
str16 = str46;
c29953 = c29954;
z = true;
bArr = bArr12;
mappedByteBuffer3 = mappedByteBuffer4;
th.printStackTrace();
int i192222222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i192222222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
}
i22++;
c29954 = c29955;
str21 = str27;
str22 = str15;
i3 = i4;
String str49 = str25;
str19 = str26;
str20 = str49;
} catch (Throwable th22) {
th = th22;
c29953 = c29954;
i2 = i3;
str16 = str21;
str15 = str22;
z = true;
String str50 = str19;
str13 = str20;
str18 = str50;
}
}
c29953 = c29954;
i2 = i3;
str16 = str21;
str15 = str22;
String str51 = str19;
str13 = str20;
str18 = str51;
mappedByteBuffer3 = mappedByteBuffer4;
int i1922222222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i1922222222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
}
c29953 = c29954;
i2 = i3;
str16 = str21;
str15 = str22;
String str52 = str19;
str13 = str20;
str18 = str52;
int i19222222222222 = i2 + 1;
bArr4 = bArr;
str40 = str16;
str41 = str17;
str39 = str18;
str42 = str15;
str37 = str14;
c3004Arr3 = c3004Arr;
arrayList3 = arrayList2;
str38 = str13;
i15 = i19222222222222;
c29957 = c29953;
i14 = i16;
str = str12;
}
str3 = str39;
arrayList = arrayList3;
str4 = str;
str5 = str38;
c29952 = c29957;
str6 = str37;
m11361 = bArr4;
str7 = str40;
str8 = str42;
str9 = str41;
i = 1;
mappedByteBuffer = mappedByteBuffer3;
z2 = z4;
C3004[] c3004Arr4 = new C3004[arrayList.toArray().length];
C3004[] c3004Arr5 = (C3004[]) arrayList.toArray(new C3004[arrayList.size()]);
z3 = z2;
i5 = -1;
i6 = 0;
while (true) {
i7 = i5 + 1;
try {
if (i7 < m11361.length) {
break;
}
int i29 = i6 + i;
if (C3348.f9948.booleanValue()) {
mappedByteBuffer2 = mappedByteBuffer;
bArr2 = m11361;
str35 = str5;
if (i29 > 153600) {
try {
C2880.m11517("Progress size:" + i7);
i10 = 0;
} catch (IndexOutOfBoundsException unused5) {
str5 = str35;
c3004Arr2 = c3004Arr5;
str28 = str43;
str29 = str8;
str30 = str2;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str53 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (BufferUnderflowException | Exception unused6) {
str5 = str35;
}
}
i10 = i29;
} else if (i29 > 153600) {
String m11423 = C2880.m11423(R.string.wait);
StringBuilder sb3 = new StringBuilder();
sb3.append(C2880.m11423(R.string.patch_step2));
String str54 = str5;
try {
sb3.append(str54);
sb3.append(file.getName());
String sb4 = sb3.toString();
mappedByteBuffer2 = mappedByteBuffer;
bArr2 = m11361;
C3923.m12599(m11423, sb4, "%1d/%2d bytes", i7, (int) file.length(), false);
str35 = str54;
i10 = 0;
} catch (IndexOutOfBoundsException unused7) {
c3004Arr2 = c3004Arr5;
str5 = str54;
str28 = str43;
str29 = str8;
str30 = str2;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
try {
} catch (FileNotFoundException unused8) {
z = true;
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.", file2);
return z;
} catch (BufferUnderflowException unused9) {
return true;
} catch (Exception e3) {
e = e3;
z = true;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file2);
return z;
}
}
String str532 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
try {
} catch (FileNotFoundException unused10) {
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.", file2);
return z;
} catch (BufferUnderflowException unused11) {
return z;
} catch (Exception e4) {
e = e4;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file2);
return z;
}
}
return z;
} catch (BufferUnderflowException | Exception unused12) {
c3004Arr2 = c3004Arr5;
str5 = str54;
}
} else {
mappedByteBuffer2 = mappedByteBuffer;
bArr2 = m11361;
str35 = str5;
i10 = i29;
}
boolean z7 = z3;
byte[] bArr15 = bArr2;
int i30 = 0;
MappedByteBuffer mappedByteBuffer5 = mappedByteBuffer2;
while (i30 < c3004Arr5.length) {
try {
C3004 c30046 = c3004Arr5[i30];
str28 = str43;
if (c30046.f8177 == -1) {
try {
if (!c30046.f8178) {
i11 = i7;
C3004[] c3004Arr6 = c3004Arr5;
i12 = i30;
str5 = str35;
c29956 = c29952;
i13 = i10;
bArr3 = bArr15;
str29 = str8;
str36 = str7;
try {
try {
if (m11645(file, channel, mappedByteBuffer5, bArr15, i11, c3004Arr6, i12, c2986)) {
if (bArr3.length != channel.size()) {
try {
mappedByteBuffer5 = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
bArr3 = C2880.m11361(file);
C3348.m12347("re-read file to memory");
} catch (IndexOutOfBoundsException unused13) {
z3 = z7;
str30 = str2;
c3004Arr2 = c3004Arr6;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str5322 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (BufferUnderflowException | Exception unused14) {
z3 = z7;
str30 = str2;
c3004Arr2 = c3004Arr6;
}
}
bArr15 = bArr3;
StringBuilder sb5 = new StringBuilder();
sb5.append(C2979.m11674(str6));
str30 = str2;
try {
sb5.append(str30);
sb5.append(i12 + 1);
sb5.append(str9);
sb5.append(C2979.m11674("Patch done!"));
sb5.append(str36);
sb5.append(C2979.m11674("Offset"));
sb5.append(str9);
sb5.append(Integer.toHexString(i11));
sb5.append(str3);
c2986.m11680(sb5.toString(), file2);
c3004Arr2 = c3004Arr6;
try {
c3004Arr2[i12].f8172 = true;
c29956.f8118 = true;
z7 = true;
i30 = i12 + 1;
str2 = str30;
c3004Arr5 = c3004Arr2;
c29952 = c29956;
str7 = str36;
str43 = str28;
i7 = i11;
i10 = i13;
str35 = str5;
str8 = str29;
} catch (IndexOutOfBoundsException unused15) {
z3 = z7;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str53222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (BufferUnderflowException | Exception unused16) {
z3 = z7;
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str532222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
}
} catch (IndexOutOfBoundsException unused17) {
c3004Arr2 = c3004Arr6;
z3 = z7;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str5322222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (BufferUnderflowException | Exception unused18) {
c3004Arr2 = c3004Arr6;
z3 = z7;
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str53222222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
}
} else {
str30 = str2;
c3004Arr2 = c3004Arr6;
bArr15 = bArr3;
i30 = i12 + 1;
str2 = str30;
c3004Arr5 = c3004Arr2;
c29952 = c29956;
str7 = str36;
str43 = str28;
i7 = i11;
i10 = i13;
str35 = str5;
str8 = str29;
}
} catch (BufferUnderflowException | Exception unused19) {
str30 = str2;
}
} catch (IndexOutOfBoundsException unused20) {
str30 = str2;
}
}
} catch (IndexOutOfBoundsException unused21) {
str5 = str35;
c3004Arr2 = c3004Arr5;
str29 = str8;
str30 = str2;
z3 = z7;
c2986.m11680("Byte by search not found! Please edit pattern for search.\n", file2);
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str532222222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (BufferUnderflowException | Exception unused22) {
str5 = str35;
c3004Arr2 = c3004Arr5;
str29 = str8;
str30 = str2;
z3 = z7;
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str5322222222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
}
}
i13 = i10;
str5 = str35;
i11 = i7;
c3004Arr2 = c3004Arr5;
i12 = i30;
c29956 = c29952;
bArr3 = bArr15;
str29 = str8;
str30 = str2;
str36 = str7;
bArr15 = bArr3;
i30 = i12 + 1;
str2 = str30;
c3004Arr5 = c3004Arr2;
c29952 = c29956;
str7 = str36;
str43 = str28;
i7 = i11;
i10 = i13;
str35 = str5;
str8 = str29;
} catch (IndexOutOfBoundsException unused23) {
str5 = str35;
c3004Arr2 = c3004Arr5;
str28 = str43;
} catch (BufferUnderflowException | Exception unused24) {
str5 = str35;
c3004Arr2 = c3004Arr5;
str28 = str43;
}
}
int i31 = i10;
str5 = str35;
m11361 = bArr15;
mappedByteBuffer = mappedByteBuffer5;
z3 = z7;
i5 = i7;
i6 = i31;
i = 1;
} catch (IndexOutOfBoundsException unused25) {
} catch (BufferUnderflowException | Exception unused26) {
}
}
c3004Arr2 = c3004Arr5;
str28 = str43;
str29 = str8;
str30 = str2;
channel.close();
if (z3) {
str31 = str28;
try {
if (!this.f7973.contains(file2)) {
C3348.m12347("add patched file " + file.getName());
this.f7973.add(file2);
}
} catch (FileNotFoundException unused27) {
z = true;
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.", file2);
return z;
} catch (BufferUnderflowException unused28) {
return true;
} catch (Exception e5) {
e = e5;
z = true;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file2);
return z;
}
} else {
str31 = str28;
}
i8 = 0;
while (i8 < c3004Arr2.length) {
C3004 c30047 = c3004Arr2[i8];
if (c30047.f8172) {
str34 = str4;
if (!c30047.f8173.equals(str34)) {
for (C3004 c30048 : c3004Arr2) {
if (c30048.f8173.equals(c3004Arr2[i8].f8173)) {
c30048.f8176 = true;
}
}
}
} else {
str34 = str4;
}
i8++;
str4 = str34;
}
String str53222222222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
C3004 c30049 = c3004Arr2[i9];
if (!c30049.f8172) {
if (!c30049.f8173.equals(str53222222222)) {
if (!c3004Arr2[i9].f8176) {
if (c2986.f8056) {
ArrayList<File> arrayList6 = c2986.f8049;
if (file2.equals(arrayList6.get(arrayList6.size() - 1))) {
if (c3004Arr2[i9].f8178) {
StringBuilder sb6 = new StringBuilder();
sb6.append(C2979.m11674("Method patch"));
str33 = str29;
sb6.append(str33);
sb6.append(c3004Arr2[i9].f8183);
sb6.append(str31);
sb6.append(f7912);
str32 = str5;
sb6.append(str32);
sb6.append(C2979.m11674("Pattern not found!"));
sb6.append(str31);
c2986.m11680(sb6.toString(), file2);
} else {
str32 = str5;
str33 = str29;
c2986.m11680(C2979.m11674(str6) + str30 + (i9 + 1) + str33 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31 + C2979.m11674("or patch is already applied?!") + str31, file2);
}
z = false;
if (!c2986.f8055) {
ArrayList<File> arrayList7 = c2986.f8049;
if (file2.equals(arrayList7.get(arrayList7.size() - 1))) {
c2986.m11680(C2979.m11674(str6) + str30 + (i9 + 1) + str33 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31 + C2979.m11674("or patch is already applied?!") + str31, file2);
z = false;
}
}
if (!c2986.f8056 && !c2986.f8055) {
if (c3004Arr2[i9].f8178) {
c2986.m11680(C2979.m11674(str6) + str30 + (i9 + 1) + str33 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31 + C2979.m11674("or patch is already applied?!") + str31, file2);
} else {
c2986.m11680(C2979.m11674("Method patch") + str33 + c3004Arr2[i9].f8183 + str31 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31, file2);
}
}
i9++;
str29 = str33;
str5 = str32;
}
}
str32 = str5;
str33 = str29;
if (!c2986.f8055) {
}
if (!c2986.f8056) {
if (c3004Arr2[i9].f8178) {
}
}
i9++;
str29 = str33;
str5 = str32;
}
} else {
str32 = str5;
str33 = str29;
if (c3004Arr2[i9].f8178) {
c2986.m11680(C2979.m11674("Method patch") + str33 + c3004Arr2[i9].f8183 + str31 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31, file2);
} else {
c2986.m11680(C2979.m11674(str6) + str30 + (i9 + 1) + str33 + f7912 + str32 + C2979.m11674("Pattern not found!") + str31 + C2979.m11674("or patch is already applied?!") + str31, file2);
}
}
z = false;
i9++;
str29 = str33;
str5 = str32;
}
str32 = str5;
str33 = str29;
i9++;
str29 = str33;
str5 = str32;
}
return z;
}
} catch (FileNotFoundException unused29) {
z = true;
} catch (BufferUnderflowException unused30) {
z = true;
} catch (Exception e6) {
e = e6;
z = true;
}
}
C3004[] c3004Arr42 = new C3004[arrayList.toArray().length];
C3004[] c3004Arr52 = (C3004[]) arrayList.toArray(new C3004[arrayList.size()]);
z3 = z2;
i5 = -1;
i6 = 0;
while (true) {
i7 = i5 + 1;
if (i7 < m11361.length) {
}
int i312 = i10;
str5 = str35;
m11361 = bArr15;
mappedByteBuffer = mappedByteBuffer5;
z3 = z7;
i5 = i7;
i6 = i312;
i = 1;
}
c3004Arr2 = c3004Arr52;
str28 = str43;
str29 = str8;
str30 = str2;
channel.close();
if (z3) {
}
i8 = 0;
while (i8 < c3004Arr2.length) {
}
String str532222222222 = str4;
i9 = 0;
z = true;
while (i9 < c3004Arr2.length) {
}
return z;
} catch (FileNotFoundException unused31) {
} catch (BufferUnderflowException unused32) {
} catch (Exception e7) {
e = e7;
}
arrayList = arrayList3;
str4 = "";
str5 = " ";
c29952 = c29957;
str2 = " N";
str6 = "Pattern";
str7 = " \n(";
str3 = ")\n";
str8 = ":\n";
str9 = ": ";
i = 1;
mappedByteBuffer = map;
z2 = false;
} catch (FileNotFoundException unused33) {
} catch (BufferUnderflowException unused34) {
} catch (Exception e8) {
e = e8;
}
}
public void m11660(C2986 c2986) {
File file;
try {
try {
ArrayList arrayList = new ArrayList();
arrayList.add("/data/data/");
arrayList.add("/mnt/asec/");
arrayList.add("/sd-ext/data/");
arrayList.add("/data/sdext2/");
arrayList.add("/data/sdext1/");
arrayList.add("/data/sdext/");
ArrayList arrayList2 = new ArrayList();
arrayList2.add(this.f7977);
arrayList2.add(this.f7977 + "-1");
arrayList2.add(this.f7977 + "-2");
if (c2986.f8045.trim().equals("*")) {
c2986.f8055 = true;
File[] listFiles = new File("/data/data/" + this.f7977 + "/lib/").listFiles();
long j = 0;
if (listFiles != null && listFiles.length > 0) {
int length = listFiles.length;
int i = 0;
while (i < length) {
File file2 = listFiles[i];
if (file2.length() > j && file2.getName().endsWith(".so")) {
C2880.m11380(file2, c2986.f8049);
}
i++;
j = 0;
}
}
String replace = this.f7983.getName().replace(this.f7977, "").replace(".apk", "");
if (new File("/data/app-lib").exists()) {
File[] listFiles2 = new File("/data/app-lib/" + this.f7977 + replace + InternalZipConstants.ZIP_FILE_SEPARATOR).listFiles();
if (listFiles2 != null && listFiles2.length > 0) {
for (File file3 : listFiles2) {
if (file3.length() > 0 && file3.getName().endsWith(".so")) {
C2880.m11380(file3, c2986.f8049);
}
}
}
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String str = (String) it.next();
File file4 = new File(str + this.f7977 + replace + InternalZipConstants.ZIP_FILE_SEPARATOR);
if (file4.exists()) {
C2880 c2880 = new C2880("sdf");
ArrayList<File> arrayList3 = new ArrayList<>();
String m11608 = c2880.m11608(file4, ".so", arrayList3);
if (!m11608.equals("") && arrayList3.size() > 0) {
Iterator<File> it2 = arrayList3.iterator();
while (it2.hasNext()) {
C2880.m11380(it2.next(), c2986.f8049);
c2986.m11679("Found lib:" + m11608);
}
}
}
File file5 = new File(str + this.f7977 + InternalZipConstants.ZIP_FILE_SEPARATOR);
if (file5.exists()) {
C2880 c28802 = new C2880("sdf");
ArrayList<File> arrayList4 = new ArrayList<>();
String m116082 = c28802.m11608(file5, ".so", arrayList4);
if (!m116082.equals("") && arrayList4.size() > 0) {
Iterator<File> it3 = arrayList4.iterator();
while (it3.hasNext()) {
C2880.m11380(it3.next(), c2986.f8049);
c2986.m11679("Found lib:" + m116082);
}
}
}
}
return;
}
file = new File("/data/data/" + this.f7977 + "/lib/" + c2986.f8045);
try {
if (!file.exists()) {
Iterator it4 = arrayList.iterator();
while (it4.hasNext()) {
String str2 = (String) it4.next();
Iterator it5 = arrayList2.iterator();
while (it5.hasNext()) {
Iterator it6 = it4;
File file6 = new File(str2 + ((String) it5.next()));
if (file6.exists()) {
String m11606 = new C2880("sdf").m11606(file6, c2986.f8045);
if (m11606.equals("")) {
continue;
} else {
File file7 = new File(m11606);
try {
C2880.m11380(file7, c2986.f8049);
c2986.m11679("Found lib:" + m11606);
file = file7;
} catch (FileNotFoundException unused) {
file = file7;
c2986.m11679(f7912 + " " + file.getName() + " are not found!\n\nCheck the location libraries to solve problems!\n");
return;
}
}
}
it4 = it6;
}
}
} else {
C2880.m11380(file, c2986.f8049);
}
File m11357 = C2880.m11357(this.f7983);
if (new File(m11357.getAbsoluteFile() + "/lib").exists()) {
File file8 = new File(m11357.getAbsoluteFile() + "/lib/" + c2986.f8045);
try {
if (file8.exists()) {
C2880.m11380(file8, c2986.f8049);
}
File file9 = new File(m11357.getAbsoluteFile() + "/lib/arm/" + c2986.f8045);
if (file9.exists()) {
C2880.m11380(file9, c2986.f8049);
}
File file10 = new File(m11357.getAbsoluteFile() + "/lib/arm64/" + c2986.f8045);
if (file10.exists()) {
C2880.m11380(file10, c2986.f8049);
}
File file11 = new File(m11357.getAbsoluteFile() + "/lib/x86/" + c2986.f8045);
if (file11.exists()) {
C2880.m11380(file11, c2986.f8049);
}
file8 = new File(m11357.getAbsoluteFile() + "/lib/x86_64/" + c2986.f8045);
if (file8.exists()) {
C2880.m11380(file8, c2986.f8049);
}
file = new File(m11357.getAbsoluteFile() + "/lib/mips/" + c2986.f8045);
if (file.exists()) {
C2880.m11380(file, c2986.f8049);
}
} catch (FileNotFoundException unused2) {
file = file8;
c2986.m11679(f7912 + " " + file.getName() + " are not found!\n\nCheck the location libraries to solve problems!\n");
return;
}
}
if (!file.exists()) {
new File("/system/lib/" + c2986.f8045);
}
if (c2986.f8049.size() != 0) {
String replace2 = this.f7983.getName().replace(this.f7977, "").replace(".apk", "");
if (new File("/data/app-lib/" + this.f7977 + replace2 + InternalZipConstants.ZIP_FILE_SEPARATOR + c2986.f8045).exists()) {
C2880.m11380(new File("/data/app-lib/" + this.f7977 + replace2 + InternalZipConstants.ZIP_FILE_SEPARATOR + c2986.f8045), c2986.f8049);
return;
}
return;
}
throw new FileNotFoundException();
} catch (FileNotFoundException unused3) {
}
} catch (FileNotFoundException unused4) {
file = null;
}
} catch (Exception e) {
c2986.m11679("Exception e:" + e.toString());
}
}
public C3005[] m11661(ArrayList<C3005> arrayList) {
for (int size = arrayList.size() - 1; size >= 0; size--) {
if (arrayList.get(size).f8220) {
arrayList.remove(size);
}
}
return (C3005[]) arrayList.toArray(new C3005[arrayList.size()]);
}
public void m11662() {
Iterator<C2995> it;
C2995 c2995;
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String sb;
String str7;
String str8;
String str9;
String str10;
C2995 c29952;
ArrayList arrayList;
ArrayList arrayList2;
ArrayList arrayList3;
String str11;
String str12;
int i;
String str13;
String str14;
ArrayList arrayList4;
Document parse;
Iterator it2;
C2995 c29953;
String str15;
Iterator<C2989> it3;
Node node;
NodeList nodeList;
NodeList nodeList2;
NodeList nodeList3;
NodeList nodeList4;
String str16;
String[] strArr;
File file;
Iterator<C2995> it4;
StringBuilder sb2;
boolean z;
boolean z2;
boolean z3;
C2972 c2972 = this;
Iterator<C2995> it5 = c2972.f7920.iterator();
while (it5.hasNext()) {
C2995 next = it5.next();
if (next.f8099 == 1) {
ArrayList<C2986> arrayList5 = next.f8104;
C2986 c2986 = arrayList5.get(arrayList5.size() - 1);
ArrayList<File> arrayList6 = c2986.f8049;
if (arrayList6 != null && arrayList6.size() == 0) {
ArrayList<File> m11655 = m11655();
c2986.f8049 = m11655;
if (m11655 != null && m11655.size() > 1) {
c2986.f8056 = true;
}
}
Iterator<File> it6 = c2986.f8049.iterator();
while (it6.hasNext()) {
File next2 = it6.next();
ArrayList<C3009> arrayList7 = c2986.f8051;
if (arrayList7 != null && arrayList7.size() > 0 && !c2972.m11667(next2, next, c2986)) {
next.f8117 = false;
}
if (!(!c2986.f8057 ? c2972.m11659(next2, next, c2986) : false)) {
next.f8117 = false;
}
}
}
int i2 = next.f8099;
if ((i2 == 2 || i2 == 6 || i2 == 7 || i2 == 11 || i2 == 8 || i2 == 27 || i2 == 9) && c2972.f7974) {
Iterator<C2986> it7 = next.f8104.iterator();
while (it7.hasNext()) {
C2986 next3 = it7.next();
next.f8100 = next3.f8045;
c2972.m11669(next3, next);
ArrayList<File> arrayList8 = next3.f8049;
if (arrayList8 != null && arrayList8.size() > 0) {
Iterator<File> it8 = next3.f8049.iterator();
while (it8.hasNext()) {
File next4 = it8.next();
ArrayList<C3009> arrayList9 = next3.f8051;
if (arrayList9 != null && arrayList9.size() > 0 && !c2972.m11667(next4, next, next3)) {
next.f8117 = false;
}
if (!c2972.m11659(next4, next, next3)) {
next.f8117 = false;
}
}
}
}
}
String str17 = "";
if (next.f8099 == 10 && (z3 = c2972.f7974) && z3) {
Iterator<C2986> it9 = next.f8104.iterator();
while (it9.hasNext()) {
C2986 next5 = it9.next();
String m11656 = c2972.m11656(next5.f8045);
if (!m11656.equals("")) {
next5.f8049.add(new File(m11656));
}
ArrayList<C3009> arrayList10 = next5.f8051;
if (arrayList10 != null && arrayList10.size() > 0 && !c2972.m11667(new File(m11656), next, next5)) {
next.f8117 = false;
}
if (!c2972.m11659(new File(m11656), next, next5)) {
next.f8117 = false;
}
}
}
int i3 = next.f8099;
String str18 = " not found to dir\n";
String str19 = " File ";
String str20 = InternalZipConstants.ZIP_FILE_SEPARATOR;
if (i3 == 24 && (z2 = c2972.f7974) && z2) {
Iterator<C2984> it10 = next.f8109.iterator();
while (it10.hasNext()) {
C2984 next6 = it10.next();
String str21 = next6.f8037;
next.f8100 = str21;
String str22 = (!str21.equals("") && new File(next.f8100).exists()) ? next.f8100 : c2972.f7958 + InternalZipConstants.ZIP_FILE_SEPARATOR + next.f8100;
if (!new File(str22).exists()) {
next6.f8040 = false;
next6.m11677(f7912 + " File " + next.f8100 + " not found to dir\n" + C2880.m11357(new File(str22)) + "\n\n");
} else {
next6.f8040 = true;
next6.f8037 = str22;
next6.m11677("The file was added to the apk file successfully.\n\n");
}
}
}
if (next.f8099 == 25 && (z = c2972.f7974) && z) {
Iterator<C2990> it11 = next.f8110.iterator();
while (it11.hasNext()) {
it11.next().m11684("If the file was found, it is renamed.\n\n");
}
}
if (next.f8099 != 15 || c2972.f7974 || next.f8113.size() <= 0) {
it = it5;
} else {
Iterator<C2996> it12 = next.f8113.iterator();
while (it12.hasNext()) {
C2996 next7 = it12.next();
File file2 = new File(next7.f8119);
String[] split = c2972.f7948.split("\n");
int i4 = 0;
while (i4 < split.length) {
if (split[i4].equals("Open SqLite database")) {
File file3 = new File(split[i4 + 1]);
if (file3.getName().equals(file2.getName())) {
try {
C2880.m11518(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file3.getName());
sb2 = new StringBuilder();
it4 = it5;
} catch (Exception e) {
e = e;
it4 = it5;
}
try {
sb2.append(c2972.f7960);
sb2.append(InternalZipConstants.ZIP_FILE_SEPARATOR);
sb2.append(file3.getName());
if (new File(sb2.toString()).exists()) {
next7.f8119 = file3.getAbsolutePath();
}
SQLiteDatabase openDatabase = SQLiteDatabase.openDatabase(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file3.getName(), null, 0);
openDatabase.execSQL(next7.f8120);
next7.f8121 = true;
C3348.m12347(next7.f8120);
openDatabase.close();
} catch (Exception e2) {
e = e2;
C3348.m12347("LuckyPatcher: SQL error - " + e);
i4++;
it5 = it4;
}
i4++;
it5 = it4;
}
}
it4 = it5;
i4++;
it5 = it4;
}
}
it = it5;
Iterator<C2996> it13 = next.f8113.iterator();
while (it13.hasNext()) {
C2996 next8 = it13.next();
if (next8.f8121) {
File file4 = new File(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + new File(next8.f8119).getName());
if (file4.exists()) {
if (C2880.m11315(next8.f8119 + "-wal")) {
C2880.m11506("chmod 777 " + next8.f8119 + "-wal");
C2880.m11506("rm " + next8.f8119 + "-wal");
}
if (C2880.m11315(next8.f8119 + "-shm")) {
C2880.m11506("chmod 777 " + next8.f8119 + "-shm");
C2880.m11506("rm " + next8.f8119 + "-shm");
}
C2880.m11294(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + new File(next8.f8119).getName(), next8.f8119, true, true);
file4.delete();
}
}
}
}
String str23 = "%LP_Splitter%";
String str24 = ":";
if (next.f8099 != 21 || next.f8114.size() <= 0) {
c2995 = next;
str = "%LP_Splitter%";
str2 = ":";
str3 = " not found to dir\n";
str4 = " File ";
str5 = InternalZipConstants.ZIP_FILE_SEPARATOR;
} else {
ArrayList arrayList11 = new ArrayList();
ArrayList arrayList12 = new ArrayList();
String str25 = "string";
String str26 = "=";
String str27 = " ";
if (!c2972.f7974) {
Iterator<C2989> it14 = next.f8114.iterator();
String str28 = "";
while (it14.hasNext()) {
String str29 = str23;
C2989 next9 = it14.next();
String str30 = str18;
String str31 = str19;
File file5 = new File(next9.f8067);
String str32 = str24;
if (new File(next9.f8067).getName().equals(new File(str28).getName())) {
File file6 = new File(str28);
StringBuilder sb3 = new StringBuilder();
str16 = str28;
sb3.append(c2972.f7960);
sb3.append(InternalZipConstants.ZIP_FILE_SEPARATOR);
sb3.append(file6.getName());
if (new File(sb3.toString()).exists()) {
next9.f8067 = c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file6.getName();
next9.f8068 = file6;
next9.f8075 = true;
}
} else {
str16 = str28;
String[] split2 = c2972.f7948.split("\n");
int i5 = 0;
while (i5 < split2.length) {
String str33 = split2[i5];
String str34 = str26;
StringBuilder sb4 = new StringBuilder();
String str35 = str27;
sb4.append("found_pref_file_for_edit_");
sb4.append(next.f8116);
if (str33.equals(sb4.toString())) {
File file7 = new File(split2[i5 + 1]);
String absolutePath = file7.getAbsolutePath();
strArr = split2;
if (file7.getName().equals(file5.getName())) {
try {
String str36 = c2972.f7948;
StringBuilder sb5 = new StringBuilder();
file = file5;
try {
sb5.append("\nfound_pref_file_for_edit_");
sb5.append(next.f8116);
sb5.append("\n");
sb5.append(file7);
sb5.append("\n");
c2972.f7948 = str36.replace(sb5.toString(), "");
C2880.m11518(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file7.getName());
if (new File(c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file7.getName()).exists()) {
next9.f8067 = c2972.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file7.getName();
}
next9.f8068 = file7;
next9.f8075 = true;
C2880.m11380(new File(next9.f8067), arrayList11);
C2880.m11380(next9.f8068, arrayList12);
} catch (Exception e3) {
e = e3;
C3348.m12347("LuckyPatcher: SQL error - " + e);
str16 = absolutePath;
i5++;
str26 = str34;
str27 = str35;
split2 = strArr;
file5 = file;
}
} catch (Exception e4) {
e = e4;
file = file5;
}
} else {
file = file5;
}
str16 = absolutePath;
} else {
strArr = split2;
file = file5;
}
i5++;
str26 = str34;
str27 = str35;
split2 = strArr;
file5 = file;
}
}
str28 = str16;
str18 = str30;
str23 = str29;
str19 = str31;
str24 = str32;
str26 = str26;
str27 = str27;
}
str = str23;
String str37 = str24;
str3 = str18;
str4 = str19;
String str38 = str27;
String str39 = str26;
ArrayList arrayList13 = new ArrayList();
ArrayList arrayList14 = new ArrayList();
ArrayList arrayList15 = new ArrayList();
ArrayList arrayList16 = new ArrayList();
ArrayList arrayList17 = new ArrayList();
Iterator<C2989> it15 = next.f8114.iterator();
while (true) {
str5 = str20;
str10 = "int";
if (!it15.hasNext()) {
break;
}
C2989 next10 = it15.next();
Iterator<C2989> it16 = it15;
if (next10.f8071.equals("string")) {
arrayList13.add(next10);
}
if (next10.f8071.equals("int")) {
arrayList14.add(next10);
}
if (next10.f8071.equals("long")) {
arrayList16.add(next10);
}
if (next10.f8071.equals("boolean")) {
arrayList15.add(next10);
}
if (next10.f8071.equals("float")) {
arrayList17.add(next10);
}
str20 = str5;
it15 = it16;
}
int i6 = 0;
while (i6 < arrayList11.size()) {
String str40 = str17;
File file8 = (File) arrayList11.get(i6);
StringBuilder sb6 = new StringBuilder();
ArrayList arrayList18 = arrayList11;
sb6.append(((File) arrayList11.get(i6)).getAbsolutePath());
sb6.append(".tmp");
File file9 = new File(sb6.toString());
C2880.m11292(file8, file9);
try {
parse = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new FileInputStream(file9));
it2 = arrayList13.iterator();
} catch (Throwable th) {
th = th;
c29952 = next;
arrayList = arrayList13;
arrayList2 = arrayList14;
arrayList3 = arrayList12;
str11 = str10;
str12 = str25;
i = i6;
str13 = str39;
str14 = str38;
arrayList4 = arrayList17;
}
while (true) {
arrayList = arrayList13;
if (!it2.hasNext()) {
break;
}
try {
C2989 c2989 = (C2989) it2.next();
Iterator it17 = it2;
NodeList elementsByTagName = parse.getElementsByTagName(str25);
arrayList3 = arrayList12;
i = i6;
int i7 = 0;
while (i7 < elementsByTagName.getLength()) {
try {
Node item = elementsByTagName.item(i7);
NodeList nodeList5 = elementsByTagName;
Element element = (Element) elementsByTagName.item(i7);
str15 = str25;
try {
if (c2989.f8068 == null || element == null) {
c29953 = next;
} else {
c29953 = next;
try {
if (file8.getName().equals(c2989.f8068.getName()) && element.getAttribute(MediationMetaData.KEY_NAME).equals(c2989.f8072)) {
if (c2989.f8070) {
item.setTextContent(c2989.f8073);
item.normalize();
StringBuilder sb7 = new StringBuilder();
sb7.append(C2880.m11423(R.string.custom_patch_log_change_preference_insert));
sb7.append(":\n");
sb7.append(c2989.f8071);
str14 = str38;
try {
sb7.append(str14);
sb7.append(c2989.f8072);
str13 = str39;
try {
sb7.append(str13);
arrayList4 = arrayList17;
} catch (Throwable th2) {
th = th2;
arrayList4 = arrayList17;
arrayList2 = arrayList14;
str11 = str10;
str12 = str15;
c29952 = c29953;
th.printStackTrace();
ArrayList arrayList19 = arrayList3;
int i8 = i;
C2880.m11294(file8.getAbsolutePath(), ((File) arrayList19.get(i8)).getAbsolutePath(), true, true);
i6 = i8 + 1;
arrayList12 = arrayList19;
str38 = str14;
str17 = str40;
arrayList17 = arrayList4;
arrayList13 = arrayList;
str10 = str11;
next = c29952;
str39 = str13;
arrayList11 = arrayList18;
str25 = str12;
arrayList14 = arrayList2;
}
} catch (Throwable th3) {
th = th3;
str13 = str39;
}
try {
sb7.append(c2989.f8073);
c2989.m11683(sb7.toString());
} catch (Throwable th4) {
th = th4;
arrayList2 = arrayList14;
str11 = str10;
str12 = str15;
c29952 = c29953;
th.printStackTrace();
ArrayList arrayList192 = arrayList3;
int i82 = i;
C2880.m11294(file8.getAbsolutePath(), ((File) arrayList192.get(i82)).getAbsolutePath(), true, true);
i6 = i82 + 1;
arrayList12 = arrayList192;
str38 = str14;
str17 = str40;
arrayList17 = arrayList4;
arrayList13 = arrayList;
str10 = str11;
next = c29952;
str39 = str13;
arrayList11 = arrayList18;
str25 = str12;
arrayList14 = arrayList2;
}
} else {
str13 = str39;
str14 = str38;
arrayList4 = arrayList17;
}
if (c2989.f8069) {
item.getParentNode().removeChild(item);
c2989.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + c2989.f8071 + str14 + c2989.f8072);
}
c2989.f8076 = true;
i7++;
str38 = str14;
arrayList17 = arrayList4;
elementsByTagName = nodeList5;
next = c29953;
str39 = str13;
str25 = str15;
}
} catch (Throwable th5) {
th = th5;
str13 = str39;
str14 = str38;
arrayList4 = arrayList17;
arrayList2 = arrayList14;
str11 = str10;
str12 = str15;
c29952 = c29953;
th.printStackTrace();
ArrayList arrayList1922 = arrayList3;
int i822 = i;
C2880.m11294(file8.getAbsolutePath(), ((File) arrayList1922.get(i822)).getAbsolutePath(), true, true);
i6 = i822 + 1;
arrayList12 = arrayList1922;
str38 = str14;
str17 = str40;
arrayList17 = arrayList4;
arrayList13 = arrayList;
str10 = str11;
next = c29952;
str39 = str13;
arrayList11 = arrayList18;
str25 = str12;
arrayList14 = arrayList2;
}
}
str13 = str39;
str14 = str38;
arrayList4 = arrayList17;
i7++;
str38 = str14;
arrayList17 = arrayList4;
elementsByTagName = nodeList5;
next = c29953;
str39 = str13;
str25 = str15;
} catch (Throwable th6) {
th = th6;
c29953 = next;
}
} catch (Throwable th7) {
th = th7;
c29953 = next;
str15 = str25;
}
}
arrayList13 = arrayList;
it2 = it17;
arrayList12 = arrayList3;
i6 = i;
str25 = str25;
} catch (Throwable th8) {
th = th8;
c29953 = next;
arrayList3 = arrayList12;
str15 = str25;
i = i6;
}
str11 = str10;
str12 = str15;
c29952 = c29953;
th.printStackTrace();
ArrayList arrayList19222 = arrayList3;
int i8222 = i;
C2880.m11294(file8.getAbsolutePath(), ((File) arrayList19222.get(i8222)).getAbsolutePath(), true, true);
i6 = i8222 + 1;
arrayList12 = arrayList19222;
str38 = str14;
str17 = str40;
arrayList17 = arrayList4;
arrayList13 = arrayList;
str10 = str11;
next = c29952;
str39 = str13;
arrayList11 = arrayList18;
str25 = str12;
arrayList14 = arrayList2;
}
c29953 = next;
arrayList3 = arrayList12;
str15 = str25;
i = i6;
str13 = str39;
str14 = str38;
arrayList4 = arrayList17;
Iterator it18 = arrayList14.iterator();
while (it18.hasNext()) {
C2989 c29892 = (C2989) it18.next();
NodeList elementsByTagName2 = parse.getElementsByTagName(str10);
Iterator it19 = it18;
int i9 = 0;
while (i9 < elementsByTagName2.getLength()) {
Node item2 = elementsByTagName2.item(i9);
arrayList2 = arrayList14;
try {
Element element2 = (Element) elementsByTagName2.item(i9);
str11 = str10;
try {
if (c29892.f8068 == null || element2 == null) {
nodeList4 = elementsByTagName2;
} else {
nodeList4 = elementsByTagName2;
if (file8.getName().equals(c29892.f8068.getName()) && element2.getAttribute(MediationMetaData.KEY_NAME).equals(c29892.f8072)) {
if (c29892.f8070) {
item2.getAttributes().getNamedItem("value").setTextContent(c29892.f8073);
c29892.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_insert) + ":\n" + c29892.f8071 + str14 + c29892.f8072 + str13 + c29892.f8073);
}
if (c29892.f8069) {
item2.getParentNode().removeChild(item2);
c29892.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + c29892.f8071 + str14 + c29892.f8072);
}
c29892.f8076 = true;
}
}
i9++;
str10 = str11;
arrayList14 = arrayList2;
elementsByTagName2 = nodeList4;
} catch (Throwable th9) {
th = th9;
}
} catch (Throwable th10) {
th = th10;
}
}
it18 = it19;
}
arrayList2 = arrayList14;
str11 = str10;
Iterator it20 = arrayList16.iterator();
while (it20.hasNext()) {
C2989 c29893 = (C2989) it20.next();
NodeList elementsByTagName3 = parse.getElementsByTagName("long");
int i10 = 0;
while (i10 < elementsByTagName3.getLength()) {
Node item3 = elementsByTagName3.item(i10);
Element element3 = (Element) elementsByTagName3.item(i10);
Iterator it21 = it20;
if (c29893.f8068 == null || element3 == null) {
nodeList3 = elementsByTagName3;
} else {
nodeList3 = elementsByTagName3;
if (file8.getName().equals(c29893.f8068.getName()) && element3.getAttribute(MediationMetaData.KEY_NAME).equals(c29893.f8072)) {
if (c29893.f8070) {
element3.getAttributeNode("value").setTextContent(c29893.f8073);
c29893.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_insert) + ":\n" + c29893.f8071 + str14 + c29893.f8072 + str13 + c29893.f8073);
}
if (c29893.f8069) {
item3.getParentNode().removeChild(item3);
c29893.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + c29893.f8071 + str14 + c29893.f8072);
}
c29893.f8076 = true;
}
}
i10++;
it20 = it21;
elementsByTagName3 = nodeList3;
}
}
Iterator it22 = arrayList15.iterator();
while (it22.hasNext()) {
C2989 c29894 = (C2989) it22.next();
NodeList elementsByTagName4 = parse.getElementsByTagName("boolean");
int i11 = 0;
while (i11 < elementsByTagName4.getLength()) {
Node item4 = elementsByTagName4.item(i11);
Element element4 = (Element) elementsByTagName4.item(i11);
Iterator it23 = it22;
if (c29894.f8068 == null || element4 == null) {
nodeList2 = elementsByTagName4;
} else {
nodeList2 = elementsByTagName4;
if (file8.getName().equals(c29894.f8068.getName()) && element4.getAttribute(MediationMetaData.KEY_NAME).equals(c29894.f8072)) {
if (c29894.f8070) {
element4.getAttributeNode("value").setTextContent(c29894.f8073);
c29894.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_insert) + ":\n" + c29894.f8071 + str14 + c29894.f8072 + str13 + c29894.f8073);
}
if (c29894.f8069) {
item4.getParentNode().removeChild(item4);
c29894.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + c29894.f8071 + str14 + c29894.f8072);
}
c29894.f8076 = true;
}
}
i11++;
it22 = it23;
elementsByTagName4 = nodeList2;
}
}
Iterator it24 = arrayList4.iterator();
while (it24.hasNext()) {
C2989 c29895 = (C2989) it24.next();
NodeList elementsByTagName5 = parse.getElementsByTagName("float");
int i12 = 0;
while (i12 < elementsByTagName5.getLength()) {
Node item5 = elementsByTagName5.item(i12);
Element element5 = (Element) elementsByTagName5.item(i12);
Iterator it25 = it24;
if (c29895.f8068 == null || element5 == null) {
nodeList = elementsByTagName5;
} else {
nodeList = elementsByTagName5;
if (file8.getName().equals(c29895.f8068.getName()) && element5.getAttribute(MediationMetaData.KEY_NAME).equals(c29895.f8072)) {
if (c29895.f8070) {
element5.getAttributeNode("value").setTextContent(c29895.f8073);
c29895.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_insert) + ":\n" + c29895.f8071 + str14 + c29895.f8072 + str13 + c29895.f8073);
}
if (c29895.f8069) {
item5.getParentNode().removeChild(item5);
c29895.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + c29895.f8071 + str14 + c29895.f8072);
}
c29895.f8076 = true;
}
}
i12++;
it24 = it25;
elementsByTagName5 = nodeList;
}
}
Node item6 = parse.getElementsByTagName(PolicyMappingsExtension.MAP).item(0);
c29952 = c29953;
for (Iterator<C2989> it26 = c29952.f8114.iterator(); it26.hasNext(); it26 = it3) {
C2989 next11 = it26.next();
if (!next11.f8070 || next11.f8076 || next11.f8068 == null || !file8.getName().equals(next11.f8068.getName())) {
it3 = it26;
str12 = str15;
node = item6;
} else {
Element createElement = parse.createElement(next11.f8071);
it3 = it26;
str12 = str15;
try {
if (next11.f8071.equals(str12)) {
createElement.setAttribute(MediationMetaData.KEY_NAME, next11.f8072);
createElement.appendChild(parse.createTextNode(next11.f8073));
createElement.normalize();
} else {
createElement.setAttribute(MediationMetaData.KEY_NAME, next11.f8072);
createElement.setAttribute("value", next11.f8073);
}
item6.appendChild(createElement);
item6.insertBefore(parse.createTextNode("\n "), createElement);
StringBuilder sb8 = new StringBuilder();
node = item6;
sb8.append(C2880.m11423(R.string.custom_patch_log_change_preference_insert));
sb8.append(":\n");
sb8.append(next11.f8071);
sb8.append(str14);
sb8.append(next11.f8072);
sb8.append(str13);
sb8.append(next11.f8073);
next11.m11683(sb8.toString());
next11.f8076 = true;
} catch (Throwable th11) {
th = th11;
}
}
if (next11.f8076) {
c29952.f8118 = true;
}
item6 = node;
str15 = str12;
}
str12 = str15;
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(parse), new StreamResult(file8));
ArrayList arrayList192222 = arrayList3;
int i82222 = i;
C2880.m11294(file8.getAbsolutePath(), ((File) arrayList192222.get(i82222)).getAbsolutePath(), true, true);
i6 = i82222 + 1;
arrayList12 = arrayList192222;
str38 = str14;
str17 = str40;
arrayList17 = arrayList4;
arrayList13 = arrayList;
str10 = str11;
next = c29952;
str39 = str13;
arrayList11 = arrayList18;
str25 = str12;
arrayList14 = arrayList2;
}
c2995 = next;
c2972 = this;
str2 = str37;
} else {
c2995 = next;
str = "%LP_Splitter%";
String str41 = ":";
String str42 = "";
str3 = " not found to dir\n";
str4 = " File ";
str5 = InternalZipConstants.ZIP_FILE_SEPARATOR;
c2972.f7931 = true;
Iterator<C2989> it27 = c2995.f8114.iterator();
while (it27.hasNext()) {
C2989 next12 = it27.next();
next12.f8068 = new File(next12.f8067);
next12.f8075 = true;
String str43 = str42;
String str44 = !c2972.f7934.equals(str43) ? str : str43;
StringBuilder sb9 = new StringBuilder();
sb9.append(str44);
sb9.append(C2880.m11496(next12.f8067, ".xml", str43));
String str45 = str41;
sb9.append(str45);
String sb10 = sb9.toString();
if (next12.f8070) {
String str46 = ((sb10 + "+:") + next12.f8071 + str45) + next12.f8072 + str45;
String str47 = next12.f8073;
if (next12.f8071.equals("string")) {
try {
str47 = Base64.encodeToString(next12.f8073.getBytes("UTF-8"), 0).replace("\n", str43);
} catch (UnsupportedEncodingException e5) {
throw new RuntimeException(e5);
}
}
sb10 = str46 + str47;
next12.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_insert) + ":\n" + next12.f8071 + " " + next12.f8072 + "=" + next12.f8073);
}
if (next12.f8069) {
sb10 = (sb10 + "-:") + next12.f8072;
next12.m11683(C2880.m11423(R.string.custom_patch_log_change_preference_delete) + ":\n" + next12.f8071 + " " + next12.f8072);
}
next12.f8076 = true;
c2972.f7934 += sb10;
str41 = str45;
str42 = str43;
}
str2 = str41;
str17 = str42;
}
}
if (c2995.f8099 == 17 && c2972.f7974) {
Iterator<C2985> it28 = c2995.f8106.iterator();
while (it28.hasNext()) {
C2985 next13 = it28.next();
c2972.f7933 = true;
String str48 = next13.f8042;
c2995.f8100 = str48;
if (!str48.equals(str17) && new File(c2995.f8100).exists()) {
sb = c2995.f8100;
str6 = str5;
} else {
StringBuilder sb11 = new StringBuilder();
sb11.append(c2972.f7958);
str6 = str5;
sb11.append(str6);
sb11.append(c2995.f8100);
sb = sb11.toString();
}
if (!new File(sb).exists()) {
StringBuilder sb12 = new StringBuilder();
sb12.append(f7912);
str8 = str4;
sb12.append(str8);
sb12.append(c2995.f8100);
str7 = str3;
sb12.append(str7);
sb12.append(C2880.m11357(new File(sb)));
next13.m11678(sb12.toString());
str9 = str;
} else {
str7 = str3;
str8 = str4;
c2972.f7932 += sb + str2;
StringBuilder sb13 = new StringBuilder();
sb13.append(c2972.f7932);
sb13.append(next13.f8043);
str9 = str;
sb13.append(str9);
c2972.f7932 = sb13.toString();
next13.m11678("File copied success.");
}
str5 = str6;
str = str9;
str4 = str8;
str3 = str7;
}
}
String str49 = str5;
if (c2995.f8099 == 19 && !c2972.f7974 && c2972.f7919 != null) {
try {
C2880.m11292(c2972.f7919, new File(C3348.f9870.mo2480().getDir("bootlist", 0) + str49 + c2972.f7977));
} catch (Exception e6) {
e6.printStackTrace();
}
}
if (c2995.f8099 == 20 && !c2972.f7974 && c2995.f8112.size() > 0) {
Iterator<C2994> it29 = c2995.f8112.iterator();
while (it29.hasNext()) {
C2994 next14 = it29.next();
try {
if (next14.f8098) {
C2880 c2880 = new C2880(str17);
try {
String[] strArr2 = new String[1];
strArr2[0] = "pm enable '" + c2972.f7977 + str49 + next14.f8097 + "'";
c2880.m11618(strArr2);
} catch (Exception e7) {
e = e7;
e.printStackTrace();
}
} else {
C2880 c28802 = new C2880(str17);
String[] strArr3 = new String[1];
try {
strArr3[0] = "pm disable '" + c2972.f7977 + str49 + next14.f8097 + "'";
c28802.m11618(strArr3);
} catch (Exception e8) {
e = e8;
e.printStackTrace();
}
}
} catch (Exception e9) {
e = e9;
}
}
}
it5 = it;
}
}
public void m11663(C3007 c3007, File file) {
boolean z;
File file2;
File[] fileArr;
int i;
int i2;
long j;
int i3;
int i4;
int i5;
int i6;
boolean z2;
C3005[] c3005Arr;
int i7;
int length;
int i8;
int i9;
boolean z3;
C3005[] c3005Arr2;
byte[] bArr;
MappedByteBuffer mappedByteBuffer;
String str;
ArrayList<C3005> arrayList;
boolean z4;
ArrayList<Boolean> arrayList2;
C3007 c30072 = c3007;
int i10 = 0;
if (c30072 != null && (arrayList2 = c30072.f8239) != null && arrayList2.size() > 0) {
Iterator<Boolean> it = c30072.f8239.iterator();
while (it.hasNext()) {
if (it.next().booleanValue()) {
z = true;
break;
}
}
}
z = false;
if (z) {
File[] fileArr2 = this.f7963;
int length2 = fileArr2.length;
int i11 = 0;
while (i11 < length2) {
File file3 = fileArr2[i11];
if (file != null) {
file2 = file;
} else {
file2 = file3;
}
C3348.m12347("patch fie:" + file2.getAbsolutePath());
ArrayList<C3005> m11647 = m11647(c30072, file2);
C3005[] c3005Arr3 = (C3005[]) m11647.toArray(new C3005[m11647.size()]);
String str2 = " ";
if (!C3348.f9948.booleanValue()) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step2) + " " + file2.getName(), "%1d/%2d bytes", 0, (int) file2.length(), false);
}
long length3 = file2.length();
try {
FileChannel channel = new RandomAccessFile(file2, InternalZipConstants.WRITE_MODE).getChannel();
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
byte[] m11361 = C2880.m11361(file2);
if (file2.getName().endsWith(".dex") && file2.length() > 112) {
map.position(i10);
ArrayList arrayList3 = new ArrayList();
int i12 = 0;
while (i12 < c3005Arr3.length) {
C3005 c3005 = c3005Arr3[i12];
long j2 = length3;
if (c3005.f8233 && c3005.f8192) {
arrayList3.add(Integer.valueOf(i12));
int i13 = 0;
while (i13 < c3005.f8200.size()) {
int intValue = c3005.f8198.get(i13).intValue();
ArrayList arrayList4 = arrayList3;
byte[] bArr2 = new byte[intValue];
int i14 = 0;
boolean z5 = false;
while (i14 < intValue) {
fileArr = fileArr2;
int i15 = intValue - i14;
i = length2;
try {
byte[] bArr3 = c3005.f8195;
i2 = i11;
try {
try {
if (i15 <= bArr3.length) {
int length4 = bArr3.length;
int i16 = 0;
while (i16 < length4) {
bArr2[i14] = bArr3[i16];
if (i14 < intValue) {
i14++;
}
i16++;
z5 = true;
}
} else {
bArr2[i14] = 0;
}
i14++;
fileArr2 = fileArr;
length2 = i;
i11 = i2;
} catch (Throwable th) {
th = th;
th.printStackTrace();
if (file != null) {
}
}
} catch (IOException e) {
e = e;
e.printStackTrace();
if (file != null) {
}
}
} catch (IOException e2) {
e = e2;
i2 = i11;
e.printStackTrace();
if (file != null) {
}
} catch (Throwable th2) {
th = th2;
i2 = i11;
th.printStackTrace();
if (file != null) {
}
}
}
File[] fileArr3 = fileArr2;
int i17 = length2;
int i18 = i11;
if (z5) {
map.position(c3005.f8200.get(i13).intValue());
map.put(bArr2);
map.force();
this.f7975 += c3005.f8205 + "\n";
C3005 c30052 = c3005Arr3[i12];
c30052.f8201 = true;
c30052.f8203 = false;
if (!this.f7973.contains(file2)) {
this.f7973.add(file2);
}
}
c3005Arr3[i12].f8220 = true;
i13++;
arrayList3 = arrayList4;
fileArr2 = fileArr3;
length2 = i17;
i11 = i18;
}
}
i12++;
length3 = j2;
arrayList3 = arrayList3;
fileArr2 = fileArr2;
length2 = length2;
i11 = i11;
}
j = length3;
fileArr = fileArr2;
i = length2;
i2 = i11;
C3005[] m11661 = m11661(m11647);
map.position(0);
try {
if (map.get() == 100 && map.get() == 101 && map.get() == 120 && map.get() == 10) {
map.position(56);
int m11592 = C2880.m11592(map.get(), map.get(), map.get(), map.get());
int m115922 = C2880.m11592(map.get(), map.get(), map.get(), map.get());
map.position(m115922);
long m115923 = C2880.m11592(map.get(), map.get(), map.get(), map.get());
map.position(((m11592 - 1) * 4) + m115922);
i4 = C2880.m11592(map.get(), map.get(), map.get(), map.get());
map.position(108);
int m115924 = C2880.m11592(map.get(), map.get(), map.get(), map.get());
if (m115924 == m115923) {
try {
m115923 = file2.length();
} catch (Throwable th3) {
th = th3;
th.printStackTrace();
C3348.m12367(C2880.m11423(R.string.warning), C2880.m11423(R.string.message_about_patched_file) + " " + file2.getName());
map.position(0);
c3005Arr3 = m11661;
j = file2.length();
i3 = 0;
map.position(i3);
i5 = 1;
int i19 = i4 - 1;
i6 = 0;
z2 = false;
c3005Arr = c3005Arr3;
i7 = i19;
while (true) {
i7 += i5;
try {
if (i7 < m11361.length) {
}
c3005Arr = c3005Arr2;
i6 = i9;
z2 = r11;
i5 = 1;
} catch (Exception e3) {
e = e3;
}
}
channel.close();
length = c3005Arr.length;
i8 = 0;
while (true) {
if (i8 >= length) {
}
i8++;
}
if (file != null) {
}
}
} else {
i4 = m115924;
}
map.position(i4);
j = m115923;
} else {
i4 = 0;
}
c3005Arr3 = m11661;
} catch (Throwable th4) {
th = th4;
i4 = 0;
}
i3 = 0;
} else {
j = length3;
fileArr = fileArr2;
i = length2;
i2 = i11;
i3 = 0;
i4 = 0;
}
map.position(i3);
i5 = 1;
int i192 = i4 - 1;
i6 = 0;
z2 = false;
c3005Arr = c3005Arr3;
i7 = i192;
while (true) {
i7 += i5;
if (i7 < m11361.length) {
break;
}
int i20 = i6 + i5;
if (i7 > j) {
break;
}
if (!C3348.f9948.booleanValue() && i20 > 153600) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step2) + str2 + file2.getName(), "%1d/%2d bytes", i7, (int) file2.length(), false);
i9 = 0;
} else {
i9 = i20;
}
if (z2) {
c3005Arr2 = m11661(m11647);
z3 = false;
} else {
z3 = z2;
c3005Arr2 = c3005Arr;
}
boolean z6 = z3;
int i21 = 0;
while (i21 < c3005Arr2.length) {
try {
C3005 c30053 = c3005Arr2[i21];
if (c30053.f8213) {
int i22 = i7;
while (true) {
if (i22 > 0) {
try {
C3005 c30054 = c3005Arr2[i21];
int i23 = c30054.f8231 + 1;
c30054.f8231 = i23;
if (i23 < c30054.f8232) {
bArr = m11361;
mappedByteBuffer = map;
str = str2;
arrayList = m11647;
m11665(map, m11361, c3005Arr2, c30053, i21, i22);
if (!c3005Arr2[i21].f8213) {
break;
}
i22--;
m11361 = bArr;
map = mappedByteBuffer;
str2 = str;
m11647 = arrayList;
} else {
bArr = m11361;
mappedByteBuffer = map;
str = str2;
arrayList = m11647;
c30053.f8213 = false;
c30054.f8213 = false;
c30054.f8231 = 0;
break;
}
} catch (Exception e4) {
e = e4;
c3005Arr = c3005Arr2;
try {
e.printStackTrace();
channel.close();
length = c3005Arr.length;
i8 = 0;
while (true) {
if (i8 >= length) {
}
i8++;
}
} catch (IOException e5) {
e = e5;
e.printStackTrace();
if (file != null) {
}
}
if (file != null) {
}
}
} else {
bArr = m11361;
mappedByteBuffer = map;
str = str2;
arrayList = m11647;
break;
}
}
c30053.f8213 = false;
C3005 c30055 = c3005Arr2[i21];
c30055.f8213 = false;
c30055.f8231 = 0;
} else {
bArr = m11361;
mappedByteBuffer = map;
str = str2;
arrayList = m11647;
}
if (c30053.f8211) {
C3005 c30056 = c3005Arr2[i21];
int i24 = c30056.f8231 + 1;
c30056.f8231 = i24;
if (i24 < c30056.f8232) {
m11665(mappedByteBuffer, bArr, c3005Arr2, c30053, i21, i7);
} else {
c30053.f8211 = false;
c30056.f8211 = false;
c30056.f8231 = 0;
}
}
if (!c30053.f8211 && c30053.f8203 && (!(z4 = c30053.f8233) || !c30053.f8192)) {
if (z4) {
try {
System.out.println("dex method running");
if (c30053.f8224) {
Iterator<Integer> it2 = c30053.f8200.iterator();
while (it2.hasNext()) {
if (m11665(mappedByteBuffer, bArr, c3005Arr2, c30053, i21, it2.next().intValue()) && !this.f7973.contains(file2)) {
this.f7973.add(file2);
}
}
c3005Arr2[i21].f8203 = false;
}
if (c30053.f8196) {
for (int i25 = 0; i25 < c30053.f8200.size(); i25++) {
int intValue2 = c30053.f8200.get(i25).intValue();
int i26 = intValue2;
while (true) {
if (i26 < c30053.f8198.get(i25).intValue() + intValue2) {
int i27 = i26;
m11665(mappedByteBuffer, bArr, c3005Arr2, c30053, i21, i26);
C3005 c30057 = c3005Arr2[i21];
if (c30057.f8201) {
c30057.f8203 = false;
if (!this.f7973.contains(file2)) {
this.f7973.add(file2);
}
} else {
i26 = i27 + 1;
}
}
}
}
try {
try {
c3005Arr2[i21].f8203 = false;
} catch (Exception e6) {
e = e6;
c3005Arr = c3005Arr2;
e.printStackTrace();
channel.close();
length = c3005Arr.length;
i8 = 0;
while (true) {
if (i8 >= length) {
}
i8++;
}
if (file != null) {
}
}
} catch (Throwable th5) {
th = th5;
th.printStackTrace();
if (file != null) {
}
}
}
c3005Arr2[i21].f8220 = true;
z6 = true;
} catch (Exception e7) {
e = e7;
} catch (Throwable th6) {
th = th6;
}
}
try {
if (!c30053.f8233) {
try {
try {
m11665(mappedByteBuffer, bArr, c3005Arr2, c30053, i21, i7);
} catch (Exception e8) {
e = e8;
c3005Arr = c3005Arr2;
e.printStackTrace();
channel.close();
length = c3005Arr.length;
i8 = 0;
while (true) {
if (i8 >= length) {
}
i8++;
}
if (file != null) {
}
}
} catch (Throwable th7) {
th = th7;
th.printStackTrace();
if (file != null) {
}
}
}
} catch (Exception e9) {
e = e9;
}
}
i21++;
m11361 = bArr;
map = mappedByteBuffer;
str2 = str;
m11647 = arrayList;
} catch (Exception e10) {
e = e10;
}
}
c3005Arr = c3005Arr2;
i6 = i9;
z2 = z6;
i5 = 1;
}
channel.close();
length = c3005Arr.length;
i8 = 0;
while (true) {
if (i8 >= length) {
break;
}
if (c3005Arr[i8].f8201) {
if (!this.f7973.contains(file2)) {
this.f7973.add(file2);
}
} else {
i8++;
}
}
} catch (IOException e11) {
e = e11;
fileArr = fileArr2;
i = length2;
} catch (Throwable th8) {
th = th8;
fileArr = fileArr2;
i = length2;
}
if (file != null) {
c30072 = c3007;
i11 = i2 + 1;
fileArr2 = fileArr;
length2 = i;
i10 = 0;
} else {
return;
}
}
}
}
public void m11664() {
String str;
ArrayList<String> arrayList;
Iterator<C2995> it = this.f7920.iterator();
while (it.hasNext()) {
C2995 next = it.next();
int i = next.f8099;
if (i == 2 || i == 6 || i == 7 || i == 11 || i == 8 || i == 27 || i == 9) {
Iterator<C2986> it2 = next.f8104.iterator();
while (it2.hasNext()) {
C2986 next2 = it2.next();
m11660(next2);
ArrayList<File> arrayList2 = next2.f8049;
if (arrayList2 != null && arrayList2.size() > 0) {
Iterator<File> it3 = next2.f8049.iterator();
while (it3.hasNext()) {
File next3 = it3.next();
ArrayList<C3009> arrayList3 = next2.f8051;
if (arrayList3 != null && arrayList3.size() > 0 && !m11667(next3, next, next2)) {
next.f8117 = false;
}
if (!m11659(next3, next, next2)) {
next.f8117 = false;
}
}
}
}
}
if (next.f8099 == 18) {
Iterator<C2986> it4 = next.f8104.iterator();
while (it4.hasNext()) {
C2986 next4 = it4.next();
next.f8100 = next4.f8045;
String str2 = next.f8102;
File m11668 = m11668(next);
next4.m11679(next.f8102);
next.f8102 = str2;
if (m11668 != null && m11668.exists()) {
next4.f8049.add(m11668);
ArrayList<C3009> arrayList4 = next4.f8051;
if (arrayList4 != null && arrayList4.size() > 0 && !m11667(m11668, next, next4)) {
next.f8117 = false;
}
if (!m11659(m11668, next, next4)) {
next.f8117 = false;
}
}
}
}
if (next.f8099 == 14) {
File file = new File(C2880.m11392(this.f7983.getAbsolutePath(), true));
if (file.exists() && file.length() != 0) {
C2986 c2986 = next.f8104.get(0);
c2986.f8049.add(file);
ArrayList<C3009> arrayList5 = c2986.f8051;
if (arrayList5 != null && arrayList5.size() > 0 && !m11667(file, next, c2986)) {
next.f8117 = false;
}
if (!m11659(file, next, c2986)) {
next.f8117 = false;
}
} else {
if (file.length() == 0) {
file.delete();
}
next.m11685("Odex not found! Please use befor other Patch, and after run Custom Patch!");
}
}
String str3 = "";
if (next.f8099 == 22) {
Iterator<C2986> it5 = next.f8104.iterator();
while (it5.hasNext()) {
C2986 next5 = it5.next();
if (!next5.f8045.equals("") && next5.f8045.contains(InternalZipConstants.ZIP_FILE_SEPARATOR)) {
if (new File(next5.f8045).exists() && new File(next5.f8045).isDirectory()) {
m11666(next5, next);
ArrayList<File> arrayList6 = next5.f8049;
if (arrayList6 != null && arrayList6.size() > 0) {
Iterator<File> it6 = next5.f8049.iterator();
while (it6.hasNext()) {
File next6 = it6.next();
ArrayList<C3009> arrayList7 = next5.f8051;
if (arrayList7 != null && arrayList7.size() > 0 && !m11667(next6, next, next5)) {
next.f8117 = false;
}
if (!m11659(next6, next, next5)) {
next.f8117 = false;
}
}
} else {
next5.m11679(f7912 + " files for template \"" + next5.f8046 + "\" not founds.\n");
}
} else {
next5.m11679(f7912 + " \"" + next5.f8045 + "\" for the patch is not exists.\n");
next.f8117 = false;
}
} else {
next5.m11679(f7912 + " \"" + next5.f8045 + "\" for the patch is not defined correctly.\n");
next.f8117 = false;
}
}
}
if (next.f8099 == 23 && (arrayList = next.f8115) != null && arrayList.size() > 0) {
String m11414 = C2880.m11414("/system/etc/hosts");
if (m11414.equals("")) {
m11414 = "/data/data/hosts";
}
if (!new File(m11414).exists() || new File(m11414).length() != new File("/system/etc/hosts").length()) {
m11414 = "/system/etc/hosts";
} else {
C2880.m11508("chmod", "777", "/data/data/hosts");
C2880.m11508("chattr", "-ai", "/data/data/hosts");
}
try {
C2880.m11492("/system", InternalZipConstants.WRITE_MODE);
C2880.m11508("chmod", "777", "/system/etc/hosts");
C2880.m11508("chattr", "-ai", "/system/etc/hosts");
ArrayList arrayList8 = new ArrayList();
Iterator<String> it7 = next.f8115.iterator();
while (it7.hasNext()) {
String next7 = it7.next();
if (C2880.m11515(new File(m11414), "127.0.0.1 " + next7 + "\n\n")) {
next.m11685("Internet host \"" + next7 + "\" is already blocked.\n");
next.f8118 = true;
} else {
arrayList8.add(next7);
}
}
Iterator it8 = arrayList8.iterator();
while (it8.hasNext()) {
String str4 = (String) it8.next();
if (!C2880.m11512(new File(m11414), "127.0.0.1 " + str4 + "\n\n")) {
next.m11685(f7912 + "Failed to block \"" + str4 + "\" in the hosts file.\n");
next.f8117 = false;
} else {
next.m11685("Blocking Internet host \"" + str4 + "\" successful.\n");
next.f8118 = true;
}
}
} catch (Throwable th) {
th.printStackTrace();
next.f8117 = false;
}
}
if (next.f8099 == 16) {
Iterator<C2991> it9 = next.f8105.iterator();
while (it9.hasNext()) {
C2991 next8 = it9.next();
next.f8100 = next8.f8080;
File m116682 = m11668(next);
if (m116682 != null && m116682.exists()) {
C2880.m11508("chmod", "" + next8.f8081, m116682.getAbsolutePath());
}
}
}
if (next.f8099 == 17) {
Iterator<C2985> it10 = next.f8106.iterator();
while (it10.hasNext()) {
C2985 next9 = it10.next();
String str5 = next9.f8042;
next.f8100 = str5;
if (!str5.equals("") && new File(next.f8100).exists()) {
str = next.f8100;
} else {
str = this.f7958 + InternalZipConstants.ZIP_FILE_SEPARATOR + next.f8100;
}
File m11357 = C2880.m11357(new File(next9.f8043));
m11357.mkdirs();
C2880.m11508("chmod", "777", m11357.getAbsolutePath());
m11357.getAbsolutePath();
if (!new File(str).exists()) {
next9.m11678(f7912 + " File " + next.f8100 + " not found to dir\n" + C2880.m11357(new File(str)));
} else {
C2880.m11292(new File(str), new File(next9.f8043));
if (new File(next9.f8043).exists()) {
if (new File(next9.f8043).length() == new File(this.f7958 + InternalZipConstants.ZIP_FILE_SEPARATOR + next.f8100).length()) {
next9.m11678("File copied success.");
C2880.m11508("chmod", "777", next9.f8043);
}
}
next9.m11678(f7912 + "File copied with error. Try again.");
C2880.m11508("chmod", "777", next9.f8043);
}
}
}
if (next.f8099 == 15 && next.f8113.size() > 0) {
Iterator<C2996> it11 = next.f8113.iterator();
String str6 = "";
String str7 = str6;
while (it11.hasNext()) {
C2996 next10 = it11.next();
File file2 = new File(next10.f8119);
if (!str6.equals(next10.f8119)) {
str6 = next10.f8119;
if (!file2.exists()) {
next.f8100 = file2.getName();
File m116683 = m11668(next);
if (m116683 != null && m116683.exists()) {
C2880.m11518(m116683.getAbsolutePath());
C2880.m11292(m116683, new File(this.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + m116683.getName()));
next10.f8119 = m116683.getAbsolutePath();
next10.f8121 = true;
str7 = m116683.getAbsolutePath();
} else {
next10.f8119 = "database not found " + file2.getName();
str7 = "database not found " + file2.getName();
}
} else {
C2880.m11292(file2, new File(this.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + file2.getName()));
C2880.m11518(file2.getAbsolutePath());
next10.f8119 = file2.getAbsolutePath();
next10.f8121 = true;
str7 = file2.getAbsolutePath();
}
} else {
next10.f8119 = str7;
if (!str7.contains("database not found ")) {
next10.f8121 = true;
}
}
}
}
if (next.f8099 == 21) {
Iterator<C2989> it12 = next.f8114.iterator();
File file3 = null;
while (it12.hasNext()) {
C2989 next11 = it12.next();
File file4 = new File(next11.f8067);
if (!str3.equals(next11.f8067)) {
str3 = next11.f8067;
if (file4.exists()) {
next11.f8068 = file4;
} else {
next.f8100 = next11.f8067;
File m116684 = m11668(next);
next11.f8074 = next.f8102;
if (m116684.exists()) {
next11.f8068 = m116684;
C2880.m11518(m116684.getAbsolutePath());
C2880.m11292(next11.f8068, new File(this.f7960 + InternalZipConstants.ZIP_FILE_SEPARATOR + next11.f8068.getName()));
}
}
} else {
next11.f8068 = file3;
}
File file5 = next11.f8068;
if (file5 != null && file5.exists()) {
next11.f8075 = true;
file3 = next11.f8068;
}
}
}
}
}
boolean m11665(MappedByteBuffer mappedByteBuffer, byte[] bArr, C3005[] c3005Arr, C3005 c3005, int i, int i2) {
int i3;
int i4;
byte b;
byte[] bArr2;
int i5;
byte b2;
int i6;
byte b3;
byte b4;
if (i2 >= bArr.length) {
return false;
}
byte b5 = bArr[i2];
int i7 = 0;
byte b6 = 0;
boolean z = false;
while (true) {
int i8 = c3005.f8193[i7];
if ((i8 != 255 || (b5 != 110 && b5 != 111 && b5 != 114)) && ((i8 != 254 || (b5 != 16 && b5 != 32 && b5 != 48 && b5 != 64 && b5 != 84)) && (!c3005.f8227 || (i7 != 2 && i7 != 3)))) {
if (i8 != 255 && i8 != 254) {
if (b5 != c3005.f8191[i7] && i8 < 1 && (i3 = c3005.f8199[i7]) != 5 && i3 != 6) {
return z;
}
} else {
return z;
}
}
if (c3005.f8199[i7] == 1) {
c3005.f8197[i7] = c3005.f8195[i7];
}
if (c3005.f8227 && (i7 == 2 || i7 == 3)) {
if (i7 == 2) {
b6 = b5;
}
if (i7 == 3) {
int i9 = 0;
boolean z2 = false;
while (true) {
byte[][] bArr3 = c3005.f8216;
if (i9 >= bArr3.length) {
break;
}
byte[] bArr4 = (byte[]) Array.get(bArr3, i9);
if (b6 == bArr4[0] && b5 == bArr4[1]) {
z2 = true;
}
i9++;
}
if (!z2) {
return z;
}
}
}
if (c3005.f8199[i7] != 5 || b5 != c3005.f8191[i7]) {
if (c3005.f8193[i7] == 3) {
int i10 = 0;
boolean z3 = false;
while (true) {
int[] iArr = c3005.f8193;
if (i10 < iArr.length) {
if (iArr[i10] == 2) {
byte[] bArr5 = c3005.f8191;
if (bArr5[i10] == bArr5[i7]) {
b4 = bArr[i10 + i2];
break;
}
}
if (c3005.f8199[i10] == 2 && c3005.f8197[i10] == c3005.f8191[i7]) {
b4 = bArr[i10 + i2];
break;
}
i10++;
z3 = true;
} else {
b4 = -1;
break;
}
}
z3 = false;
if (z3) {
C3348.m12347("orig not read register for write byte");
return z;
}
if (b5 != b4) {
return z;
}
}
int i11 = c3005.f8199[i7];
if (i11 >= 20 && i11 < 30) {
if (b5 < 16) {
c3005.f8197[i7] = (byte) ((b5 & RegisterType.DOUBLE_HI) + ((i11 - 20) * 16));
} else {
if (i7 >= 7 && (((b2 = (bArr2 = c3005.f8191)[i7 - 1]) == 10 || b2 == 12) && ((b3 = bArr2[i7 - 7]) == 110 || b3 == 111 || b3 == 113 || b3 == 114 || b3 == 116 || b3 == 117 || b3 == 118 || b3 == 119 || b3 == 120))) {
byte[] bArr6 = c3005.f8197;
bArr6[i6] = 0;
bArr6[i7 - 6] = 0;
bArr6[i7 - 5] = 0;
bArr6[i7 - 4] = 0;
bArr6[i7 - 3] = 19;
bArr6[i7 - 2] = b5;
bArr6[i5] = (byte) ((b5 & RegisterType.DOUBLE_HI) + ((i11 - 20) * 16));
bArr6[i7] = 0;
}
byte b7 = c3005.f8191[i7 - 1];
if (b7 != 10 && b7 != 12) {
c3005.f8197[i7] = (byte) ((b5 & RegisterType.DOUBLE_HI) + ((i11 - 20) * 16));
}
}
}
if (i11 == 250) {
byte[] bArr7 = c3005.f8197;
int i12 = b5 & RegisterType.DOUBLE_HI;
bArr7[i7] = (byte) (i12 + (i12 * 16));
}
if (i11 == 3) {
int i13 = 0;
boolean z4 = false;
while (true) {
int[] iArr2 = c3005.f8193;
if (i13 < iArr2.length) {
if (iArr2[i13] == 2 && c3005.f8191[i13] == c3005.f8197[i7]) {
b = bArr[i13 + i2];
break;
}
if (c3005.f8199[i13] == 2) {
byte[] bArr8 = c3005.f8197;
if (bArr8[i13] == bArr8[i7]) {
b = bArr[i13 + i2];
break;
}
}
i13++;
z4 = true;
} else {
b = -1;
break;
}
}
z4 = false;
if (z4) {
C3348.m12347("repl not read register for write byte");
return z;
}
int i14 = c3005.f8197[i7] + 1;
while (c3005.f8217.size() < i14) {
c3005.f8217.add((byte) -1);
}
c3005.f8217.set(c3005.f8197[i7], Byte.valueOf(b));
}
int i15 = c3005.f8199[i7];
if (i15 != 0 && i15 != 5) {
i4 = 6;
} else {
i4 = 6;
}
c3005.f8197[i7] = b5;
if (i15 == i4 && b5 == c3005.f8191[i7]) {
c3005.f8197[i7] = RegisterType.REFERENCE;
}
i7++;
if (i7 == c3005.f8191.length) {
mappedByteBuffer.position(i2);
if (c3005.f8217.size() > 0) {
byte[] bArr9 = c3005.f8197;
byte[] copyOf = Arrays.copyOf(bArr9, bArr9.length);
for (int i16 = 0; i16 < copyOf.length; i16++) {
if (c3005.f8199[i16] == 3) {
copyOf[i16] = c3005.f8217.get(c3005.f8197[i16]).byteValue();
}
}
mappedByteBuffer.put(copyOf);
} else {
mappedByteBuffer.put(c3005.f8197);
}
mappedByteBuffer.force();
this.f7975 += c3005.f8205 + "\n";
c3005.f8201 = true;
C3005 c30052 = c3005Arr[i];
c30052.f8201 = true;
if (c3005.f8213) {
c3005.f8213 = false;
c30052.f8213 = false;
for (C3005 c30053 : c3005Arr) {
if (c30053.f8209.equals(c3005.f8209)) {
c30053.f8213 = false;
}
}
c3005Arr[i].f8231 = 0;
} else {
boolean z5 = c3005.f8211;
if (z5) {
c3005.f8211 = false;
c30052.f8211 = true;
for (C3005 c30054 : c3005Arr) {
if (c30054.f8207.equals(c3005.f8207)) {
c30054.f8211 = false;
}
}
c3005Arr[i].f8231 = 0;
} else if (!z5) {
if (!c3005.f8207.equals("")) {
for (int i17 = 0; i17 < c3005Arr.length; i17++) {
if (c3005Arr[i17].f8207.equals(c3005.f8207)) {
C3005 c30055 = c3005Arr[i17];
if (!c30055.f8218) {
c30055.f8211 = true;
c30055.f8231 = 0;
}
}
}
}
if (!c3005.f8209.equals("")) {
for (int i18 = 0; i18 < c3005Arr.length; i18++) {
if (c3005Arr[i18].f8209.equals(c3005.f8209)) {
C3005 c30056 = c3005Arr[i18];
if (!c30056.f8218) {
c30056.f8213 = true;
c30056.f8231 = 0;
}
}
}
}
} else {
z = true;
}
}
}
int i19 = i2 + i7;
if (i19 < bArr.length) {
b5 = bArr[i19];
} else {
return z;
}
} else {
return z;
}
}
}
public void m11666(C2986 c2986, C2995 c2995) {
try {
new C2880("").m11610(c2986.f8049, new File(c2986.f8045), c2986.f8046);
} catch (Throwable th) {
th.printStackTrace();
c2995.m11685(f7912 + "no access to directory.");
}
}
public boolean m11667(File file, C2995 c2995, C2986 c2986) {
boolean z;
int i;
int i2;
C3348.m12347("search to file " + file.getName());
c2986.f8052.clear();
ArrayList<C3009> arrayList = c2986.f8051;
int i3 = 1;
char c = 0;
if (arrayList != null && arrayList.size() > 0) {
Iterator<C3009> it = c2986.f8051.iterator();
int i4 = 0;
while (it.hasNext()) {
C3009 next = it.next();
next.f8266 = false;
if (c2995.f8099 == 1 && c2986.f8056 && next.f8267.equals("")) {
next.f8267 = "multi_" + i4;
i4++;
}
}
}
if (!C3348.f9948.booleanValue()) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step2) + " " + file.getName(), "%1d/%2d bytes", 0, (int) file.length(), false);
} else {
C2880.m11517("Size file:" + file.length());
}
ArrayList<C3009> arrayList2 = c2986.f8051;
if (arrayList2 != null && arrayList2.size() > 0) {
Iterator<C3009> it2 = arrayList2.iterator();
while (it2.hasNext()) {
it2.next().f8266 = false;
}
}
try {
FileChannel channel = new RandomAccessFile(file, InternalZipConstants.WRITE_MODE).getChannel();
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_WRITE, 0L, (int) channel.size());
C3009[] c3009Arr = new C3009[arrayList2.toArray().length];
C3009[] c3009Arr2 = (C3009[]) arrayList2.toArray(new C3009[arrayList2.size()]);
int i5 = 0;
while (map.hasRemaining()) {
try {
int i6 = i5 + i3;
if (!C3348.f9948.booleanValue()) {
if (i6 > 153600) {
C3923.m12599(C2880.m11423(R.string.wait), C2880.m11423(R.string.patch_step2) + " " + file.getName(), "%1d/%2d bytes", map.position(), (int) file.length(), false);
i6 = 0;
int position = map.position();
byte b = map.get();
i = 0;
while (i < c3009Arr2.length) {
map.position(position);
C3009 c3009 = c3009Arr2[i];
if (!c3009.f8266 && (b == c3009.f8263[c] || c3009.f8264[c] != 0)) {
if (c3009.f8264[c] != 0) {
c3009.f8265[c] = b;
}
map.position(position + 1);
if (!map.hasRemaining()) {
break;
}
byte b2 = map.get();
int i7 = 1;
while (true) {
C3009 c30092 = c3009Arr2[i];
i2 = i6;
if ((c30092.f8266 || b2 != c30092.f8263[i7]) && c30092.f8264[i7] == 0) {
break;
}
if (c30092.f8264[i7] > 0) {
c30092.f8265[i7] = b2;
}
i7++;
if (i7 == c30092.f8263.length) {
c30092.f8266 = true;
c2995.f8118 = true;
break;
}
if (!map.hasRemaining()) {
break;
}
b2 = map.get();
i6 = i2;
}
} else {
i2 = i6;
}
i++;
i6 = i2;
c = 0;
}
int i8 = i6;
map.position(position + 1);
i5 = i8;
i3 = 1;
c = 0;
} else {
int position2 = map.position();
byte b3 = map.get();
i = 0;
while (i < c3009Arr2.length) {
}
int i82 = i6;
map.position(position2 + 1);
i5 = i82;
i3 = 1;
c = 0;
}
} else {
if (i6 > 153600) {
map.position();
C2880.m11517("Progress size:" + map.position());
i6 = 0;
}
int position22 = map.position();
byte b32 = map.get();
i = 0;
while (i < c3009Arr2.length) {
}
int i822 = i6;
map.position(position22 + 1);
i5 = i822;
i3 = 1;
c = 0;
}
} catch (Exception e) {
e.printStackTrace();
c2986.m11680(f7912 + "Search byte error: " + e, file);
}
}
channel.close();
for (int i9 = 0; i9 < c3009Arr2.length; i9++) {
try {
C3009 c30093 = c3009Arr2[i9];
if (c30093.f8266 && !c30093.f8267.equals("")) {
for (C3009 c30094 : c3009Arr2) {
if (c30094.f8267.equals(c3009Arr2[i9].f8267)) {
c30094.f8268 = true;
}
}
}
} catch (FileNotFoundException unused) {
z = true;
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.\n", file);
return z;
} catch (BufferUnderflowException e2) {
e = e2;
z = true;
c2986.m11680("Exception e" + e.toString(), file);
return z;
} catch (Exception e3) {
e = e3;
z = true;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file);
return z;
}
}
z = true;
for (int i10 = 0; i10 < c3009Arr2.length; i10++) {
try {
C3009 c30095 = c3009Arr2[i10];
if (!c30095.f8266) {
if (!c30095.f8267.equals("")) {
if (!c3009Arr2[i10].f8268) {
if (c2986.f8056) {
ArrayList<File> arrayList3 = c2986.f8049;
if (file.equals(arrayList3.get(arrayList3.size() - 1))) {
c2986.m11680(C2979.m11674("Bytes by serach") + " N" + (i10 + 1) + ":\n" + f7912 + " " + C2979.m11674("Bytes not found!"), file);
z = false;
}
}
if (c2986.f8055) {
ArrayList<File> arrayList4 = c2986.f8049;
if (file.equals(arrayList4.get(arrayList4.size() - 1))) {
c2986.m11680(C2979.m11674("Bytes by serach") + " N" + (i10 + 1) + ":\n" + f7912 + " " + C2979.m11674("Bytes not found!"), file);
z = false;
}
}
if (!c2986.f8056 && !c2986.f8055) {
c2986.m11680(C2979.m11674("Bytes by serach") + " N" + (i10 + 1) + ":\n" + f7912 + " " + C2979.m11674("Bytes not found!"), file);
}
}
} else {
c2986.m11680(C2979.m11674("Bytes by serach") + " N" + (i10 + 1) + ":\n" + f7912 + " " + C2979.m11674("Bytes not found!"), file);
}
z = false;
}
} catch (FileNotFoundException unused2) {
c2986.m11680(f7912 + " Program files are not found!\nMove Program to internal storage.\n", file);
return z;
} catch (BufferUnderflowException e4) {
e = e4;
c2986.m11680("Exception e" + e.toString(), file);
return z;
} catch (Exception e5) {
e = e5;
e.printStackTrace();
c2986.m11680("Exception e" + e.toString(), file);
return z;
}
}
for (int i11 = 0; i11 < c3009Arr2.length; i11++) {
if (c3009Arr2[i11].f8266) {
c2986.m11680(C2979.m11674("Bytes by serach") + " N" + (i11 + 1) + ":", file);
}
String str = "";
int i12 = 0;
while (true) {
C3009 c30096 = c3009Arr2[i11];
int[] iArr = c30096.f8264;
if (i12 >= iArr.length) {
break;
}
int i13 = iArr[i12];
if (i13 > 1) {
int i14 = i13 - 2;
try {
c2986.f8052.set(i14, Byte.valueOf(c30096.f8265[i12]));
} catch (Exception unused3) {
c2986.f8052.add(i14, Byte.valueOf(c3009Arr2[i11].f8265[i12]));
}
if (c3009Arr2[i11].f8266) {
str = str + "R" + i14 + "=" + C2880.m11579(new byte[]{c2986.f8052.get(i14).byteValue()}).toUpperCase() + " ";
i12++;
}
}
i12++;
}
if (!str.equals("")) {
c2986.m11680(str + "\n", file);
}
}
} catch (FileNotFoundException unused4) {
} catch (BufferUnderflowException e6) {
e = e6;
} catch (Exception e7) {
e = e7;
}
return z;
}
public File m11668(C2995 c2995) {
File file;
File file2 = null;
try {
} catch (FileNotFoundException unused) {
} catch (Exception e) {
e = e;
}
if (new File(c2995.f8100).exists() && !c2995.f8100.startsWith("/mnt/sdcard")) {
return new File(c2995.f8100);
}
if (!c2995.f8100.startsWith("/mnt/sdcard") && !c2995.f8100.startsWith("/sdcard")) {
?? startsWith = c2995.f8100.startsWith("/data/data/" + this.f7977 + "/shared_prefs/");
String str = "";
try {
} catch (FileNotFoundException unused2) {
file2 = startsWith;
c2995.m11685(f7912 + " " + c2995.f8100 + " are not found!\n\nRun the application file to appear in the folder with the data.!\n");
return file2;
} catch (Exception e2) {
file2 = startsWith;
e = e2;
c2995.m11685("Exception e:" + e.toString());
return file2;
}
if (startsWith == 0) {
if (!c2995.f8100.startsWith("/dbdata/databases/" + this.f7977 + "/shared_prefs/") && !c2995.f8100.startsWith("/shared_prefs/")) {
File file3 = new File("/data/data/" + this.f7977 + c2995.f8100);
if (!file3.exists()) {
file2 = new File("/mnt/asec/" + this.f7977 + "-1" + c2995.f8100);
} else {
file2 = file3;
}
if (!file2.exists()) {
file2 = new File("/mnt/asec/" + this.f7977 + "-2" + c2995.f8100);
}
if (!file2.exists()) {
file2 = new File("/mnt/asec/" + this.f7977 + c2995.f8100);
}
if (!file2.exists()) {
file2 = new File("/sd-ext/data/" + this.f7977 + c2995.f8100);
}
if (!file2.exists()) {
file2 = new File("/data/sdext2/" + this.f7977 + c2995.f8100);
}
if (!file2.exists()) {
file2 = new File("/data/sdext1/" + this.f7977 + c2995.f8100);
}
if (!file2.exists()) {
file2 = new File("/data/sdext/" + this.f7977 + c2995.f8100);
}
if (!file2.exists()) {
String m11606 = new C2880("fgh").m11606(new File("/data/data/" + this.f7977), new File(c2995.f8100).getName());
if (!m11606.equals("")) {
file2 = new File(m11606);
}
}
if (!file2.exists()) {
throw new FileNotFoundException();
}
return file2;
}
}
if (c2995.f8100.startsWith("/data/data/" + this.f7977 + "/shared_prefs/")) {
str = "/data/data/" + this.f7977 + "/shared_prefs/";
}
if (c2995.f8100.startsWith("/dbdata/databases/" + this.f7977 + "/shared_prefs/")) {
str = "/dbdata/databases/" + this.f7977 + "/shared_prefs/";
}
if (c2995.f8100.startsWith("/shared_prefs/")) {
str = "/shared_prefs/";
}
File file4 = new File(c2995.f8100.replace(str, "/data/data/" + this.f7977 + "/shared_prefs/"));
if (!file4.exists()) {
file2 = new File(c2995.f8100.replace(str, "/dbdata/databases/" + this.f7977 + "/shared_prefs/"));
} else {
file2 = file4;
}
if (!file2.exists()) {
throw new FileNotFoundException();
}
return file2;
}
ArrayList arrayList = new ArrayList();
arrayList.add("/mnt/sdcard/");
arrayList.add("/storage/emulated/legacy/");
arrayList.add("/storage/emulated/0/");
arrayList.add("/storage/sdcard0/");
arrayList.add("/storage/sdcard/");
arrayList.add("/storage/sdcard1/");
arrayList.add("/sdcard/");
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
File file5 = new File(c2995.f8100.replace("/mnt/sdcard/", str2));
try {
if (file5.exists()) {
try {
new File(str2 + "test.tmp").createNewFile();
} catch (Exception e3) {
e3.printStackTrace();
file = new File("/figjvaja_papka");
}
if (new File(str2 + "test.tmp").exists()) {
new File(str2 + "test.tmp").delete();
file2 = file5;
break;
}
file = new File("/figjvaja_papka");
file2 = file;
} else {
file2 = file5;
}
} catch (FileNotFoundException unused3) {
file2 = file5;
c2995.m11685(f7912 + " " + c2995.f8100 + " are not found!\n\nRun the application file to appear in the folder with the data.!\n");
return file2;
} catch (Exception e4) {
e = e4;
file2 = file5;
c2995.m11685("Exception e:" + e.toString());
return file2;
}
}
if (!file2.exists()) {
throw new FileNotFoundException();
}
return file2;
}
public void m11669(C2986 c2986, C2995 c2995) {
try {
if (c2986.f8045.trim().equals("*")) {
c2986.f8055 = true;
ArrayList<File> arrayList = new ArrayList<>();
new C2880("").m11608(new File(this.f7960 + "/lib/"), ".so", arrayList);
if (arrayList.size() > 0) {
Iterator<File> it = arrayList.iterator();
while (it.hasNext()) {
File next = it.next();
if (next.length() > 0) {
c2986.f8049.add(next);
}
}
return;
}
return;
}
int i = c2995.f8099;
if (i != 2) {
if (i != 11) {
if (i != 27) {
switch (i) {
case 6:
c2986.f8049.clear();
String str = this.f7960 + "/lib/armeabi/" + c2986.f8045;
if (new File(this.f7960 + "/lib/armeabi/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str));
return;
}
throw new FileNotFoundException();
case 7:
c2986.f8049.clear();
String str2 = this.f7960 + "/lib/armeabi-v7a/" + c2986.f8045;
if (new File(this.f7960 + "/lib/armeabi-v7a/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str2));
return;
}
throw new FileNotFoundException();
case 8:
c2986.f8049.clear();
String str3 = this.f7960 + "/lib/mips/" + c2986.f8045;
if (new File(this.f7960 + "/lib/mips/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str3));
return;
}
throw new FileNotFoundException();
case 9:
c2986.f8049.clear();
String str4 = this.f7960 + "/lib/x86/" + c2986.f8045;
if (new File(this.f7960 + "/lib/x86/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str4));
return;
}
throw new FileNotFoundException();
default:
return;
}
}
c2986.f8049.clear();
String str5 = this.f7960 + "/lib/x86_64/" + c2986.f8045;
if (new File(this.f7960 + "/lib/x86_64/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str5));
return;
}
throw new FileNotFoundException();
}
c2986.f8049.clear();
String str6 = this.f7960 + "/lib/arm64-v8a/" + c2986.f8045;
if (new File(this.f7960 + "/lib/arm64-v8a/" + c2986.f8045).exists()) {
c2986.f8049.add(new File(str6));
return;
}
throw new FileNotFoundException();
}
String str7 = this.f7960 + "/lib/armeabi/" + c2986.f8045;
if (new File(str7).exists()) {
c2986.f8049.add(new File(str7));
}
String str8 = this.f7960 + "/lib/armeabi-v7a/" + c2986.f8045;
if (new File(str8).exists()) {
c2986.f8049.add(new File(str8));
}
String str9 = this.f7960 + "/lib/mips/" + c2986.f8045;
if (new File(str9).exists()) {
c2986.f8049.add(new File(str9));
}
String str10 = this.f7960 + "/lib/x86/" + c2986.f8045;
if (new File(str10).exists()) {
c2986.f8049.add(new File(str10));
}
String str11 = this.f7960 + "/lib/x86_64/" + c2986.f8045;
if (new File(str11).exists()) {
c2986.f8049.add(new File(str11));
}
String str12 = this.f7960 + "/lib/arm64-v8a/" + c2986.f8045;
if (new File(str12).exists()) {
c2986.f8049.add(new File(str12));
}
} catch (FileNotFoundException e) {
C3348.m12347(f7912 + "Lib not found!" + e.toString());
} catch (Exception e2) {
C3348.m12347(f7912 + "Lib select error: " + e2.toString());
}
}
}