迷你世界0.44.2启动器v2.0已发布!

本程序使用Python语言编写

import tkinter as tk
from tkinter import messagebox
import os
import subprocess
import webbrowser
import ttkbootstrap as ttk
import winshell
import pywintypes
import win32gui
import win32con


def create_and_run_shortcut():
    try:
        desktop = winshell.desktop()
        shortcut_path = os.path.join(desktop, "iworldpc3.exe.lnk")
        target_exe = os.path.abspath("iworldpc3.exe")
        arguments = " apiid=1"

        # 创建快捷方式
        with open(shortcut_path, 'wb') as shortcut_file:
            # 头部信息
            shortcut_file.write(b'\x4C\x00\x00\x00')  # 链接文件标识
            shortcut_file.write(b'\x01\x14\x02\x00')  # 版本
            shortcut_file.write(b'\x00\x00\x00\x00')  # 保留
            shortcut_file.write(pywintypes.Time(0).pack())  # 创建时间
            shortcut_file.write(pywintypes.Time(0).pack())  # 修改时间
            shortcut_file.write(pywintypes.Time(0).pack())  # 访问时间
            shortcut_file.write(b'\x00\x00\x00\x00')  # 大小
            shortcut_file.write(b'\x00\x00\x00\x00')  # 图标索引
            shortcut_file.write(b'\x00\x00\x00\x00')  # 显示命令
            shortcut_file.write(b'\x00\x00\x00\x00')  # 工作目录偏移
            shortcut_file.write(b'\x00\x00\x00\x00')  # 命令行参数偏移
            shortcut_file.write(b'\x00\x00\x00\x00')  # 注释偏移
            shortcut_file.write(b'\x00\x00\x00\x00')  # 自定义图标偏移
            shortcut_file.write(b'\x00\x00\x00??')  # 热键
            shortcut_file.write(b'\x00??00')  # 显示方式
            shortcut_file.write(b'\x00??00')  # 运行标志
            shortcut_file.write(b'\x00??00')  # 链接标志
            shortcut_file.write(b'\x00??00')  # 唯一标识
            shortcut_file.write(b'\x00??00')  # 描述
            shortcut_file.write(b'\x00??00')  # 相对路径偏移
            shortcut_file.write(b'\x00??00')  # 扩展块偏移

            # 写入目标路径
            target_path_bytes = target_exe.encode('utf - 16le')
            shortcut_file.write(len(target_path_bytes).to_bytes(4, byteorder='little'))
            shortcut_file.write(target_path_bytes)

            # 写入命令行参数
            args_bytes = arguments.encode('utf - 16le')
            shortcut_file.write(len(args_bytes).to_bytes(4, byteorder='little'))
            shortcut_file.write(args_bytes)

        # 执行快捷方式
        show_cmd = win32con.SW_SHOWNORMAL
        info = subprocess.STARTUPINFO()
        info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
        info.wShowWindow = show_cmd
        subprocess.Popen(shortcut_path, startupinfo=info)

        messagebox.showinfo("操作成功", "快捷方式创建并执行成功")
    except Exception as e:
        messagebox.showerror("操作错误", f"执行时出现错误: {str(e)}")


def open_resource_website():
    webbrowser.open("https://1dd0gl2850453.vicp.fun/")


def open_drive_update():
    webbrowser.open("https://wwpt.lanzoul.com/b00tb6ptyb")
    messagebox.showinfo("网盘更新", "密码bfpi")


def open_update_log():
    webbrowser.open("https://www.bilibili.com/opus/1021013433952239640?spm_id_from=333.1365.0.0")


root = ttk.Window(themename='cosmo')
root.title("WuJian 0.44.2启动器v1.0")
root.geometry("500x500")

icon_path = 'icon.ico'
if os.path.isfile(icon_path):
    root.iconbitmap(icon_path)

start_button = ttk.Button(root, text="启动游戏", command=create_and_run_shortcut, bootstyle="primary-outline-round")
start_button.pack(pady=10)

resource_button = ttk.Button(root, text="无妄资源站", command=open_resource_website, bootstyle="secondary-outline-round")
resource_button.pack(pady=10)

update_button = ttk.Button(root, text="网盘更新", command=open_drive_update, bootstyle="info-outline-round")
update_button.pack(pady=10)

update_log_button = ttk.Button(root, text="更新日志", command=open_update_log, bootstyle="primary-outline-round")
update_log_button.pack(pady=10)

root.mainloop()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值