e.smali

.class public Lcom/cm/perm/e;
.super Ljava/lang/Object;
.source "ConfigStorage.java"


# static fields
.field public static a:Ljava/lang/String;

.field private static f:Lcom/cm/perm/e;


# instance fields
.field private b:Z

.field private c:Lorg/json/JSONObject;

.field private d:Landroid/content/Context;

.field private e:Ljava/io/File;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 21
    sget-object v0, Lcom/cm/perm/d;->a:Ljava/lang/String;

    sput-object v0, Lcom/cm/perm/e;->a:Ljava/lang/String;

    .line 184
    new-instance v0, Lcom/cm/perm/e;

    invoke-direct {v0}, Lcom/cm/perm/e;-><init>()V

    sput-object v0, Lcom/cm/perm/e;->f:Lcom/cm/perm/e;

    return-void
.end method

.method private constructor <init>()V
    .registers 3

    .prologue
    const/4 v1, 0x0

    .line 28
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 179
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/cm/perm/e;->b:Z

    .line 180
    iput-object v1, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    .line 181
    iput-object v1, p0, Lcom/cm/perm/e;->d:Landroid/content/Context;

    .line 182
    iput-object v1, p0, Lcom/cm/perm/e;->e:Ljava/io/File;

    .line 29
    invoke-static {}, Lcom/cm/perm/a;->a()Lcom/cm/perm/a$a;

    move-result-object v0

    invoke-interface {v0}, Lcom/cm/perm/a$a;->g()Landroid/content/Context;

    move-result-object v0

    const-string v1, "permlcfg"

    invoke-direct {p0, v0, v1}, Lcom/cm/perm/e;->a(Landroid/content/Context;Ljava/lang/String;)Z

    .line 30
    return-void
.end method

.method public static a()Lcom/cm/perm/e;
    .registers 1

    .prologue
    .line 23
    sget-object v0, Lcom/cm/perm/e;->f:Lcom/cm/perm/e;

    return-object v0
.end method

.method private a(Ljava/io/File;)V
    .registers 4

    .prologue
    .line 90
    invoke-direct {p0, p1}, Lcom/cm/perm/e;->b(Ljava/io/File;)Ljava/lang/String;

    move-result-object v0

    .line 93
    :try_start_4
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    iput-object v1, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;
    :try_end_b
    .catch Lorg/json/JSONException; {:try_start_4 .. :try_end_b} :catch_c

    .line 99
    :goto_b
    return-void

    .line 95
    :catch_c
    move-exception v0

    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    .line 97
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    iput-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    goto :goto_b
.end method

.method private a(Ljava/lang/String;Ljava/io/File;)V
    .registers 7

    .prologue
    .line 151
    if-nez p2, :cond_3

    .line 173
    :cond_2
    :goto_2
    return-void

    .line 155
    :cond_3
    const/4 v2, 0x0

    .line 158
    :try_start_4
    new-instance v1, Ljava/io/OutputStreamWriter;

    new-instance v0, Ljava/io/FileOutputStream;

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

    const-string v3, "UTF-8"

    invoke-direct {v1, v0, v3}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/lang/String;)V
    :try_end_10
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_10} :catch_1f
    .catchall {:try_start_4 .. :try_end_10} :catchall_2f

    .line 159
    :try_start_10
    invoke-virtual {v1, p1}, Ljava/io/OutputStreamWriter;->write(Ljava/lang/String;)V

    .line 160
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->flush()V
    :try_end_16
    .catch Ljava/io/IOException; {:try_start_10 .. :try_end_16} :catch_3e
    .catchall {:try_start_10 .. :try_end_16} :catchall_3b

    .line 166
    :try_start_16
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_19
    .catch Ljava/io/IOException; {:try_start_16 .. :try_end_19} :catch_1a

    goto :goto_2

    .line 171
    :catch_1a
    move-exception v0

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

    goto :goto_2

    .line 163
    :catch_1f
    move-exception v0

    move-object v1, v2

    :goto_21
    :try_start_21
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
    :try_end_24
    .catchall {:try_start_21 .. :try_end_24} :catchall_3b

    .line 166
    if-eqz v1, :cond_2

    .line 168
    :try_start_26
    invoke-virtual {v1}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_29
    .catch Ljava/io/IOException; {:try_start_26 .. :try_end_29} :catch_2a

    goto :goto_2

    .line 171
    :catch_2a
    move-exception v0

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

    goto :goto_2

    .line 165
    :catchall_2f
    move-exception v0

    .line 166
    :goto_30
    if-eqz v2, :cond_35

    .line 168
    :try_start_32
    invoke-virtual {v2}, Ljava/io/OutputStreamWriter;->close()V
    :try_end_35
    .catch Ljava/io/IOException; {:try_start_32 .. :try_end_35} :catch_36

    .line 173
    :cond_35
    :goto_35
    throw v0

    .line 171
    :catch_36
    move-exception v1

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

    goto :goto_35

    .line 165
    :catchall_3b
    move-exception v0

    move-object v2, v1

    goto :goto_30

    .line 163
    :catch_3e
    move-exception v0

    goto :goto_21
.end method

