正在查看: 絮语 v9.07 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 絮语 v9.07 应用的 d.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package i.runlibrary.a;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import androidx.webkit.ProxyConfig;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.zip.ZipOutputStream;
public final class d {
private static String a = Environment.getExternalStorageDirectory().toString();
private static String b = null;
private static String c = null;
public static int a(Context context, String str, String str2, String str3, boolean z) {
try {
return str2 == null ? c.a(a(context, str), a(context, str3), z) : c.a(a(context, str), str2, a(context, str3), z);
} catch (IOException e) {
e.printStackTrace();
return 0;
}
}
public static int a(Context context, String str, boolean z) {
File file = new File(a(context, str));
if (file.exists()) {
int i2 = 1;
if (file.isDirectory()) {
if (z) {
return b(file);
}
File[] listFiles = file.listFiles();
if (listFiles == null || listFiles.length == 0) {
file.delete();
return 1;
}
for (int i3 = 0; i3 < listFiles.length; i3++) {
if (file.isDirectory()) {
return 0;
}
}
for (int i4 = 0; i4 < listFiles.length; i4++) {
if (file.isFile()) {
try {
file.delete();
i2++;
} catch (Exception e) {
e.printStackTrace();
}
}
}
file.delete();
return i2;
}
try {
return file.delete() ? 1 : 0;
} catch (Exception e2) {
e2.printStackTrace();
}
}
return 0;
}
public static String a(Context context) {
if (b == null) {
b(context);
}
return b;
}
public static String a(Context context, String str) {
if (str.startsWith("@")) {
return str.substring(1);
}
if (!str.startsWith("%")) {
return str.startsWith("$") ? String.format("%s/%s", v.a(context), str.substring(1)) : str.startsWith("/") ? str : String.format("%s/%s", a, str);
}
String substring = str.substring(1);
return (substring.startsWith("/") || substring.startsWith("\\")) ? substring : Build.VERSION.SDK_INT >= 30 ? String.format("%s/%s", context.getExternalFilesDir(""), substring) : String.format("%s/%s", a(context), substring);
}
public static String a(Context context, String str, String str2) {
return str.startsWith("@") ? c(context, a(context, str), str2) : a(a(context, str), str2);
}
public static String a(String str, String str2) {
?? r0;
InputStreamReader inputStreamReader;
FileInputStream fileInputStream;
File file = new File(str);
FileInputStream fileInputStream2 = null;
if (!file.exists()) {
return null;
}
StringBuffer stringBuffer = new StringBuffer();
try {
try {
try {
fileInputStream = new FileInputStream(file);
} catch (Throwable th) {
th = th;
}
} catch (FileNotFoundException e) {
e = e;
inputStreamReader = null;
fileInputStream = null;
} catch (UnsupportedEncodingException e2) {
e = e2;
inputStreamReader = null;
fileInputStream = null;
} catch (IOException e3) {
e = e3;
inputStreamReader = null;
fileInputStream = null;
} catch (Throwable th2) {
th = th2;
r0 = 0;
if (fileInputStream2 != null) {
try {
fileInputStream2.close();
} catch (IOException e4) {
e4.printStackTrace();
}
}
if (r0 != 0) {
throw th;
}
try {
r0.close();
throw th;
} catch (IOException e5) {
e5.printStackTrace();
throw th;
}
}
try {
inputStreamReader = new InputStreamReader(fileInputStream, str2);
try {
char[] cArr = new char[512];
while (true) {
int read = inputStreamReader.read(cArr);
if (read <= 0) {
break;
}
stringBuffer.append(cArr, 0, read);
}
String str3 = new String(stringBuffer);
try {
fileInputStream.close();
} catch (IOException e6) {
e6.printStackTrace();
}
try {
inputStreamReader.close();
} catch (IOException e7) {
e7.printStackTrace();
}
return str3;
} catch (FileNotFoundException e8) {
e = e8;
e.printStackTrace();
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e9) {
e9.printStackTrace();
}
}
if (inputStreamReader == null) {
return null;
}
inputStreamReader.close();
return null;
} catch (UnsupportedEncodingException e10) {
e = e10;
e.printStackTrace();
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e11) {
e11.printStackTrace();
}
}
if (inputStreamReader == null) {
return null;
}
inputStreamReader.close();
return null;
} catch (IOException e12) {
e = e12;
e.printStackTrace();
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e13) {
e13.printStackTrace();
}
}
if (inputStreamReader == null) {
return null;
}
inputStreamReader.close();
return null;
}
} catch (FileNotFoundException e14) {
e = e14;
inputStreamReader = null;
} catch (UnsupportedEncodingException e15) {
e = e15;
inputStreamReader = null;
} catch (IOException e16) {
e = e16;
inputStreamReader = null;
} catch (Throwable th3) {
th = th3;
file = null;
fileInputStream2 = fileInputStream;
r0 = file;
if (fileInputStream2 != null) {
}
if (r0 != 0) {
}
}
} catch (IOException e17) {
e17.printStackTrace();
return null;
}
}
private static void a(ArrayList arrayList, File file, String[] strArr) {
if (file.exists()) {
if (file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles != null) {
for (File file2 : listFiles) {
a(arrayList, file2, strArr);
}
return;
}
return;
}
if (strArr == null) {
arrayList.add(file);
return;
}
String lowerCase = file.getName().toLowerCase();
for (String str : strArr) {
if (str.startsWith(ProxyConfig.MATCH_ALL_SCHEMES)) {
if (lowerCase.endsWith(str.substring(1))) {
arrayList.add(file);
return;
}
} else if (str.endsWith(ProxyConfig.MATCH_ALL_SCHEMES)) {
if (lowerCase.startsWith(str.substring(0, str.length() - 1))) {
arrayList.add(file);
return;
}
} else if (lowerCase.contains(str)) {
arrayList.add(file);
return;
}
}
}
}
public static boolean a(Context context, String str, String str2, String str3) {
if (str.startsWith("@")) {
return false;
}
return a(a(context, str), str2, str3);
}
public static boolean a(Context context, String str, String str2, boolean z) {
boolean startsWith = str.startsWith("@");
String a2 = a(context, str);
if (startsWith) {
return c(context, a2, a(context, str2), z);
}
File file = new File(a2);
if (file.exists()) {
if (file.isFile()) {
return a(a(context, a2), a(context, str2), z);
}
if (file.isDirectory() && b(a(context, a2), a(context, str2), z) > 0) {
return true;
}
}
return false;
}
public static boolean a(String str, String str2, String str3) {
OutputStreamWriter outputStreamWriter;
IOException e;
UnsupportedEncodingException e2;
FileNotFoundException e3;
File file = new File(str);
boolean z = false;
a(str, false);
try {
} catch (Throwable th) {
th = th;
}
try {
try {
outputStreamWriter = new OutputStreamWriter(new FileOutputStream(file), str3);
} catch (IOException e4) {
e4.printStackTrace();
}
try {
outputStreamWriter.write(str2);
outputStreamWriter.flush();
z = true;
outputStreamWriter.close();
} catch (FileNotFoundException e5) {
e3 = e5;
e3.printStackTrace();
outputStreamWriter.close();
return z;
} catch (UnsupportedEncodingException e6) {
e2 = e6;
e2.printStackTrace();
outputStreamWriter.close();
return z;
} catch (IOException e7) {
e = e7;
e.printStackTrace();
outputStreamWriter.close();
return z;
}
} catch (FileNotFoundException e8) {
outputStreamWriter = null;
e3 = e8;
} catch (UnsupportedEncodingException e9) {
outputStreamWriter = null;
e2 = e9;
} catch (IOException e10) {
outputStreamWriter = null;
e = e10;
} catch (Throwable th2) {
outputStreamWriter = null;
th = th2;
try {
outputStreamWriter.close();
} catch (IOException e11) {
e11.printStackTrace();
}
throw th;
}
return z;
}
public static boolean a(String str, String str2, boolean z) {
IOException e;
FileOutputStream fileOutputStream;
boolean z2 = false;
a(str2, false);
File file = new File(str2);
?? file2 = new File(str);
if (!file2.exists()) {
return false;
}
if (file.exists()) {
if (z == 0) {
return false;
}
file.delete();
}
try {
try {
try {
z = new FileInputStream((File) file2);
try {
file.createNewFile();
fileOutputStream = new FileOutputStream(file);
try {
byte[] bArr = new byte[512];
while (true) {
int read = z.read(bArr);
if (read <= 0) {
break;
}
fileOutputStream.write(bArr, 0, read);
}
z2 = true;
try {
fileOutputStream.close();
} catch (IOException e2) {
e2.printStackTrace();
}
z.close();
} catch (IOException e3) {
e = e3;
e.printStackTrace();
try {
fileOutputStream.close();
} catch (IOException e4) {
e4.printStackTrace();
}
z.close();
return z2;
}
} catch (IOException e5) {
fileOutputStream = null;
e = e5;
} catch (Throwable th) {
file2 = 0;
th = th;
try {
file2.close();
} catch (IOException e6) {
e6.printStackTrace();
}
try {
z.close();
throw th;
} catch (IOException e7) {
e7.printStackTrace();
throw th;
}
}
} catch (IOException e8) {
e8.printStackTrace();
}
} catch (IOException e9) {
z = 0;
e = e9;
fileOutputStream = null;
} catch (Throwable th2) {
z = 0;
th = th2;
file2 = 0;
}
return z2;
} catch (Throwable th3) {
th = th3;
}
}
public static boolean a(String str, boolean z) {
return (z ? new File(str) : new File(new File(str).getParent())).mkdirs();
}
public static boolean a(String str, byte[] bArr) {
boolean z;
a(str, false);
File file = new File(str);
if (file.exists()) {
file.delete();
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(file);
try {
fileOutputStream.write(bArr, 0, bArr.length);
z = true;
} catch (IOException e) {
e.printStackTrace();
z = false;
}
try {
fileOutputStream.close();
return z;
} catch (IOException e2) {
e2.printStackTrace();
return false;
}
} catch (FileNotFoundException e3) {
e3.printStackTrace();
return false;
}
}
public static byte[] a(File file) {
BufferedInputStream bufferedInputStream;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream((int) file.length());
byte[] bArr = null;
bArr = null;
BufferedInputStream bufferedInputStream2 = null;
try {
try {
bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
try {
try {
byte[] bArr2 = new byte[1024];
while (true) {
int read = bufferedInputStream.read(bArr2, 0, 1024);
if (-1 == read) {
break;
}
byteArrayOutputStream.write(bArr2, 0, read);
}
bArr = byteArrayOutputStream.toByteArray();
try {
bufferedInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
byteArrayOutputStream.close();
} catch (IOException e2) {
e = e2;
e.printStackTrace();
try {
bufferedInputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
byteArrayOutputStream.close();
return bArr;
}
} catch (Throwable th) {
th = th;
bufferedInputStream2 = bufferedInputStream;
try {
bufferedInputStream2.close();
} catch (IOException e4) {
e4.printStackTrace();
}
try {
byteArrayOutputStream.close();
throw th;
} catch (IOException e5) {
e5.printStackTrace();
throw th;
}
}
} catch (IOException e6) {
e6.printStackTrace();
}
} catch (IOException e7) {
e = e7;
bufferedInputStream = null;
} catch (Throwable th2) {
th = th2;
bufferedInputStream2.close();
byteArrayOutputStream.close();
throw th;
}
return bArr;
}
public static byte[] a(InputStream inputStream) {
BufferedInputStream bufferedInputStream;
byte[] bArr = null;
bArr = null;
BufferedInputStream bufferedInputStream2 = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(inputStream.available());
try {
try {
bufferedInputStream = new BufferedInputStream(inputStream);
try {
try {
byte[] bArr2 = new byte[1024];
while (true) {
int read = bufferedInputStream.read(bArr2, 0, 1024);
if (-1 == read) {
break;
}
byteArrayOutputStream.write(bArr2, 0, read);
}
bArr = byteArrayOutputStream.toByteArray();
try {
bufferedInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
byteArrayOutputStream.close();
} catch (IOException e2) {
e = e2;
e.printStackTrace();
try {
bufferedInputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
byteArrayOutputStream.close();
return bArr;
}
} catch (Throwable th) {
th = th;
bufferedInputStream2 = bufferedInputStream;
try {
bufferedInputStream2.close();
} catch (IOException e4) {
e4.printStackTrace();
}
try {
byteArrayOutputStream.close();
throw th;
} catch (IOException e5) {
e5.printStackTrace();
throw th;
}
}
} catch (IOException e6) {
e6.printStackTrace();
}
} catch (IOException e7) {
e = e7;
bufferedInputStream = null;
} catch (Throwable th2) {
th = th2;
bufferedInputStream2.close();
byteArrayOutputStream.close();
throw th;
}
return bArr;
} catch (IOException e8) {
e8.printStackTrace();
return null;
}
}
public static File[] a(File file, String[] strArr) {
if (strArr != null) {
for (int i2 = 0; i2 < strArr.length; i2++) {
strArr[i2] = strArr[i2].toLowerCase();
}
}
ArrayList arrayList = new ArrayList();
a(arrayList, file, strArr);
return (File[]) arrayList.toArray(new File[arrayList.size()]);
}
public static int b(Context context, String str, String str2) {
int i2;
try {
String a2 = a(context, str);
ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(a(context, str2)));
File file = new File(a2);
if (file.isFile()) {
i2 = c.a(file.getParent() + File.separator, file.getName(), zipOutputStream) + 0;
} else {
File[] listFiles = file.listFiles();
if (listFiles != null) {
int i3 = 0;
for (File file2 : listFiles) {
i3 += c.a(file2.getParent() + File.separator, file2.getName(), zipOutputStream);
}
i2 = i3;
} else {
i2 = 0;
}
}
zipOutputStream.finish();
zipOutputStream.close();
return i2;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
private static int b(File file) {
if (file.isFile()) {
file.delete();
return 1;
}
if (!file.isDirectory()) {
return 0;
}
File[] listFiles = file.listFiles();
if (listFiles == null || listFiles.length == 0) {
file.delete();
return 1;
}
int i2 = 0;
for (File file2 : listFiles) {
i2 += b(file2);
}
file.delete();
return i2;
}
private static int b(String str, String str2, boolean z) {
File[] listFiles;
File file = new File(str);
String absolutePath = new File(str2).getAbsolutePath();
if (file.getAbsolutePath().equals(absolutePath) || (listFiles = file.listFiles()) == null) {
return 0;
}
int i2 = 0;
for (int i3 = 0; i3 < listFiles.length; i3++) {
if (listFiles[i3].isFile()) {
if (a(listFiles[i3].getAbsolutePath(), String.format("%s/%s", absolutePath, listFiles[i3].getName()), z)) {
i2++;
}
} else if (listFiles[i3].isDirectory()) {
i2 += b(String.format("%s/%s", str, listFiles[i3].getName()), String.format("%s/%s", str2, listFiles[i3].getName()), z);
}
}
return i2;
}
public static void b(Context context) {
if (context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
String absolutePath = context.getFilesDir().getAbsolutePath();
b = absolutePath;
c = absolutePath;
} else {
c = a;
if (Build.VERSION.SDK_INT < 30) {
b = a;
} else {
File externalFilesDir = context.getExternalFilesDir(null);
b = externalFilesDir == null ? String.format("%s/Android/data/com.iapp.app/files", a) : externalFilesDir.getAbsolutePath();
}
}
}
public static boolean b(Context context, String str) {
if (!str.startsWith("@")) {
return new File(a(context, str)).exists();
}
try {
context.getAssets().open(a(context, str)).close();
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
public static boolean b(Context context, String str, String str2, boolean z) {
File file = new File(a(context, str2));
if (file.exists()) {
if (!z) {
return false;
}
file.delete();
}
if (str.startsWith("@")) {
return c(context, a(context, str), file.getAbsolutePath(), z);
}
File file2 = new File(a(context, str));
if (!file2.exists()) {
return false;
}
try {
if (file2.renameTo(file)) {
return true;
}
if (!a(file2.getAbsolutePath(), file.getAbsolutePath(), z)) {
return false;
}
file2.delete();
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static String[] b(Context context, String str, boolean z) {
File[] listFiles = new File(a(context, str)).listFiles();
if (listFiles == null) {
return null;
}
ArrayList arrayList = new ArrayList();
int i2 = 0;
if (z) {
while (i2 < listFiles.length) {
if (listFiles[i2].isDirectory()) {
arrayList.add(listFiles[i2].getAbsolutePath());
}
i2++;
}
} else {
while (i2 < listFiles.length) {
if (listFiles[i2].isFile()) {
arrayList.add(listFiles[i2].getAbsolutePath());
}
i2++;
}
}
return (String[]) arrayList.toArray(new String[arrayList.size()]);
}
public static int c(Context context, String str) {
if (!str.startsWith("@")) {
File file = new File(a(context, str));
if (file.exists()) {
return file.isDirectory() ? 2 : 1;
}
return -1;
}
try {
String a2 = a(context, str);
context.getAssets().open(a2).close();
return context.getAssets().list(a2) != null ? 2 : 1;
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
private static long c(File file) {
long j = 0;
if (!file.exists()) {
return 0L;
}
if (!file.isDirectory()) {
return file.length();
}
File[] listFiles = file.listFiles();
if (listFiles != null) {
for (File file2 : listFiles) {
j += c(file2);
}
}
return j;
}
private static String c(Context context, String str, String str2) {
InputStreamReader inputStreamReader;
StringBuffer stringBuffer = new StringBuffer();
InputStreamReader inputStreamReader2 = null;
try {
InputStream open = context.getAssets().open(str);
try {
inputStreamReader = new InputStreamReader(open, str2);
try {
try {
char[] cArr = new char[512];
while (true) {
int read = inputStreamReader.read(cArr);
if (read <= 0) {
break;
}
stringBuffer.append(cArr, 0, read);
}
String str3 = new String(stringBuffer);
try {
open.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStreamReader.close();
} catch (IOException e2) {
e2.printStackTrace();
}
return str3;
} catch (IOException e3) {
e = e3;
e.printStackTrace();
try {
open.close();
} catch (IOException e4) {
e4.printStackTrace();
}
try {
inputStreamReader.close();
return null;
} catch (IOException e5) {
e5.printStackTrace();
return null;
}
}
} catch (Throwable th) {
th = th;
inputStreamReader2 = inputStreamReader;
try {
open.close();
} catch (IOException e6) {
e6.printStackTrace();
}
try {
inputStreamReader2.close();
throw th;
} catch (IOException e7) {
e7.printStackTrace();
throw th;
}
}
} catch (IOException e8) {
e = e8;
inputStreamReader = null;
} catch (Throwable th2) {
th = th2;
open.close();
inputStreamReader2.close();
throw th;
}
} catch (IOException e9) {
e9.printStackTrace();
return null;
}
}
private static boolean c(Context context, String str, String str2, boolean z) {
Throwable th;
FileOutputStream fileOutputStream;
IOException e;
File file = new File(str2);
boolean z2 = false;
if (file.exists()) {
if (!z) {
return false;
}
file.delete();
}
a(str2, false);
try {
try {
try {
context = context.getAssets().open(str);
} catch (Throwable th2) {
th = th2;
}
} catch (IOException e2) {
fileOutputStream = null;
e = e2;
context = 0;
} catch (Throwable th3) {
str = 0;
th = th3;
context = 0;
}
try {
file.createNewFile();
fileOutputStream = new FileOutputStream(file);
try {
byte[] bArr = new byte[512];
while (true) {
int read = context.read(bArr);
if (read <= 0) {
break;
}
fileOutputStream.write(bArr, 0, read);
}
z2 = true;
try {
fileOutputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
} catch (IOException e4) {
e = e4;
e.printStackTrace();
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
if (context != 0) {
context.close();
}
return z2;
}
} catch (IOException e6) {
e = e6;
fileOutputStream = null;
} catch (Throwable th4) {
th = th4;
str = 0;
if (str != 0) {
try {
str.close();
} catch (IOException e7) {
e7.printStackTrace();
}
}
if (context == 0) {
throw th;
}
try {
context.close();
throw th;
} catch (IOException e8) {
e8.printStackTrace();
throw th;
}
}
if (context != 0) {
context.close();
}
} catch (IOException e9) {
e9.printStackTrace();
}
return z2;
}
public static long d(Context context, String str) {
if (!str.startsWith("@")) {
File file = new File(a(context, str));
if (file.exists()) {
return c(file);
}
return -1L;
}
int i2 = -1;
try {
InputStream open = context.getAssets().open(a(context, str));
i2 = open.available();
open.close();
} catch (IOException e) {
e.printStackTrace();
}
return i2;
}
public static String[] e(Context context, String str) {
if (!str.startsWith("@")) {
File[] listFiles = new File(a(context, str)).listFiles();
if (listFiles == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (File file : listFiles) {
arrayList.add(file.getAbsolutePath());
}
return (String[]) arrayList.toArray(new String[arrayList.size()]);
}
try {
String[] list = context.getAssets().list(a(context, str));
ArrayList arrayList2 = new ArrayList();
for (int i2 = 0; i2 < list.length; i2++) {
arrayList2.add(String.format("%s/%s", str, list[0]));
}
return (String[]) arrayList2.toArray(new String[arrayList2.size()]);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static String f(Context context, String str) {
return a(context, str);
}
public static byte[] g(Context context, String str) {
if (str.startsWith("@")) {
return i(context, a(context, str));
}
File file = new File(a(context, str));
if (file.exists()) {
return a(file);
}
return null;
}
public static void h(Context context, String str) {
File file = new File(a(context, str));
if (file.exists()) {
q.a(context, file);
}
}
private static byte[] i(Context context, String str) {
InputStream inputStream;
try {
inputStream = context.getAssets().open(str);
} catch (Exception unused) {
inputStream = null;
}
if (inputStream == null) {
return null;
}
return a(inputStream);
}
}