myBase Desktop 是一款非常不错的知识管理工具,最新版本是 myBase Desktop 6.0 (TEST-12)。
不注册只能试用30天,使用以下方法可以让过期软件恢复成试用30天,非常简单。
1.打开软件根目录下的nyfedit.ini文件,找到App.UserLic.FirstUseOn=1295074923
这个参数记载着第一次打开此软件的时间,很明显,这个参数遵循Unix时间戳。
只需要修改这个Unix时间戳为你现在的时间,试用期就会变回30天。
2.现在所需要的就是获得当前的Unix时间戳,获得的方法多种多样。
例如我使用python,交互式shell中输入:
>>> import time
>>> time.time()
1295081182.125
显然,1295081182就是当前的Unix时间戳。
替换nyfedit.ini里面的App.UserLic.FirstUseOn参数,保存。
重新打开 myBase Desktop 试用时间就会回到30天。
最简单获得Unix时间戳的方法,访问如下链接就有:
http://tool.chinaz.com/Tools/unixtime.aspx
原文出处:http://kpjack.blog.51cto.com/627289/581938
-------------------------
#coding:utf-8
import os
import re
import time
from tkinter import *
target_str = 'App.UserLic.FirstUseOn'
str_list = []
old_str = ''
new_str = ''
fileName = ''
success = False
root = Tk()
# 打开文件,获取文件名
def openFile():
global fileName #修改全局变量
fileName = filedialog.askopenfilename()
#print(fileName)
vopen.set(fileName)
# 更新时间
def updateFile():
global str_list, new_str, old_str, filename, success
# 遍历到列表
with open(fileName, 'rb') as f:
for each_line in f.readlines():
str_list.append(each_line)
# 查找字符串
for each_str in str_list:
if target_str in each_str.decode('utf-8'):
pos = str_list.index(each_str)
old_str = str_list[pos].decode('utf-8')
# 正则替换
new_str = re.sub(r'(\d+)', str(time.time()).split('.')[0], old_str)
str_list[pos] = bytes(new_str, encoding="utf-8")
#print('Change:\n%sTo:\n%s'%(old_str, new_str))
success = True
break
else:
vupdate.set('文件格式错误!')
if success:
# 写入文件
with open(fileName, 'wb') as ff:
for each_ in str_list:
ff.write(each_)
vupdate.set('Change:\n%sTo:\n%s'%(old_str, new_str))
# 执行完成后初始化全局变量
str_list = []
old_str = ''
new_str = ''
filename = ''
success = False
# 界面部分
openButton = Button(root, text="打开文件", command=openFile).pack()
vopen = StringVar()
vopen.set("未选定任何文件")
openLabel = Label(root, textvariable=vopen).pack()
vupdate = StringVar()
vupdate.set("暂无任何更新")
updateButton = Button(root, text="更新文件", command=updateFile).pack()
updateLabel =Label(root, textvariable=vupdate).pack()
mainloop()
-------------------------