最新消息:

EnumINI为NSIS提供检索INI文件操作

nsis 永恒心锁 2039浏览 0评论
/*
EnumINI为NSIS提供检索INI文件操作
可以迭代遍历INI文件的键和值,可以查询特定的键值是否存在
*/
; EnumINI plug-in example
!AddPluginDir "../../Plugins"
Name "EnumINI Example"
OutFile "EnumINI.exe"
ShowInstDetails show
Section ""
 InitPluginsDir
 DetailPrint "EnumINI plug-in v0.13"
 DetailPrint ""
 DetailPrint "Let's enumerate keys in $"EXAMPLE_ONE$" section"
 EnumINI::Section "enumtest.ini" "EXAMPLE_ONE"
 Pop $R0
 DetailPrint "Keys in stack: $R0"
 StrCmp $R0 "error" done
 loop:
 IntCmp $R0 "0" done done 0
 Pop $R1
 DetailPrint "$R1"
 IntOp $R0 $R0 - 1
Goto loop
 done:
 DetailPrint ""
 DetailPrint "Let's enumerate sections in .ini file"
 EnumINI::SectionNames "enumtest.ini"
 Pop $R0
 DetailPrint "Sections in stack: $R0"
 StrCmp $R0 "error" done2
 loop2:
 IntCmp $R0 "0" done2 done2 0
 Pop $R1
 DetailPrint "$R1"
 IntOp $R0 $R0 - 1
Goto loop2
 done2:
 DetailPrint ""
 DetailPrint "Let's find out if key $"fairlight$" exist in $"EXAMPLE_ONE$" section"
 EnumINI::KeyExist "enumtest.ini" "EXAMPLE_ONE" "fairlight"
 Pop $R0
 DetailPrint "In stack we have: $R0"
 StrCmp $R0 "1" 0 +3
 DetailPrint "And the key exist :)"
 Goto +3
 StrCmp $R0 "0" +2
 DetailPrint "And key doesn't exist :("
 DetailPrint ""
 DetailPrint "Let's find out if section $"EXAMPLE_TWO$" exist in .ini file"
 EnumINI::SectionExist "enumtest.ini" "EXAMPLE_TWO"
 Pop $R0
 DetailPrint "In stack we have: $R0"
 StrCmp $R0 "1" 0 +3
 DetailPrint "And the section exist :)"
 Goto +3
 StrCmp $R0 "0" +2
 DetailPrint "And section doesn't exist :("
 DetailPrint ""
 DetailPrint "Let's test stuff ;)"
 EnumINI::Section "enumtest.ini" "TEST STUFF"
 Pop $R2
 StrCmp $R2 "error" done3
 loop3:
 IntCmp $R2 "0" done3 done3 0
 Pop $R3
 ReadINIStr $R4 "$EXEDIRenumtest.ini" "TEST STUFF" "$R3"
 DetailPrint ">$R3< = >$R4<"
 IntOp $R2 $R2 - 1
 Goto loop3
 done3:
 DetailPrint ""
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » EnumINI为NSIS提供检索INI文件操作

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