|
@@ -83,37 +83,37 @@ def on_initialization_completed():
|
|
|
qgis_dir = get_qgis_install_dir()
|
|
|
licensepath = f"{qgis_dir}\\license.txt"
|
|
|
# 打开文件并读取内容
|
|
|
- text = []
|
|
|
- with open(licensepath, 'r') as file:
|
|
|
- for line in file:
|
|
|
- text.append(line.replace('\n', ' '))
|
|
|
- # 打印文件内容
|
|
|
- print(text)
|
|
|
-
|
|
|
- try:
|
|
|
- # 尝试执行的代码
|
|
|
- fernet = Fernet(text[0].encode("utf-8"))
|
|
|
- decrypted_message = fernet.decrypt(text[1].encode("utf-8"))
|
|
|
- license = decrypted_message.decode('utf-8')
|
|
|
- licenseDict = str_to_dict(license)
|
|
|
- host = licenseDict["host"]
|
|
|
- date = licenseDict["license"]
|
|
|
-
|
|
|
- time_str = f"{date} 23:59:59"
|
|
|
- licensetime = str_to_time(time_str)
|
|
|
- if host != machine_name:
|
|
|
- licenseError("机器名错误!")
|
|
|
- exit(1)
|
|
|
- elif current_time > licensetime:
|
|
|
- licenseError("许可已过期!")
|
|
|
- exit(1)
|
|
|
- else:
|
|
|
- print("许可正常")
|
|
|
- # print(f"解密的消息: {decrypted_message.decode('utf-8')}")
|
|
|
- except Exception as e:
|
|
|
- # 处理异常的代码
|
|
|
- licenseError("许可文件解析问题!")
|
|
|
- exit(1)
|
|
|
+ # text = []
|
|
|
+ # with open(licensepath, 'r') as file:
|
|
|
+ # for line in file:
|
|
|
+ # text.append(line.replace('\n', ' '))
|
|
|
+ # # 打印文件内容
|
|
|
+ # print(text)
|
|
|
+ #
|
|
|
+ # try:
|
|
|
+ # # 尝试执行的代码
|
|
|
+ # fernet = Fernet(text[0].encode("utf-8"))
|
|
|
+ # decrypted_message = fernet.decrypt(text[1].encode("utf-8"))
|
|
|
+ # license = decrypted_message.decode('utf-8')
|
|
|
+ # licenseDict = str_to_dict(license)
|
|
|
+ # host = licenseDict["host"]
|
|
|
+ # date = licenseDict["license"]
|
|
|
+ #
|
|
|
+ # time_str = f"{date} 23:59:59"
|
|
|
+ # licensetime = str_to_time(time_str)
|
|
|
+ # if host != machine_name:
|
|
|
+ # licenseError("机器名错误!")
|
|
|
+ # exit(1)
|
|
|
+ # elif current_time > licensetime:
|
|
|
+ # licenseError("许可已过期!")
|
|
|
+ # exit(1)
|
|
|
+ # else:
|
|
|
+ # print("许可正常")
|
|
|
+ # # print(f"解密的消息: {decrypted_message.decode('utf-8')}")
|
|
|
+ # except Exception as e:
|
|
|
+ # # 处理异常的代码
|
|
|
+ # licenseError("许可文件解析问题!")
|
|
|
+ # exit(1)
|
|
|
|
|
|
|
|
|
def licenseError(message):
|