import file_utils import common_utils import os.path def execute(game, sdk, config): if not checkConfig(config): return 1 subChannel = config['subChannel'] createJmhyProperties(game, sdk, subChannel, config) common_utils.changeApplication(game, sdk, subChannel, config, 'com.ejyx.common.EJYXApplication') return 0 def checkConfig(config): ''' 检查配置 ''' if 'properties' not in config: print('properties not exists in config') return False properties = config['properties'] if 'agent' not in properties or 'version' not in properties: print('agent or version not exists in properties') return False '''if 'appid' not in config or 'appkey' not in config: print('appid or appkey not exists in config') return False''' return True def createJmhyProperties(game, sdk, subChannel, config): ''' 创建jmhy.properties ''' print('创建 ejyx.properties ......') decompliePath = file_utils.getDecompliePath(game, sdk, subChannel, config['cache']) properties = os.path.join(decompliePath, 'assets', 'ejyx.properties') content = 'version = 1.1\n' content = '%s%s = %s\n' % (content, 'agent', config['channel_id']) file_utils.createFile(properties, content) return 0