最新消息:

StdUtils是NSIS集随机数字符串处理时间函数命令行参数格式化的插件

nsis 永恒心锁 2133浏览 0评论
/*
StdUtils是NSIS集随机数字符串处理时间函数命令行参数格式化的插件
StdUtils提供时间,随机数,列表,格式字符串,去除字符串空格,字符串倒序,文件移动复制,取命令行参数等功能.
*/
Caption "StdUtils Test-Suite"
!addincludedir "....Include"
!ifdef NSIS_UNICODE
!addplugindir "....PluginsRelease_Unicode"
OutFile "StdUtilsTest-Unicode.exe"
!else
!addplugindir "....PluginsRelease_ANSI"
OutFile "StdUtilsTest-ANSI.exe"
!endif
!macro NextTest
Section
DetailPrint "--------------"
SectionEnd
!macroend
!include 'StdUtils.nsh'
RequestExecutionLevel user
ShowInstDetails show
Section
${StdUtils.Time} $1
DetailPrint "Time: $1"
Sleep 500
${StdUtils.Time} $1
DetailPrint "Time: $1"
Sleep 500
${StdUtils.Time} $1
DetailPrint "Time: $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
${StdUtils.Rand} $1
DetailPrint "Random: $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
${StdUtils.RandMax} $1 42
DetailPrint "Random Max: $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 -4 -2
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
${StdUtils.RandMinMax} $1 20 21
DetailPrint "Random Min/Max: $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.FormatStr} $1 "Hello World is %05d woha!" 89
DetailPrint "FormatStr: $1"
${StdUtils.FormatStr2} $1 "Hello World is %05d and %05d woha!" 89 384
DetailPrint "FormatStr: $1"
${StdUtils.FormatStr3} $1 "Hello World is %05d and %05d or even %05d woha!" 89 384 2384
DetailPrint "FormatStr: $1"
${StdUtils.FormatStr} $1 "Hello World is %09000d." 89
DetailPrint "FormatStr: $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.RandList} 50 100
Pop $1
StrCmp $1 EOL +3
DetailPrint "RandList: $1"
Goto -3
SectionEnd
!insertmacro NextTest
Section
${StdUtils.ScanStr} $0 "Der Test sagt %d ist toll!" "Der Test sagt 571 ist toll!" 42
DetailPrint "ScanStr: $0"
${StdUtils.ScanStr} $0 "Der Hund sagt %d ist toll!" "Der Test sagt 571 ist toll!" 42
DetailPrint "ScanStr: $0"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.ScanStr2} $0 $1 "Der Test sagt %d sowie %d ist toll!" "Der Test sagt 571 sowie 831 ist toll!" 42 43
DetailPrint "ScanStr2: $0, $1"
${StdUtils.ScanStr2} $0 $1 "Der Test sagt %d sowie %d ist toll!" "Der Test sagt 571 horch 831 ist toll!" 42 43
DetailPrint "ScanStr2: $0, $1"
${StdUtils.ScanStr2} $0 $1 "Der Test sagt %d sowie %d ist toll!" "Der Hund sagt 571 horch 831 ist toll!" 42 43
DetailPrint "ScanStr2: $0, $1"
SectionEnd
!insertmacro NextTest
Section
${StdUtils.ScanStr3} $0 $1 $2 "Der Test sagt %d sowie %d ist toll! Und %d." "Der Test sagt 571 sowie 831 ist toll! Und 325" 42 43 44
DetailPrint "ScanStr3: $0, $1, $2"
${StdUtils.ScanStr3} $0 $1 $2 "Der Test sagt %d sowie %d ist toll! Und %d." "Der Test sagt 571 sowie 831 ist toll! OMG 325" 42 43 44
DetailPrint "ScanStr3: $0, $1, $2"
${StdUtils.ScanStr3} $0 $1 $2 "Der Test sagt %d sowie %d ist toll! Und %d." "Der Test sagt 571 horch 831 ist toll! OMG 325" 42 43 44
DetailPrint "ScanStr3: $0, $1, $2"
${StdUtils.ScanStr3} $0 $1 $2 "Der Test sagt %d sowie %d ist toll! Und %d." "Der Hund sagt 571 horch 831 ist toll! OMG 325" 42 43 44
DetailPrint "ScanStr3: $0, $1, $2"
SectionEnd
!insertmacro NextTest
Section
InitPluginsDir
SetOutPath "$PLUGINSDIRTestDirA"
File "${NSISDIR}ContribGraphicsChecks*.*"
SetOutPath "$PLUGINSDIRTestDirASubDir"
File "${NSISDIR}ContribGraphicsHeader*.*"
CreateDirectory "$PLUGINSDIRSubDirX"
CreateDirectory "$PLUGINSDIRSubDirY"
${StdUtils.SHFileCopy} $0 "$PLUGINSDIRTestDirA" "$PLUGINSDIRSubDirXTestDirB" $HWNDPARENT
DetailPrint "SHFileCopy: $0"
${StdUtils.SHFileMove} $0 "$PLUGINSDIRTestDirA" "$PLUGINSDIRSubDirYTestDirC" $HWNDPARENT
DetailPrint "SHFileMove: $0"
ExecShell "explore" "$PLUGINSDIR"
SectionEnd
!insertmacro NextTest
Section
MessageBox MB_ICONINFORMATION "The next three operations are going to fail!$nBut only one will be verbose..."
${StdUtils.SHFileCopy} $0 "$PLUGINSDIRTestDirXYZ" "$PLUGINSDIRSubDirXTestDirZ" $HWNDPARENT
DetailPrint "SHFileCopy: $0"
${StdUtils.SetVerbose} 1
${StdUtils.SHFileCopy} $0 "$PLUGINSDIRTestDirXYZ" "$PLUGINSDIRSubDirXTestDirZ" $HWNDPARENT
DetailPrint "SHFileCopy: $0"
${StdUtils.SetVerbose} 0
${StdUtils.SHFileCopy} $0 "$PLUGINSDIRTestDirXYZ" "$PLUGINSDIRSubDirXTestDirZ" $HWNDPARENT
DetailPrint "SHFileCopy: $0"
SectionEnd
!insertmacro NextTest
Section
StrCpy $1 " Some Text "
DetailPrint "String: '$1'"
StrCpy $0 $1
${StdUtils.TrimStr} $0
DetailPrint "TrimStr: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrLeft} $0
DetailPrint "TrimStrLeft: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrRight} $0
DetailPrint "TrimStrRight: '$0'"
StrCpy $1 "Some Text"
DetailPrint "String: '$1'"
StrCpy $0 $1
${StdUtils.TrimStr} $0
DetailPrint "TrimStr: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrLeft} $0
DetailPrint "TrimStrLeft: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrRight} $0
DetailPrint "TrimStrRight: '$0'"
StrCpy $1 ""
DetailPrint "String: '$1'"
StrCpy $0 $1
${StdUtils.TrimStr} $0
DetailPrint "TrimStr: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrLeft} $0
DetailPrint "TrimStrLeft: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrRight} $0
DetailPrint "TrimStrRight: '$0'"
StrCpy $1 " "
DetailPrint "String: '$1'"
StrCpy $0 $1
${StdUtils.TrimStr} $0
DetailPrint "TrimStr: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrLeft} $0
DetailPrint "TrimStrLeft: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrRight} $0
DetailPrint "TrimStrRight: '$0'"
StrCpy $1 "$tFoobar$r$n"
DetailPrint "String: '$1'"
StrCpy $0 $1
${StdUtils.TrimStr} $0
DetailPrint "TrimStr: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrLeft} $0
DetailPrint "TrimStrLeft: '$0'"
StrCpy $0 $1
${StdUtils.TrimStrRight} $0
DetailPrint "TrimStrRight: '$0'"
SectionEnd
!insertmacro NextTest
Section
StrCpy $0 "ABC"
DetailPrint "String: $0"
${StdUtils.RevStr} $0
DetailPrint "RevStr: $0"
StrCpy $0 "ABCD"
DetailPrint "String: $0"
${StdUtils.RevStr} $0
DetailPrint "RevStr: $0"
StrCpy $0 "Just a very long text with no specific meaning at all!"
DetailPrint "String: $0"
${StdUtils.RevStr} $0
DetailPrint "RevStr: $0"
SectionEnd
!insertmacro NextTest
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » StdUtils是NSIS集随机数字符串处理时间函数命令行参数格式化的插件

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