2021-08-30 17:49:12 +08:00
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
#########################################
|
2022-07-23 12:44:33 +08:00
|
|
|
|
# 版本:1.8.0
|
|
|
|
|
# 更新时间:2022年07月23日
|
2021-08-30 17:49:12 +08:00
|
|
|
|
#########################################
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
import traceback
|
2023-01-01 12:16:31 +08:00
|
|
|
|
import updatekiller
|
2022-07-23 12:44:33 +08:00
|
|
|
|
import PyQt5.QtWidgets as QtWidgets
|
2023-01-18 15:42:49 +08:00
|
|
|
|
print("""白雪歌送武判官归京
|
|
|
|
|
北风卷地白草折,胡天八月即飞雪。忽如一夜春风来,千树万树梨花开。
|
|
|
|
|
散入珠帘湿罗幕,狐裘不暖锦衾薄。将军角弓不得控,都护铁衣冷难着。
|
|
|
|
|
瀚海阑干百丈冰,愁云惨淡万里凝。中军置酒饮归客,胡琴琵琶与羌笛。
|
|
|
|
|
纷纷暮雪下辕门,风掣红旗冻不翻。轮台东门送君去,去时雪满天山路。
|
|
|
|
|
山回路转不见君,雪上空留马行处。""")
|
|
|
|
|
print("")
|
2023-01-24 14:19:53 +08:00
|
|
|
|
print("译文:北风席卷大地把白草吹折,胡地天气八月就纷扬落雪。忽然间宛如一夜春风吹来,好像是千树万树梨花盛开。雪花散入珠帘打湿了罗幕,狐裘穿不暖锦被也嫌单薄。将军都护手冻得拉不开弓,铁甲冰冷得让人难以穿着。沙漠结冰百丈纵横有裂纹,万里长空凝聚着惨淡愁云。主帅帐中摆酒为归客饯行,胡琴琵琶羌笛合奏来助兴。傍晚辕门前大雪落个不停,红旗冻僵了风也无法牵引。轮台东门外欢送你回京去,你去时大雪盖满了天山路。山路迂回曲折已看不见你,雪上只留下一行马蹄印迹。")
|
2023-01-18 15:42:49 +08:00
|
|
|
|
print("================================")
|
|
|
|
|
|
2021-08-30 17:49:12 +08:00
|
|
|
|
########################
|
|
|
|
|
#
|
|
|
|
|
########################
|
|
|
|
|
# 写入文本文档
|
|
|
|
|
def write_txt(path: "路径", things: "内容")->"写入文本文档":
|
|
|
|
|
file = open(path, 'w', encoding='UTF-8') # 设置文件对象
|
|
|
|
|
file.write(things) # 写入文本
|
|
|
|
|
file.close() # 关闭文本对象
|
|
|
|
|
|
|
|
|
|
# 读取文本文档
|
|
|
|
|
def readtxt(path: "路径")->"读取文本文档":
|
|
|
|
|
f = open(path, "r") # 设置文件对象
|
|
|
|
|
str = f.read() # 获取内容
|
|
|
|
|
f.close() # 关闭文本对象
|
|
|
|
|
return str # 返回结果
|
|
|
|
|
|
|
|
|
|
###################
|
|
|
|
|
# 判断是不是 root
|
|
|
|
|
###################
|
2022-07-23 12:44:33 +08:00
|
|
|
|
app = QtWidgets.QApplication(sys.argv)
|
2021-08-30 17:49:12 +08:00
|
|
|
|
if os.geteuid() != 0:
|
|
|
|
|
print("不是以 root 权限运行本程序!")
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.critical(None, "错误", "不是以 root 权限运行本程序!")
|
2021-08-30 17:49:12 +08:00
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
###################
|
|
|
|
|
#
|
|
|
|
|
###################
|
|
|
|
|
try:
|
2022-07-23 12:44:33 +08:00
|
|
|
|
if sys.argv[1] == "1" and QtWidgets.QMessageBox.question(None, "提示", "你确定要删除吗?", QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel) == QtWidgets.QMessageBox.Ok:
|
2021-08-30 17:49:12 +08:00
|
|
|
|
os.remove("/data/uengine/data/data/misc/adb/adb_keys")
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.information(None, "提示", "完成")
|
2021-08-30 17:49:12 +08:00
|
|
|
|
except:
|
|
|
|
|
traceback.print_exc()
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.critical(None, "错误", traceback.format_exc())
|
2021-08-30 17:49:12 +08:00
|
|
|
|
sys.exit(2)
|
|
|
|
|
if sys.argv[1] == "1":
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
2022-07-23 12:44:33 +08:00
|
|
|
|
if QtWidgets.QMessageBox.question(None, "提示", '''请阅读以下提示然后确定是否继续:
|
2021-08-30 17:49:12 +08:00
|
|
|
|
1、安装后即可使用 adb 连接 UEngine;
|
|
|
|
|
2、重置 UEngine 或 adb 就需要重新设置该支持补丁;
|
2022-07-23 12:44:33 +08:00
|
|
|
|
3、需要 root 权限;''') == QtWidgets.QMessageBox.No:
|
2021-08-30 17:49:12 +08:00
|
|
|
|
sys.exit(0)
|
|
|
|
|
# 写入(需要 root)
|
|
|
|
|
if not os.path.exists("/data/uengine/data/data/misc/adb"):
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.critical(None, "错误", "无法读取 UEngine 数据!")
|
2021-08-30 17:49:12 +08:00
|
|
|
|
sys.exit(1)
|
|
|
|
|
try:
|
|
|
|
|
things = readtxt(sys.argv[2])
|
|
|
|
|
adbKey = []
|
|
|
|
|
# 提取内容
|
|
|
|
|
for i in things.split('\n'):
|
|
|
|
|
adbKey.append(i[0: i.find(" ")])
|
|
|
|
|
old = ""
|
|
|
|
|
if os.path.exists("/data/uengine/data/data/misc/adb/adb_keys"):
|
|
|
|
|
old = readtxt("/data/uengine/data/data/misc/adb/adb_keys") + "\n"
|
|
|
|
|
write_txt("/data/uengine/data/data/misc/adb/adb_keys", old + "\n".join(adbKey))
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.information(None, "提示", "完成")
|
2021-08-30 17:49:12 +08:00
|
|
|
|
except:
|
|
|
|
|
traceback.print_exc()
|
2022-07-23 12:44:33 +08:00
|
|
|
|
QtWidgets.QMessageBox.information(None, "错误", traceback.format_exc())
|
2023-01-01 12:16:31 +08:00
|
|
|
|
sys.exit(2)
|