def CopyConfigDataToAndroid():
    dir1 = common.GetConfigDataDir()
    dir2 = common.GetRootDirAndroidAsset() + "/ConfigData"
    flag = os.path.exists(dir2)
    if flag:
        shutil.rmtree(dir2)
    # print(CopyConfigDataToAndroid:dir1=",dir1," dir2=",dir2
    shutil.copytree(dir1, dir2)
def UpdateLanguageName(name_cn, name_en, ishd):
    dirconfig = common.GetConfigDataDir()
    csvfile = dirconfig + "/language/language.csv"

    strContent = common.GetFileString(csvfile)
    key_name = GetCSVName(strContent, ishd)

    head = "APP_NAME"
    if ishd:
        head = "APP_NAME_HD"

    str_new = head + "," + name_cn + "," + name_en
    # +"\n"
    replaceFile(csvfile, key_name, str_new)
def SetConfigDataAppId(os, chanel, appid, ishd):
    dirconfig = common.GetConfigDataDir()
    filepath = ""
    if os == source.ANDROID:
        filepath = dirconfig + "/config/config_android.json"
        if ishd:
            filepath = dirconfig + "/config/config_android_hd.json"

    if os == source.IOS:
        filepath = dirconfig + "/config/config_ios.json"
        if ishd:
            filepath = dirconfig + "/config/config_ios_hd.json"

    with open(filepath) as json_file:
        data = json.load(json_file)
        data["APPID"][chanel] = appid
        # SaveJson(filepath,data)
        common.SaveJson(filepath, data)
def GetConfigDataAppId(os, chanel, ishd):
    dirconfig = common.GetConfigDataDir()
    filepath = ""
    appid = ""
    if os == source.ANDROID:
        filepath = dirconfig + "/config/config_android.json"
        if ishd:
            filepath = dirconfig + "/config/config_android_hd.json"

    if os == source.IOS:
        filepath = dirconfig + "/config/config_ios.json"
        if ishd:
            filepath = dirconfig + "/config/config_ios_hd.json"

    with open(filepath) as json_file:
        data = json.load(json_file)
        appid = data["APPID"][chanel]

    return appid