| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- # coding:utf8
- __author__ = 'dong'
- import os
- import logging
- import xml.dom.minidom
- import re
- import shutil
- import glob
- from xml.etree.ElementTree import ElementTree, Element
- import distutils.dir_util
- from xml.etree import ElementTree as ET
- ANDROID_NS = 'http://schemas.android.com/apk/res/android'
- def script_init(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
- # gw_data_center.pack_small=True
- return
- def script_second(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
- logging.info('script_second: ' + str(channel_sdk_info))
- # 逆向渠道id
- if channel_sdk_info['id'] == '549':
- # public_xml = os.path.join(extract_dir, "res/values/public.xml")
- # handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
- #
- #
- # public_xml = os.path.join(extract_dir, "res/values/public.xml")
- # handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
- # public_xml = os.path.join(extract_dir, "res/layout/design_bottom_sheet_dialog.xml")
- # handle_public_xml(public_xml, "attr-private")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
- handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
- #
- #
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
- handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
- handle_public_xml(public_xml, "abc_list_selector_background_transition_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
- handle_public_xml(public_xml, "abc_list_selector_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/public.xml")
- handle_public_xml(public_xml, "abc_item_background_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
- handle_public_xml(public_xml, "abc_list_selector_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/values/styles.xml")
- handle_public_xml(public_xml, "abc_item_background_holo_dark")
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_item_background_holo_dark.xml")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable/abc_list_selector_background_transition_holo_dark.xml")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir, "../sdk/smallsheep/ForRes/drawable/abc_list_selector_holo_dark.xml")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_pressed_holo_dark.9.png")
- logging.info("public_xml:" + public_xml)
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_pressed_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_pressed_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_pressed_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-mdpi/abc_list_selector_disabled_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-hdpi/abc_list_selector_disabled_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-xhdpi/abc_list_selector_disabled_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- public_xml = os.path.join(extract_dir,
- "../sdk/smallsheep/ForRes/drawable-xxhdpi/abc_list_selector_disabled_holo_dark.9.png")
- if os.path.exists(public_xml):
- os.remove(public_xml)
- return
- def handle_public_xml(public_xml_path, remove_node):
- if not os.path.exists(public_xml_path):
- logging.info('public_xml is null: ' + public_xml_path)
- return
- new_lines = []
- with open(public_xml_path, 'r+') as f:
- for line in f.readlines():
- # l = line.strip()
- if line.find(remove_node) > -1:
- continue
- new_lines.append(line)
- f.seek(0)
- f.truncate()
- f.writelines(new_lines)
- return
- def script_after(workspace_sdk_dir, extract_dir, channel_sdk_info, new_game_channel_info, game_info):
- if channel_sdk_info['id'] == '549':
- logging.info("-----after info-----")
- public_xml = os.path.join(extract_dir, "res/values/public.xml")
- handle_public_xml(public_xml, "abc_list_pressed_holo_dark")
- #
- #
- public_xml = os.path.join(extract_dir, "res/values/public.xml")
- handle_public_xml(public_xml, "abc_list_selector_disabled_holo_dark")
- logging.info("-----debug-----")
- def script(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
- logging.info("-----debug-----")
- def script_last(SDK, decompileDir, channelSdkInfo, new_game_channel_info, gameInfo):
- return
- if __name__ == '__main__':
- # replace_super_application("D:\work\wzdq")
- ""
|