c.smali

.class Lcom/qq/e/comm/plugin/r/a/c;
.super Ljava/lang/Object;


# direct methods
.method public static a(Landroid/content/Context;)Ljava/lang/String;
    .registers 3

    const/4 v0, 0x0

    const-string v1, "config"

    invoke-static {p0, v1}, Lcom/qq/e/comm/plugin/r/a/c;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;

    move-result-object v1

    if-nez v1, :cond_a

    :cond_9
    :goto_9
    return-object v0

    :cond_a
    :try_start_a
    invoke-static {v1}, Lcom/qq/e/comm/plugin/r/a/c;->a(Ljava/io/File;)Ljava/lang/String;

    move-result-object v1

    if-eqz v1, :cond_9

    invoke-static {v1}, Lcom/qq/e/comm/plugin/util/c;->b(Ljava/lang/String;)Ljava/lang/String;
    :try_end_13
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_13} :catch_15

    move-result-object v0

    goto :goto_9

    :catch_15
    move-exception v1

    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_9
.end method

.method private static a(Ljava/io/File;)Ljava/lang/String;
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x0

    if-eqz p0, :cond_9

    invoke-virtual {p0}, Ljava/io/File;->exists()Z

    move-result v1

    if-nez v1, :cond_a

    :cond_9
    :goto_9
    return-object v0

    :cond_a
    :try_start_a
    new-instance v2, Ljava/io/InputStreamReader;

    new-instance v1, Ljava/io/FileInputStream;

    invoke-direct {v1, p0}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V

    const-string v3, "UTF-8"

    invoke-direct {v2, v1, v3}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;Ljava/lang/String;)V

    new-instance v1, Ljava/io/BufferedReader;

    invoke-direct {v1, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
    :try_end_1b
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_1b} :catch_50
    .catchall {:try_start_a .. :try_end_1b} :catchall_4b

    :try_start_1b
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    :goto_20
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_33

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_29
    .catch Ljava/io/IOException; {:try_start_1b .. :try_end_29} :catch_2a
    .catchall {:try_start_1b .. :try_end_29} :catchall_2c

    goto :goto_20

    :catch_2a
    move-exception v0

    :goto_2b
    :try_start_2b
    throw v0
    :try_end_2c
    .catchall {:try_start_2b .. :try_end_2c} :catchall_2c

    :catchall_2c
    move-exception v0

    :goto_2d
    if-eqz v1, :cond_32

    :try_start_2f
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
    :try_end_32
    .catch Ljava/lang/Exception; {:try_start_2f .. :try_end_32} :catch_44

    :cond_32
    :goto_32
    throw v0

    :cond_33
    :try_start_33
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_36
    .catch Ljava/io/IOException; {:try_start_33 .. :try_end_36} :catch_2a
    .catchall {:try_start_33 .. :try_end_36} :catchall_2c

    move-result-object v0

    if-eqz v1, :cond_9

    :try_start_39
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
    :try_end_3c
    .catch Ljava/lang/Exception; {:try_start_39 .. :try_end_3c} :catch_3d

    goto :goto_9

    :catch_3d
    move-exception v1

    const-string v2, "Exception while close bufferreader"

    invoke-static {v2, v1}, Lcom/qq/e/comm/util/GDTLogger;->e(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_9

    :catch_44
    move-exception v1

    const-string v2, "Exception while close bufferreader"

    invoke-static {v2, v1}, Lcom/qq/e/comm/util/GDTLogger;->e(Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_32

    :catchall_4b
    move-exception v1

    move-object v4, v0

    move-object v0, v1

    move-object v1, v4

    goto :goto_2d

    :catch_50
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    goto :goto_2b
.end method

.method private static a(Landroid/content/Context;Ljava/io/File;Ljava/lang/String;Z)V
    .registers 9

    const/4 v1, 0x0

    if-nez p1, :cond_4

    :cond_3
    :goto_3
    return-void

    :cond_4
    :try_start_4
    new-instance v0, Ljava/io/OutputStreamWriter;

    new-instance v2, Ljava/io/FileOutputStream;

    invoke-direct {v2, p1}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    const-string v3, "UTF-8"

    invoke-direct {v0, v2, v3}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/lang/String;)V
    :try_end_10
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_10} :catch_26
    .catchall {:try_start_4 .. :try_end_10} :catchall_4d

    if-eqz p3, :cond_16

    :try_start_12
    invoke-static {p2}, Lcom/qq/e/comm/plugin/util/c;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p2

    :cond_16
    invoke-virtual {v0, p2}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V
    :try_end_19
    .catch Ljava/lang/Exception; {:try_start_12 .. :try_end_19} :catch_4b
    .catchall {:try_start_12 .. :try_end_19} :catchall_3a

    if-eqz v0, :cond_3

    :try_start_1b
    invoke-virtual {v0}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_1e
    .catch Ljava/lang/Exception; {:try_start_1b .. :try_end_1e} :catch_1f

    goto :goto_3

    :catch_1f
    move-exception v0

    const-string v0, "close config writer failed"

    invoke-static {v0}, Lcom/qq/e/comm/util/GDTLogger;->d(Ljava/lang/String;)V

    goto :goto_3

    :catch_26
    move-exception v0

    move-object v0, v1

    :goto_28
    :try_start_28
    const-string v1, "write mediation config to file fail"

    invoke-static {v1}, Lcom/qq/e/comm/util/GDTLogger;->d(Ljava/lang/String;)V
    :try_end_2d
    .catchall {:try_start_28 .. :try_end_2d} :catchall_3a

    if-eqz v0, :cond_3

    :try_start_2f
    invoke-virtual {v0}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_32
    .catch Ljava/lang/Exception; {:try_start_2f .. :try_end_32} :catch_33

    goto :goto_3

    :catch_33
    move-exception v0

    const-string v0, "close config writer failed"

    invoke-static {v0}, Lcom/qq/e/comm/util/GDTLogger;->d(Ljava/lang/String;)V

    goto :goto_3

    :catchall_3a
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    :goto_3e
    if-eqz v1, :cond_43

    :try_start_40
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_43
    .catch Ljava/lang/Exception; {:try_start_40 .. :try_end_43} :catch_44

    :cond_43
    :goto_43
    throw v0

    :catch_44
    move-exception v1

    const-string v1, "close config writer failed"

    invoke-static {v1}, Lcom/qq/e/comm/util/GDTLogger;->d(Ljava/lang/String;)V

    goto :goto_43

    :catch_4b
    move-exception v1

    goto :goto_28

    :catchall_4d
    move-exception v0

    goto :goto_3e
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;)V
    .registers 4

    const-string v0, "config"

    invoke-static {p0, v0}, Lcom/qq/e/comm/plugin/r/a/c;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    const/4 v1, 0x1

    invoke-static {p0, v0, p1, v1}, Lcom/qq/e/comm/plugin/r/a/c;->a(Landroid/content/Context;Ljava/io/File;Ljava/lang/String;Z)V

    return-void
