From 89788e68e6b7cb3b5ff7d329eaee3a979c752858 Mon Sep 17 00:00:00 2001 From: moliclay <3305134074@qq.com> Date: Sat, 19 Sep 2026 14:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=E3=80=8C/=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..86e18e8 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +import sys +import os +from src.security import validate_license +LICENSE_PATH = os.path.expanduser("~/.app_license") + + +def check_license(): + """强制许可证验证""" + if not os.path.exists(LICENSE_PATH): + print("错误:未找到许可证文件") + return False + + with open(LICENSE_PATH, 'r') as f: + license_code = f.read().strip() + + valid, message = validate_license(license_code) + if not valid: + print(f"授权失败: {message}") + return False + return True + + +def main(): + print("=== 软件启动验证 ===") + if not check_license(): + sys.exit(1) + + print("授权验证成功!欢迎使用本软件") + # 此处添加主程序逻辑 + + +if __name__ == "__main__": + main() \ No newline at end of file