.method private a(Landroid/content/Context;Ljava/lang/String;)Z
    .registers 6

    .prologue
    .line 34
    iget-boolean v0, p0, Lcom/cm/perm/e;->b:Z

    if-eqz v0, :cond_7

    .line 35
    iget-boolean v0, p0, Lcom/cm/perm/e;->b:Z

    .line 51
    :goto_6
    return v0

    .line 38
    :cond_7
    iput-object p1, p0, Lcom/cm/perm/e;->d:Landroid/content/Context;

    .line 41
    new-instance v0, Ljava/io/File;

    new-instance v1, Ljava/lang/StringBuilder;

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

    iget-object v2, p0, Lcom/cm/perm/e;->d:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, "/"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

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

    .line 42
    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_3c

    .line 43
    invoke-direct {p0, v0}, Lcom/cm/perm/e;->a(Ljava/io/File;)V

    .line 48
    :goto_34
    iput-object v0, p0, Lcom/cm/perm/e;->e:Ljava/io/File;

    .line 50
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/cm/perm/e;->b:Z

    .line 51
    iget-boolean v0, p0, Lcom/cm/perm/e;->b:Z

    goto :goto_6

    .line 45
    :cond_3c
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1}, Lorg/json/JSONObject;-><init>()V

    iput-object v1, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    goto :goto_34
.end method

.method private b(Ljava/io/File;)Ljava/lang/String;
    .registers 9

    .prologue
    .line 103
    new-instance v2, Ljava/lang/StringBuilder;

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

    .line 105
    const/16 v0, 0x800

    new-array v3, v0, [B

    .line 107
    const/4 v1, 0x0

    .line 109
    :try_start_a
    new-instance v0, Ljava/io/FileInputStream;

    invoke-direct {v0, p1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_f
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_f} :catch_40
    .catchall {:try_start_a .. :try_end_f} :catchall_2a

    .line 112
    :goto_f
    :try_start_f
    invoke-virtual {v0, v3}, Ljava/io/FileInputStream;->read([B)I

    move-result v1

    .line 113
    if-lez v1, :cond_31

    .line 114
    new-instance v4, Ljava/lang/String;

    const/4 v5, 0x0

    invoke-direct {v4, v3, v5, v1}, Ljava/lang/String;-><init>([BII)V

    .line 115
    invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_1e
    .catch Ljava/io/IOException; {:try_start_f .. :try_end_1e} :catch_1f
    .catchall {:try_start_f .. :try_end_1e} :catchall_3b

    goto :goto_f

    :catch_1f
    move-exception v1

    .line 124
    :goto_20
    if-eqz v0, :cond_25

    .line 126
    :try_start_22
    invoke-virtual {v0}, Ljava/io/FileInputStream;->close()V
    :try_end_25
    .catch Ljava/io/IOException; {:try_start_22 .. :try_end_25} :catch_37

    .line 130
    :cond_25
    :goto_25
    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0

    .line 123
    :catchall_2a
    move-exception v0

    .line 124
    :goto_2b
    if-eqz v1, :cond_30

    .line 126
    :try_start_2d
    invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V
    :try_end_30
    .catch Ljava/io/IOException; {:try_start_2d .. :try_end_30} :catch_39

    .line 130
    :cond_30
    :goto_30
    throw v0

    .line 124
    :cond_31
    :try_start_31
    invoke-virtual {v0}, Ljava/io/FileInputStream;->close()V
    :try_end_34
    .catch Ljava/io/IOException; {:try_start_31 .. :try_end_34} :catch_35

    goto :goto_25

    :catch_35
    move-exception v0

    goto :goto_25

    :catch_37
    move-exception v0

    goto :goto_25

    :catch_39
    move-exception v1

    goto :goto_30

    .line 123
    :catchall_3b
    move-exception v1

    move-object v6, v1

    move-object v1, v0

    move-object v0, v6

    goto :goto_2b

    :catch_40
    move-exception v0

    move-object v0, v1

    goto :goto_20
.end method

.method private b()V
    .registers 3

    .prologue
    .line 141
    iget-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    if-nez v0, :cond_b

    .line 142
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    iput-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    .line 145
    :cond_b
    iget-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    invoke-virtual {v0}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v0

    .line 146
    iget-object v1, p0, Lcom/cm/perm/e;->e:Ljava/io/File;

    invoke-direct {p0, v0, v1}, Lcom/cm/perm/e;->a(Ljava/lang/String;Ljava/io/File;)V

    .line 147
    return-void
.end method


# virtual methods
.method public a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .registers 5

    .prologue
    .line 55
    iget-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    if-nez v0, :cond_b

    .line 56
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    iput-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    .line 59
    :cond_b
    const/4 v0, 0x0

    .line 62
    :try_start_c
    iget-object v1, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    invoke-virtual {v1, p1}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
    :try_end_11
    .catch Lorg/json/JSONException; {:try_start_c .. :try_end_11} :catch_19

    move-result-object v0

    .line 67
    :goto_12
    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_1b

    .line 71
    :goto_18
    return-object p2

    :catch_19
    move-exception v1

    goto :goto_12

    :cond_1b
    move-object p2, v0

    goto :goto_18
.end method

.method public b(Ljava/lang/String;Ljava/lang/String;)V
    .registers 4

    .prologue
    .line 75
    iget-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    if-nez v0, :cond_b

    .line 76
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V

    iput-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    .line 80
    :cond_b
    :try_start_b
    iget-object v0, p0, Lcom/cm/perm/e;->c:Lorg/json/JSONObject;

    invoke-virtual {v0, p1, p2}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    :try_end_10
    .catch Lorg/json/JSONException; {:try_start_b .. :try_end_10} :catch_14

    .line 85
    :goto_10
    invoke-direct {p0}, Lcom/cm/perm/e;->b()V

    .line 86
    return-void

    .line 82
    :catch_14
    move-exception v0

    invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V

    goto :goto_10
.end method