GameResVersionManager.smali
.class public Lcom/sandboxol/center/utils/GameResVersionManager;
.super Ljava/lang/Object;
.source "GameResVersionManager.java"
# static fields
.field private static final TAG:Ljava/lang/String; = "com.sandboxol.center.utils.GameResVersionManager"
.field public static defaultGameResVersionMap:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map<",
"Ljava/lang/String;",
"Ljava/lang/String;",
">;"
}
.end annotation
.end field
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 1
new-instance v0, Ljava/util/HashMap;
invoke-direct {v0}, Ljava/util/HashMap;-><init>()V
sput-object v0, Lcom/sandboxol/center/utils/GameResVersionManager;->defaultGameResVersionMap:Ljava/util/Map;
return-void
.end method
.method public constructor <init>()V
.registers 1
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method static synthetic access$000()Ljava/lang/String;
.registers 1
.line 1
sget-object v0, Lcom/sandboxol/center/utils/GameResVersionManager;->TAG:Ljava/lang/String;
return-object v0
.end method
.method public static getOldGameResVersion(Lcom/sandboxol/greendao/entity/Game;Ljava/lang/String;)J
.registers 9
.line 1
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 2
invoke-virtual {p0}, Lcom/sandboxol/greendao/entity/Game;->getLatestResVersions()Lcom/sandboxol/greendao/entity/ResourceLatestVersionData;
move-result-object v1
const-wide/16 v2, 0x0
if-eqz v1, :cond_22
invoke-virtual {p0}, Lcom/sandboxol/greendao/entity/Game;->getLatestResVersions()Lcom/sandboxol/greendao/entity/ResourceLatestVersionData;
move-result-object v1
invoke-virtual {v1}, Lcom/sandboxol/greendao/entity/ResourceLatestVersionData;->getGresVersion()J
move-result-wide v4
cmp-long v1, v4, v2
if-eqz v1, :cond_22
.line 3
invoke-virtual {p0}, Lcom/sandboxol/greendao/entity/Game;->getLatestResVersions()Lcom/sandboxol/greendao/entity/ResourceLatestVersionData;
move-result-object v1
invoke-virtual {v1}, Lcom/sandboxol/greendao/entity/ResourceLatestVersionData;->getGresVersion()J
move-result-wide v4
goto :goto_23
:cond_22
move-wide v4, v2
.line 4
:goto_23
:try_start_23
sget-object v1, Lcom/sandboxol/center/utils/GameResVersionManager;->defaultGameResVersionMap:Ljava/util/Map;
invoke-virtual {p0}, Lcom/sandboxol/greendao/entity/Game;->getIsNewEngine()I
move-result p0
if-nez p0, :cond_2e
const-string p0, "key.default.game.res.version.old.engine"
goto :goto_30
:cond_2e
const-string p0, "key.default.game.res.version.new.engine"
:goto_30
invoke-interface {v1, p0}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object p0
check-cast p0, Ljava/lang/String;
.line 5
new-instance v1, Lorg/json/JSONObject;
invoke-direct {v1, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
.line 6
invoke-virtual {v1}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;
move-result-object p0
.line 7
:goto_3f
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v6
if-eqz v6, :cond_51
.line 8
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v6
invoke-static {v6}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v6
.line 9
invoke-interface {v0, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_3f
.line 10
:cond_51
invoke-interface {v0, p1}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
move-result p0
if-eqz p0, :cond_5b
.line 11
invoke-virtual {v1, p1}, Lorg/json/JSONObject;->getLong(Ljava/lang/String;)J
move-result-wide v2
:try_end_5b
.catch Ljava/lang/Exception; {:try_start_23 .. :try_end_5b} :catch_5b
.line 12
:catch_5b
:cond_5b
invoke-static {p1}, Lcom/sandboxol/center/utils/CommonUtils;->isNewEngineCommonGame(Ljava/lang/String;)Z
move-result p0
if-eqz p0, :cond_6f
.line 13
invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;
move-result-object p0
const-string p1, "new.engine.common.game.version"
invoke-static {p0, p1}, Lcom/sandboxol/common/utils/SharedUtils;->getLong(Landroid/content/Context;Ljava/lang/String;)J
move-result-wide p0
.line 14
invoke-static {v4, v5, p0, p1}, Ljava/lang/Math;->max(JJ)J
move-result-wide v4
.line 15
:cond_6f
invoke-static {v4, v5, v2, v3}, Ljava/lang/Math;->max(JJ)J
move-result-wide p0
return-wide p0
.end method
.method public static resetOldEngineResVersion()V
.registers 5
.line 1
invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;
move-result-object v0
const-string v1, "key.app.version"
invoke-static {v0, v1}, Lcom/sandboxol/common/utils/SharedUtils;->getInt(Landroid/content/Context;Ljava/lang/String;)I
move-result v0
.line 2
sget-object v2, Lcom/sandboxol/center/utils/GameResVersionManager;->TAG:Ljava/lang/String;
invoke-static {v2}, Lcom/apkfuns/logutils/c;->a(Ljava/lang/String;)Lcom/apkfuns/logutils/e;
move-result-object v2
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v4, "resetOldEngineResVersion "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-interface {v2, v3}, Lcom/apkfuns/logutils/e;->d(Ljava/lang/Object;)V
.line 3
invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getApp()Lcom/sandboxol/common/base/app/BaseApplication;
move-result-object v2
invoke-virtual {v2}, Lcom/sandboxol/common/base/app/BaseApplication;->getMetaDataAppVersion()I
move-result v2
if-eq v0, v2, :cond_7a
.line 4
sget-object v0, Lcom/sandboxol/center/utils/GameResVersionManager;->TAG:Ljava/lang/String;
invoke-static {v0}, Lcom/apkfuns/logutils/c;->a(Ljava/lang/String;)Lcom/apkfuns/logutils/e;
move-result-object v0
const-string v2, "resetOldEngineResVersion resetVersion"
invoke-interface {v0, v2}, Lcom/apkfuns/logutils/e;->d(Ljava/lang/Object;)V
.line 5
invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getContext()Landroid/content/Context;
move-result-object v0
invoke-static {}, Lcom/sandboxol/common/base/app/BaseApplication;->getApp()Lcom/sandboxol/common/base/app/BaseApplication;
move-result-object v2
invoke-virtual {v2}, Lcom/sandboxol/common/base/app/BaseApplication;->getMetaDataAppVersion()I
move-result v2
invoke-static {v0, v1, v2}, Lcom/sandboxol/common/utils/SharedUtils;->putInt(Landroid/content/Context;Ljava/lang/String;I)V
.line 6
:try_start_48
sget-object v0, Lcom/sandboxol/center/utils/GameResVersionManager;->defaultGameResVersionMap:Ljava/util/Map;
const-string v1, "key.default.game.res.version.old.engine"
invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/String;
.line 7
new-instance v1, Lorg/json/JSONObject;
invoke-direct {v1, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
.line 8
invoke-virtual {v1}, Lorg/json/JSONObject;->keys()Ljava/util/Iterator;
move-result-object v0
.line 9
:goto_5b
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v2
if-eqz v2, :cond_7a
.line 10
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
.line 11
invoke-static {}, Lcom/sandboxol/greendao/c/M;->getInstance()Lcom/sandboxol/greendao/c/M;
move-result-object v3
new-instance v4, Lcom/sandboxol/center/utils/GameResVersionManager$1;
invoke-direct {v4, v1, v2}, Lcom/sandboxol/center/utils/GameResVersionManager$1;-><init>(Lorg/json/JSONObject;Ljava/lang/String;)V
invoke-virtual {v3, v2, v4}, Lcom/sandboxol/greendao/c/M;->a(Ljava/lang/String;Lcom/sandboxol/greendao/a/c;)V
:try_end_75
.catch Ljava/lang/Exception; {:try_start_48 .. :try_end_75} :catch_76
goto :goto_5b
:catch_76
move-exception v0
.line 12
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
:cond_7a
return-void
.end method