# -*- coding:utf-8 -*-
__author__ = 'ALIXie'

import os
import logging
import distutils.dir_util
import gw_apk_tool


def script_init(workspace_sdk_dir, extract_dir, channelSdkInfo, new_game_channel_info, game_info):
    return


def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
    logging.info('------------channelSdkInfo:' + str(channelSdkInfo))
    s1 = os.path.join(decompileDir, "smali_classes6", "com")
    smali_classes2_dir = gw_apk_tool.create_mutil_smali(decompileDir)

    s3 = smali_classes2_dir
    list_package = ["btgame"]
    if not os.path.exists(s3):
        distutils.dir_util.mkpath(s3)
    gw_apk_tool.move_package(s1, s3, list_package)

    if channelSdkInfo['id'] == '597':
        s1 = os.path.join(decompileDir, "smali_classes9", "com","baitian")
        if os.path.exists(s1):
            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
            s3 = os.path.join(decompileDir, smali_classes_new, "com","baitian")
            list_package = ["alx","aqcs","aqcsgfsy","aqcssyb","bridge","getui","lebian","netkitWrap","notice","android","aqcsgfb","aqcssy","aqcswdb","clipboard","jldld","nativebridge","network","notification"]
            if not os.path.exists(s3):
                distutils.dir_util.mkpath(s3)
            gw_apk_tool.move_package(s1, s3, list_package)

    if channelSdkInfo['id'] == '549' or channelSdkInfo['id'] == '591':
        s1 = os.path.join(decompileDir, "smali_classes9", "com")
        if os.path.exists(s1):
            smali_classes_new = gw_apk_tool.create_mutil_smali(decompileDir)
            s3 = os.path.join(decompileDir, smali_classes_new, "com")
            list_package = ["baitian"]
            if not os.path.exists(s3):
                distutils.dir_util.mkpath(s3)
            gw_apk_tool.move_package(s1, s3, list_package)

if __name__ == "__main__":
    ""
