提交现有代码
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# -- coding: utf-8 --
|
||||
import Psyunew3
|
||||
from ctypes import *
|
||||
|
||||
class Dog():
|
||||
def isDogAlive(self):
|
||||
try:
|
||||
DevicePath=create_string_buffer(260)
|
||||
ret=c_int()
|
||||
##这个用于判断系统中是否存在着加密锁。不需要是指定的加密锁,
|
||||
ret = Psyunew3.FindPort(0,DevicePath)
|
||||
if(ret!=0):
|
||||
return 2
|
||||
print('未找到加密锁,请插入加密锁后,再进行操作。')
|
||||
exit()
|
||||
print("dog ret:",ret)
|
||||
##使用普通算法一来检查是否存在指定的加密锁
|
||||
if (Psyunew3.CheckKeyByFindort_2() == 0):
|
||||
pass
|
||||
# print('使用普通算法一来检查:找到指定的加密锁')
|
||||
else:
|
||||
return 3
|
||||
print('使用普通算法一来检查:未能找到指定的加密锁')
|
||||
|
||||
|
||||
##使用增强算法一来检查是否存在指定的加密锁
|
||||
ret = Psyunew3.CheckKeyByEncstring()
|
||||
if (ret == 1):
|
||||
pass
|
||||
# print( '你生成加密代码时没有设置该函数')
|
||||
else:
|
||||
if (ret == 0):
|
||||
pass
|
||||
# print('使用增强算法一来检查:找到指定的加密锁')
|
||||
else:
|
||||
return 4
|
||||
print('使用增强算法一来检查:未能找到指定的加密锁')
|
||||
|
||||
##使用增强算法二来检查是否存在指定的加密锁
|
||||
ret = Psyunew3.CheckKeyByEncstring_New()
|
||||
if (ret == 0):
|
||||
pass
|
||||
# print('使用增强算法二来检查:找到指定的加密锁')
|
||||
else:
|
||||
if (ret < 0):
|
||||
return 5
|
||||
print('使用增强算法二来检查:未能找到指定的加密锁')
|
||||
elif (ret == 2):
|
||||
return 6
|
||||
print('当前锁不支持这个功能。')
|
||||
return 1
|
||||
except Exception as e:
|
||||
print(f"dog Error{e}")
|
||||
return 9
|
||||
def read_string(self):
|
||||
DevicePath=create_string_buffer(260)
|
||||
return Psyunew3.ReadStringEx(0, DevicePath)
|
||||
dog = Dog()
|
||||
|
||||
Reference in New Issue
Block a user