예제 #1
0
def edit_yml(channel, decompile_dir):
    LogUtils.info('-----> EditYML <------')
    path = decompile_dir + '/apktool.yml'
    yml_file = open(path, encoding='utf-8')
    content = ''
    while True:
        line = yml_file.readline()
        if line.find('- assets/') == 0:
            yml_file.tell()
        elif line.find('targetSdkVersion') != -1:
            config = Utils.get_local_config()
            if config is not None and config['TARGET_SDK_VERSION'] != '0':
                content += '  targetSdkVersion: \'' + config[
                    'TARGET_SDK_VERSION'] + '\'\n'
            else:
                content += line
        elif line.find('versionCode') != -1 and len(
                channel['gameVersionCode']) > 0:
            content += '  versionCode: \'' + channel['gameVersionCode'] + '\'\n'
        elif line.find('versionName') != -1 and len(
                channel['gameVersionName']) > 0:
            content += '  versionName: ' + channel['gameVersionName'] + '\n'
        else:
            if not line:
                break
            line.replace('\r', '')
            if line.strip() != '':
                if line.find('doNotCompress:') == 0:
                    yml_file.tell()
                    content += 'doNotCompress:\n- assets/*\n'
                else:
                    content += line
    LogUtils.info("apktool.yml:\n%s", content)
    with open(path, 'w', encoding='utf-8') as f:
        f.write(content)
예제 #2
0
# -*- coding: utf-8 -*-
import sys, os
if hasattr(sys, 'frozen'):
    os.environ['PATH'] = sys._MEIPASS + ";" + os.environ['PATH']
from PyQt5.Qt import QApplication, QFile, QTextStream
from scripts.MainWindow import MainWindow
from scripts import Utils


if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainWin = MainWindow()
    theme = Utils.get_local_config()['THEME']
    file = QFile(theme + '.qss')
    file.open(QFile.ReadOnly | QFile.Text)
    stream = QTextStream(file)
    mainWin.setStyleSheet(stream.readAll())
    mainWin.show()
    sys.exit(app.exec_())