.end method

.method public static b(Landroid/content/Context;Ljava/lang/String;)V
    .registers 4

    const-string v0, "test"

    invoke-static {p0, v0}, Lcom/qq/e/comm/plugin/r/a/c;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    const/4 v1, 0x0

    invoke-static {p0, v0, p1, v1}, Lcom/qq/e/comm/plugin/r/a/c;->a(Landroid/content/Context;Ljava/io/File;Ljava/lang/String;Z)V

    return-void
.end method

.method private static c(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
    .registers 5

    const/4 v0, 0x0

    const-string v1, "e_qq_com_mediation"

    const/4 v2, 0x0

    invoke-virtual {p0, v1, v2}, Landroid/content/Context;->getDir(Ljava/lang/String;I)Ljava/io/File;

    move-result-object v2

    invoke-virtual {v2}, Ljava/io/File;->exists()Z

    move-result v1

    if-nez v1, :cond_1a

    invoke-virtual {v2}, Ljava/io/File;->mkdirs()Z

    move-result v1

    if-nez v1, :cond_1a

    const-string v1, "Create mediation config dir failed!"

    invoke-static {v1}, Lcom/qq/e/comm/util/GDTLogger;->w(Ljava/lang/String;)V

    :goto_19
    return-object v0

    :cond_1a
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, v2, p1}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    :try_start_1f
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_3b

    invoke-virtual {v1}, Ljava/io/File;->createNewFile()Z

    move-result v2

    if-nez v2, :cond_3b

    const-string v1, "Create mediation config file failed!"

    invoke-static {v1}, Lcom/qq/e/comm/util/GDTLogger;->w(Ljava/lang/String;)V
    :try_end_30
    .catch Ljava/io/IOException; {:try_start_1f .. :try_end_30} :catch_31

    goto :goto_19

    :catch_31
    move-exception v1

    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    const-string v1, "Create mediation config file failed!"

    invoke-static {v1}, Lcom/qq/e/comm/util/GDTLogger;->w(Ljava/lang/String;)V

    goto :goto_19

    :cond_3b
    move-object v0, v1

    goto :goto_19
.end method