# coding:utf8

__author__ = 'Snow'

import os
import logging
import xml.dom.minidom
import re
import shutil
import glob
import distutils.dir_util

ANDROID_NS = 'http://schemas.android.com/apk/res/android'
from xml.etree import ElementTree as ET


def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
    sdk_id = channelSdkInfo['id']
    if sdk_id == "180017":
        modify_manifest(decompileDir)


def script_pre(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
    ""


def modify_manifest(decompileDir):
    # 原始文件路径
    xmlparse = os.path.join(decompileDir, 'AndroidManifest.xml')
    # 修改后的文件路径
    output_file_path = 'your_modified_file.xml'

    # 要删除的字符串
    string_to_remove = '<action android:name="" />'

    # 读取原始文件内容
    with open(xmlparse, 'r') as file:
        file_contents = file.read()

    # 删除指定的字符串
    modified_contents = file_contents.replace(string_to_remove, '')

    # 将修改后的内容写回文件
    with open(xmlparse, 'w') as file:
        file.write(modified_contents)



if __name__ == '__main__':
    modify_manifest("C:/Users/edy/Desktop")
