Files
rr3-apk/smali_classes4/com/mbridge/msdk/foundation/download/utils/UnzipUtility.smali
Daniel Elliott f3960ee359 Add Discord APKTool decompilation (Smali source for modding)
- Imported from https://github.com/supermegamestre/Project-Real-Resurrection-3
- APKTool decompilation (Smali bytecode) for modding and rebuilding APK
- Supports both 32-bit (armeabi-v7a) and 64-bit (arm64-v8a) architectures
- Includes full Smali source, resources, and native libraries
- Ready to rebuild APK after modifications with apktool b command
- Added comprehensive README-apktool.md with modding guide

This branch complements the JADX branches:
- Use JADX (main/discord-community) to UNDERSTAND code (readable Java)
- Use APKTool (this branch) to MODIFY and REBUILD APK (editable Smali)

Total: 44,417 files, 538.51 MB Smali source code
2026-02-18 16:13:44 -08:00

761 lines
16 KiB
Smali

.class public Lcom/mbridge/msdk/foundation/download/utils/UnzipUtility;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field private static final BUFFER_SIZE:I = 0x1000
.field private static final TAG:Ljava/lang/String; = "UnzipUtility"
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private extractFile(Ljava/util/zip/ZipInputStream;Ljava/lang/String;)V
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 17
new-instance v0, Ljava/io/File;
invoke-direct {v0, p2}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 18
invoke-virtual {v0}, Ljava/io/File;->getParentFile()Ljava/io/File;
move-result-object p2
invoke-virtual {p2}, Ljava/io/File;->exists()Z
move-result p2
if-nez p2, :cond_0
.line 19
invoke-virtual {v0}, Ljava/io/File;->getParentFile()Ljava/io/File;
move-result-object p2
invoke-virtual {p2}, Ljava/io/File;->mkdirs()Z
:cond_0
const/4 p2, 0x0
.line 24
:try_start_0
new-instance v1, Ljava/io/BufferedOutputStream;
new-instance v2, Ljava/io/FileOutputStream;
invoke-direct {v2, v0}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
invoke-direct {v1, v2}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
.catchall {:try_start_0 .. :try_end_0} :catchall_1
const/16 p2, 0x1000
:try_start_1
new-array p2, p2, [B
.line 27
:goto_0
invoke-virtual {p1, p2}, Ljava/io/InputStream;->read([B)I
move-result v0
const/4 v2, -0x1
if-eq v0, v2, :cond_1
const/4 v2, 0x0
.line 28
invoke-virtual {v1, p2, v2, v0}, Ljava/io/BufferedOutputStream;->write([BII)V
:try_end_1
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
.catchall {:try_start_1 .. :try_end_1} :catchall_0
goto :goto_0
:catchall_0
move-exception p1
move-object p2, v1
goto :goto_2
:catch_0
move-exception p1
move-object p2, v1
goto :goto_1
.line 34
:cond_1
invoke-virtual {v1}, Ljava/io/OutputStream;->close()V
return-void
:catchall_1
move-exception p1
goto :goto_2
:catch_1
move-exception p1
.line 31
:goto_1
:try_start_2
new-instance v0, Ljava/io/IOException;
invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
throw v0
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
:goto_2
if-eqz p2, :cond_2
.line 34
invoke-virtual {p2}, Ljava/io/OutputStream;->close()V
.line 36
:cond_2
throw p1
.end method
# virtual methods
.method public unzip(Ljava/lang/String;Ljava/lang/String;)I
.locals 13
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const-string v0, "../"
const-string v1, ".."
const-string v2, "UnzipUtility"
const/4 v3, -0x1
if-eqz p1, :cond_18
if-nez p2, :cond_0
goto/16 :goto_13
:cond_0
const-string v4, "/"
.line 44
invoke-virtual {p2, v4}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v5
if-nez v5, :cond_1
.line 45
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v5, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v5, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p2
.line 48
:cond_1
new-instance v4, Ljava/io/File;
invoke-direct {v4, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 49
invoke-virtual {v4}, Ljava/io/File;->exists()Z
move-result p1
if-nez p1, :cond_2
const/4 p1, 0x1
return p1
:cond_2
const/4 p1, 0x0
.line 56
:try_start_0
new-instance v5, Ljava/util/zip/ZipFile;
invoke-direct {v5, v4}, Ljava/util/zip/ZipFile;-><init>(Ljava/io/File;)V
.line 57
invoke-virtual {v5}, Ljava/util/zip/ZipFile;->entries()Ljava/util/Enumeration;
move-result-object v4
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_b
.catchall {:try_start_0 .. :try_end_0} :catchall_2
move-object v6, p1
.line 59
:goto_0
:try_start_1
invoke-interface {v4}, Ljava/util/Enumeration;->hasMoreElements()Z
move-result v7
const/4 v8, 0x0
if-eqz v7, :cond_11
.line 60
invoke-interface {v4}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;
move-result-object v7
check-cast v7, Ljava/util/zip/ZipEntry;
:try_end_1
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_3
.catchall {:try_start_1 .. :try_end_1} :catchall_0
const/4 v9, 0x2
if-nez v7, :cond_5
if-eqz p1, :cond_3
.line 105
:try_start_2
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
goto :goto_1
:catch_0
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_3
:goto_1
if-eqz v6, :cond_4
.line 112
:try_start_3
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_3
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_1
goto :goto_2
:catch_1
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_4
:goto_2
return v9
.line 64
:cond_5
:try_start_4
invoke-virtual {v7}, Ljava/util/zip/ZipEntry;->getName()Ljava/lang/String;
move-result-object v10
.line 66
invoke-static {v10}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v11
if-nez v11, :cond_e
invoke-virtual {v10, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v11
if-nez v11, :cond_e
invoke-virtual {v10, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v11
if-eqz v11, :cond_6
goto/16 :goto_8
.line 71
:cond_6
new-instance v11, Ljava/io/File;
new-instance v12, Ljava/lang/StringBuilder;
invoke-direct {v12}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v12, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v12, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v12}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v10
invoke-direct {v11, v10}, Ljava/io/File;-><init>(Ljava/lang/String;)V
:try_end_4
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_3
.catchall {:try_start_4 .. :try_end_4} :catchall_0
.line 73
:try_start_5
invoke-virtual {v11}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String;
move-result-object v10
:try_end_5
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_5} :catch_2
.catchall {:try_start_5 .. :try_end_5} :catchall_0
goto :goto_3
:catchall_0
move-exception p2
goto/16 :goto_10
:catch_2
:try_start_6
const-string v10, ""
.line 78
:goto_3
invoke-static {v10}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v12
if-nez v12, :cond_b
invoke-virtual {v10, p2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v12
if-eqz v12, :cond_b
invoke-virtual {v10, v1}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v12
if-nez v12, :cond_b
invoke-virtual {v10, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v10
if-eqz v10, :cond_7
goto :goto_5
.line 81
:cond_7
invoke-virtual {v7}, Ljava/util/zip/ZipEntry;->isDirectory()Z
move-result v9
if-eqz v9, :cond_8
.line 82
invoke-virtual {v11}, Ljava/io/File;->mkdirs()Z
goto/16 :goto_0
:catch_3
move-exception p2
goto/16 :goto_d
.line 84
:cond_8
invoke-virtual {v11}, Ljava/io/File;->getParentFile()Ljava/io/File;
move-result-object v9
invoke-virtual {v9}, Ljava/io/File;->exists()Z
move-result v9
if-nez v9, :cond_9
.line 85
invoke-virtual {v11}, Ljava/io/File;->getParentFile()Ljava/io/File;
move-result-object v9
invoke-virtual {v9}, Ljava/io/File;->mkdirs()Z
.line 88
:cond_9
new-instance v9, Ljava/io/FileOutputStream;
invoke-direct {v9, v11}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
:try_end_6
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_3
.catchall {:try_start_6 .. :try_end_6} :catchall_0
.line 89
:try_start_7
invoke-virtual {v5, v7}, Ljava/util/zip/ZipFile;->getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream;
move-result-object p1
const/16 v6, 0x400
new-array v7, v6, [B
.line 92
:goto_4
invoke-virtual {p1, v7, v8, v6}, Ljava/io/InputStream;->read([BII)I
move-result v10
if-eq v10, v3, :cond_a
.line 93
invoke-virtual {v9, v7, v8, v10}, Ljava/io/FileOutputStream;->write([BII)V
.line 94
invoke-virtual {v9}, Ljava/io/OutputStream;->flush()V
:try_end_7
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_4
.catchall {:try_start_7 .. :try_end_7} :catchall_1
goto :goto_4
:catchall_1
move-exception p2
move-object v6, v9
goto/16 :goto_10
:catch_4
move-exception p2
move-object v6, v9
goto/16 :goto_d
:cond_a
move-object v6, v9
goto/16 :goto_0
:cond_b
:goto_5
if-eqz p1, :cond_c
.line 105
:try_start_8
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_8
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_5
goto :goto_6
:catch_5
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_c
:goto_6
if-eqz v6, :cond_d
.line 112
:try_start_9
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_9
.catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_6
goto :goto_7
:catch_6
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_d
:goto_7
return v9
:cond_e
:goto_8
if-eqz p1, :cond_f
.line 105
:try_start_a
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_a
.catch Ljava/io/IOException; {:try_start_a .. :try_end_a} :catch_7
goto :goto_9
:catch_7
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_f
:goto_9
if-eqz v6, :cond_10
.line 112
:try_start_b
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_b
.catch Ljava/io/IOException; {:try_start_b .. :try_end_b} :catch_8
goto :goto_a
:catch_8
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_10
:goto_a
return v9
.line 98
:cond_11
:try_start_c
invoke-virtual {v5}, Ljava/util/zip/ZipFile;->close()V
:try_end_c
.catch Ljava/io/IOException; {:try_start_c .. :try_end_c} :catch_3
.catchall {:try_start_c .. :try_end_c} :catchall_0
if-eqz p1, :cond_12
.line 105
:try_start_d
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_d
.catch Ljava/io/IOException; {:try_start_d .. :try_end_d} :catch_9
goto :goto_b
:catch_9
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_12
:goto_b
if-eqz v6, :cond_13
.line 112
:try_start_e
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_e
.catch Ljava/io/IOException; {:try_start_e .. :try_end_e} :catch_a
goto :goto_c
:catch_a
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_13
:goto_c
return v8
:catchall_2
move-exception p2
move-object v6, p1
goto :goto_10
:catch_b
move-exception p2
move-object v6, p1
.line 100
:goto_d
:try_start_f
invoke-virtual {p2}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p2
invoke-static {v2, p2}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:try_end_f
.catchall {:try_start_f .. :try_end_f} :catchall_0
if-eqz p1, :cond_14
.line 105
:try_start_10
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_10
.catch Ljava/io/IOException; {:try_start_10 .. :try_end_10} :catch_c
goto :goto_e
:catch_c
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_14
:goto_e
if-eqz v6, :cond_15
.line 112
:try_start_11
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_11
.catch Ljava/io/IOException; {:try_start_11 .. :try_end_11} :catch_d
goto :goto_f
:catch_d
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_15
:goto_f
const/4 p1, 0x3
return p1
:goto_10
if-eqz p1, :cond_16
.line 105
:try_start_12
invoke-virtual {p1}, Ljava/io/InputStream;->close()V
:try_end_12
.catch Ljava/io/IOException; {:try_start_12 .. :try_end_12} :catch_e
goto :goto_11
:catch_e
move-exception p1
.line 108
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
:cond_16
:goto_11
if-eqz v6, :cond_17
.line 112
:try_start_13
invoke-virtual {v6}, Ljava/io/FileOutputStream;->close()V
:try_end_13
.catch Ljava/io/IOException; {:try_start_13 .. :try_end_13} :catch_f
goto :goto_12
:catch_f
move-exception p1
.line 115
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
move-result-object p1
invoke-static {v2, p1}, Lcom/mbridge/msdk/foundation/tools/af;->b(Ljava/lang/String;Ljava/lang/String;)V
.line 117
:cond_17
:goto_12
throw p2
:cond_18
:goto_13
return v3
.end method