最新消息:

time是NSIS获取设置本地时间获取设置文件或目录的创建时间访问时间最后修改时间的插件

nsis 永恒心锁 2274浏览 0评论
/*
time是NSIS获取设置本地时间获取设置文件或目录的创建时间访问时间最后修改时间的插件
time对本地时间的操作不仅可以获取还可以进行设置,对于文件的创建时间和最后修改时间都可以进行修改类似于对文件的属性进行操作.
*/
!AddIncludeDir "../Include"
!AddPluginDir "../Plugin"
Name "TimeTest"
OutFile "TimeTest.exe"
!include "Time.nsh"
!include "Sections.nsh"
Var RADIOBUTTON
Page components
Page instfiles
Section "Mathematical operations test" MathTime
#Compare times:
${time::MathTime} "second(29.12.2005 0:0:0) - second(30.12.2005 0:0:0) =" $0
IntCmp $0 0 0 +2 +3
MessageBox MB_OK 'Time are equal' IDOK dayofweek
MessageBox MB_OK 'Second time is later than first time' IDOK dayofweek
MessageBox MB_OK 'First time is later than second time' IDOK dayofweek
dayofweek:
#Calculate day of the week:
${time::MathTime} "day(29.12.2005 0:0:0) + 5 % 7 =" $0
MessageBox MB_OK 'day of the week$n$$0={$0}'
#Calculate date after 60 days:
${time::MathTime} "date(29.12.2005 0:0:0) + date(60.0.0 0:0:0) = date" $0
MessageBox MB_OK 'date after 60 days$n$$0={$0}'
#Calculate how many days between dates:
${time::MathTime} "second(29.12.2005 0:0:0) - second(15.09.1996 0:0:0) = day" $0
MessageBox MB_OK 'how many days between dates$n$$0={$0}'
#Calculate how many days in 1234567890 seconds:
${time::MathTime} "second(1.1.0 0:0:0) + 1234567890 = day" $0
MessageBox MB_OK 'how many days in 1234567890 seconds$n$$0={$0}'
#Is this date a valid date:
StrCpy $0 "31.02.2005 0:0:0"
${time::MathTime} "date($0) = date" $1
StrCmp $0 $1 0 +2
MessageBox MB_OK '$0 is valid date' IDOK unload
MessageBox MB_OK '$0 is invalid date$n(valid is $1)' IDOK unload
unload:
${time::Unload}
SectionEnd
Section /o "Local time test" LocalTime
${time::GetLocalTime} $0
MessageBox MB_OK 'time::GetLocalTime$n$$0={$0}'
${time::SetLocalTime} "05.05.1995 05:55:55" $R0
MessageBox MB_OK 'time::SetLocalTime$n$$R0={$R0}$n$nLocal time has changed. Click OK to change it back'
${time::SetLocalTime} "$0" $R0
MessageBox MB_OK 'time::SetLocalTime$n$$R0={$R0}'
${time::Unload}
SectionEnd
Section /o "File time test" FileTime
${time::GetFileTime} "$WINDIRsystem.ini" $0 $1 $2
MessageBox MB_OK 'time::GetFileTime$n$$0={$0}$n$$1={$1}$n$$2={$2}'
${time::SetFileTime} "$WINDIRsystem.ini" "01.01.2000 20:30:40" "01.01.2001 21:31:41" "01.01.2002 22:32:42" $R0
MessageBox MB_OK 'time::SetFileTime$n$$R0={$R0}'
${time::GetFileTime} "$WINDIRsystem.ini" $3 $4 $5
MessageBox MB_OK 'time::GetFileTime$n$$3={$3}$n$$4={$4}$n$$5={$5}$n$nFile time has changed. Click OK to change it back'
${time::SetFileTime} "$WINDIRsystem.ini" "$0" "$1" "$2" $R0
MessageBox MB_OK 'time::SetFileTime$n$$R0={$R0}'
${time::GetFileTime} "$WINDIRsystem.ini" $0 $1 $2
MessageBox MB_OK 'time::GetFileTime$n$$0={$0}$n$$1={$1}$n$$2={$2}'
${time::Unload}
SectionEnd
Section /o "Time string test" TimeString
${time::GetLocalTime} $R0
${time::TimeString} "$R0" $0 $1 $2 $3 $4 $5
MessageBox MB_OK 'time::TimeString$n$0/$1/$2 $3-$4-$5'
${time::Unload}
SectionEnd
Function .onInit
StrCpy $RADIOBUTTON ${MathTime}
FunctionEnd
Function .onSelChange
!insertmacro StartRadioButtons $RADIOBUTTON
!insertmacro RadioButton ${MathTime}
!insertmacro RadioButton ${LocalTime}
!insertmacro RadioButton ${FileTime}
!insertmacro RadioButton ${TimeString}
!insertmacro EndRadioButtons
FunctionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » time是NSIS获取设置本地时间获取设置文件或目录的创建时间访问时间最后修改时间的插件

您必须 登录 才能发表评论!