import win32api
import win32con
import os
# 固定激活码,也可以混合MAC地址,动态生成,再做解码
authList = {"Try": 10, "Activity_1": 30, "Activity_5": 150, "Activity_10": 300, "Activity_20": 600,
"Activity_100": 3600}
lines = ["", "", "", ""]
authFileStr = "./auth.txt"
def isUserAuth():
print(os.path.exists(authFileStr))
if os.path.exists(authFileStr):
win32api.SetFileAttributes(authFileStr, win32con.FILE_ATTRIBUTE_NORMAL)
authFile = open(authFileStr, mode="r+")
line = authFile.readlines()
authFile.close()
print(len(line))
if len(line) != 0:
isAuthed = line[0].split(":")[1].strip("\n")
usageTimes = int(line[1].split(":")[1].strip("\n"))
usedTimes = int(line[2].split(":")[1].strip("\n"))
actCodeOld = line[3].split(":")[1].strip("\n")
print(str(isAuthed))
print(type(isAuthed))
print(str(usageTimes))
print(str(usedTimes))
if isAuthed == "True":
print("激活状态")
if usedTimes < usageTimes:
usedTimes += 1
line[2] = "usedTimes:" + str(usedTimes) + "\n"
authFile = open(authFile
关于激活授权流程设计的实现源码:Python
最新推荐文章于 2024-11-01 16:22:02 发布