1 Star 0 Fork 30

雷火/Wine 运行器

forked from gfdgd xi/Wine 运行器 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
InstallDll.py 4.97 KB
一键复制 编辑 原始数据 按行查看 历史
gfdgd xi 提交于 2023-05-28 07:23 . 修改DLL获取工具的地址
#!/usr/bin/env python3
# 使用系统默认的 python3 运行
###########################################################################################
# 作者:gfdgd xi
# 版本:2.1.0
# 更新时间:2022年08月25日
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
# 基于 Python3 构建
###########################################################################################
#################
# 引入所需的库
#################
import os
import sys
import json
import updatekiller
import traceback
import req as requests
def exit():
if __name__ == "__main__":
input("按回车键退出")
sys.exit()
sys.exit()
# 获取云列表
sourcesList = [
"http://dll.wine-runner.gfdgdxi.top",
"https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/dlls",
"http://gfdgdxi.msns.cn/wine-runner-list/dlls"
]
url = sourcesList[0]
print("获取列表中……", end="")
try:
lists = json.loads(requests.get(f"{url}/list.json").text)
except:
print("\r列表获取失败!按回车键退出")
input()
exit()
print("\r列表获取成功!")
def GetUrlByNumber(dllID: int) -> str:
dllName = lists[dllID][0]
return f"{url}/{lists[int(dllID)][1]}/{lists[int(dllID)][2]}/{lists[int(dllID)][0]}"
def GetNameByNumber(dllID: int) -> str:
return lists[dllID][0]
def GetUrlByName(dllName: str):
for i in range(0, len(lists)):
if dllName == lists[i][0]:
return f"{url}/{lists[i][1]}/{lists[i][2]}/{lists[i][0]}"
def Download(wineBotton, dllName, urlPart, wine: str) -> bool:
try:
os.remove(f"{wineBotton}/drive_c/windows/system32/{dllName}")
except:
pass
os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/system32' -o '{dllName}' '{urlPart}'")
#print(f"WINEPREFIX='{wineBotton}' {wine} reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(dllName)[0]} /d native /f")
return os.system(f"WINEPREFIX='{wineBotton}' {wine} reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v {os.path.splitext(dllName)[0]} /d native /f")
#return 0
def exit():
input("按回车键退出")
sys.exit()
if __name__ == "__main__":
if "--help" in sys.argv:
print("作者:gfdgd xi")
print("版本:1.0.0")
print("本程序可以更方便的在 wine 容器中安装指定应用")
sys.exit()
if len(sys.argv) <= 1 or sys.argv[1] == "":
print("您未指定需要安装的容器,无法继续")
print("参数:")
print("XXX 参数一")
print("参数一为需要安装的容器")
sys.exit()
print('''
mmmm ""# ""#
# "m # #
# # # #
# # # #
#mmm" "mm "mm
''')
wineBotton = sys.argv[1]
wine = sys.argv[2]
if not os.path.exists(f"{wineBotton}/drive_c/windows/Fonts"):
input("您选择的不是 Wine 容器")
exit()
# 判断是不是 wine 容器
if not os.path.exists(f"{wineBotton}/drive_c/windows/system32"):
print("这不是 Wine 容器")
exit()
# 获取用户希望安装的DLL
while True:
print()
print("您可以输入DLL名称进行搜索,输入前面编号或DLL全称即可安装(推荐是编号,可以选系统版本)")
print("输入exit即可退出")
urlPart = ""
while True:
dllName = input(">")
if dllName.lower() == "exit":
exit()
if dllName in lists:
url = dllName
break
try:
dllName = lists[int(dllName)][0]
urlPart = GetUrlByNumber(int(dllName))
f"{url}/{lists[int(dllName)][1]}/{lists[int(dllName)][2]}/{lists[int(dllName)][0]}"
break
except:
pass
right = False
for i in range(0, len(lists)):
if dllName == lists[i][0]:
right = True
urlPart = f"{url}/{lists[i][1]}/{lists[i][2]}/{lists[i][0]}"
break
if dllName in lists[i][0]:
print(i, lists[i][0], f"平台:{lists[i][1]}", f"架构:{lists[i][2]}")
if right:
break
if os.path.exists(f"{wineBotton}/drive_c/windows/system32/{dllName}"):
if input(f"{dllName} 已存在,是否覆盖?(一般不推荐)[Y/N]").upper() == "N":
continue
try:
os.remove(f"{wineBotton}/drive_c/windows/system32/{dllName}")
except:
print("文件移除失败!")
traceback.print_exc()
continue
# 下载 DLL
print(f"正在下载{dllName},请稍后")
print(f"下载链接:{urlPart}")
if Download(wineBotton, dllName, urlPart, wine):
print("下载失败!请重试")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liuqt/deep-wine-runner.git
git@gitee.com:liuqt/deep-wine-runner.git
liuqt
deep-wine-runner
Wine 运行器
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385