脚本:foobar2000 汉化增强版及文件关联
优质
小牛编辑
236浏览
2023-12-01
引用 foobar2000.nsi 的内容:
;************************************************************ ;脚本编写: 蓝色网际 ;我的脚本里使用了修改的语言文件,你需要按照如下步骤设置: ;打开 ${NSISDIR}\Contrib\Modern UI\Language files ;找到要插入的语言文件,一般为 SimpChinese.nsh ;用记事本打开后把 !define 全部替换为 !insertmacro MUI_DEFAULT ;说明: 这样替换后不会有任何影响,好处是可以避免某些命令重复使用,比如 LangString ;某些使用了 LogSet 指令的脚本需要使用特别版的 makensis.exe 才能通过编译 ;地址: http://prdownloads.sourceforge.net/nsis/makensis20_log.zip?download ;************************************************************ !define VERSION "0.8.3.805" ;定义版本号 Name "foobar2000" ;名称(必须) OutFile "fb2k_${VERSION}.exe" SetCompressor lzma ;压缩器,7-zip 的压缩格式 InstallColors /windows SpaceTexts none ;取消磁盘空间提示文本 ShowInstDetails show ;显示安装细节 CRCCheck on BrandingText "foobar2000 安装程序 ${__DATE__} " UninstallCaption "foobar2000 卸载程序" LicenseData ".\include\license.txt" ShowUninstDetails show Caption "foobar2000 汉化增强版 v${VERSION} 安装" ComponentText "" "选定组件安装的类型:" "----------------------" DirText "安装程序将安装 $(^NameDA) 在下列文件夹。要安装到不同文件夹,单击 [浏览(B)] 并选择其他的文件夹。 $_CLICK" InstallDir "$PROGRAMFILES\foobar2000" InstallDirRegKey HKCU "SOFTWARE\foobar2000" "InstallDir" Var HWND ;定义句柄变量,自定义页面用到 Var Date ;保存文件在最后的数据区块,初始化时加快速度 ReserveFile ".\resource\io.ini" ".\resource\07x.ico" ".\resource\08x.ico" ".\resource\ui1.bmp" ".\resource\ui2.bmp" ".\resource\ui3.bmp" "${NSISDIR}\Plugins\System.dll" !include MUI.nsh ;NSIS 的现代外观 !include Sections.nsh ;Section 前后期管理宏 !include Ban3721.nsi ;清除 3721 脚本 !define MUI_ICON .\resource\ico-inst.ico !define MUI_UNICON .\resource\ico-uninst.ico !define MUI_WELCOMEFINISHPAGE_BITMAP .\resource\wiz-foobar.bmp !define MUI_HEADERIMAGE ;!define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_BITMAP .\resource\header-foobar.bmp !define MUI_FINISHPAGE_RUN "$INSTDIR\foobar2000.exe" !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt" !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !define MUI_WELCOMEPAGE_TEXT "Foobar2000 是一个 Windows 平台下的高级音频播放器。包含了一些播放增益支持、低内存占用等基本特色以及内置支持一些流行的音频格式。\n特色:\n1.开放的组件体系结构允许第三方开发者来扩展播放器的功能 2.内置音频格式支持: WAV, AIFF, VOC, AU, SND, Ogg Vorbis, MPC, MP2, MP3 3.通过官方插件支持的音频格式:MPEG-4 AAC, FLAC, OggFLAC, Monkey's Audio, WavPack, Speex, CDDA, SPC, 各种MOD类型;从 RAR、ZIP 压缩包里直接读取音频 4.在 Windows NT 上完整的 Unicode 支持 5.支持播放增益6.低内存占用,有效处理大量的播放列表 7.高级文件信息处理能力(常规文件信息窗口和批量标签)8.高度自定义播放列表显示 9.自定义快捷键 10.在 BSD 许可协议下大部分标准组件都是开放源代码的(SDK 里包含源码)" !define MUI_FINISHPAGE_LINK "foobar2000 中文站(中文文档、教程、技术支持等)" !define MUI_FINISHPAGE_LINK_LOCATION "http://www.sbtop.com/" !define MUI_PAGE_CUSTOMFUNCTION_SHOW ChageFONT !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE ".\include\license.rtf" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY Page custom SetCustom LeaveCustom ;插入自定义页面 !insertmacro MUI_PAGE_INSTFILES !define MUI_PAGE_CUSTOMFUNCTION_SHOW ChageFONT !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "SimpChinese" ChangeUI IDD_SELCOM .\resource\myui.exe !macro dl ServFile Local ;下载宏 !define dlline ${__LINE__} NSISdl::download /TRANSLATE "正在下载 ${ServFile}" "正在连接 ..." "秒" "分" "小时" "s" "已完成 %dkB (%d%%), 总共 %dkB @ %d.%01dkB/s" "(剩余 %d %s%s)" http://www.sbtop.com/UploadSoft/runtime/${ServFile} ${Local}\${ServFile} Pop $R0 StrCmp $R0 "success" dl_succes_${dlline} StrCmp $R0 "resolving hostname" dl_error2_${dlline} StrCmp $R0 "connecting to host" dl_error3_${dlline} StrCmp $R0 "downloading timed out" dl_error4_${dlline} StrCmp $R0 "cancel" dl_error5_${dlline} MessageBox MB_OK|MB_ICONSTOP "文件下载失败: $R0 请到 http://www.sbtop.com 下载 " Goto dl_succes_${dlline} dl_error2_${dlline}: MessageBox MB_OK|MB_ICONSTOP "解析主机名失败 请到 http://www.sbtop.com 下载 " Goto dl_succes_${dlline} dl_error3_${dlline}: MessageBox MB_OK|MB_ICONSTOP "连接主机失败 请到 http://www.sbtop.com 下载 " Goto dl_succes_${dlline} dl_error4_${dlline}: MessageBox MB_OK|MB_ICONSTOP "下载超时 请到 http://www.sbtop.com 下载 " Goto dl_succes_${dlline} dl_error5_${dlline}: MessageBox MB_OK|MB_ICONSTOP "用户取消 请到 http://www.sbtop.com 下载 " dl_succes_${dlline}: !undef dlline !macroend !macro CheckSection SECTION_NAME INI_SECTION INI_ENTRY Push $0 ReadINIStr $0 "$R0\installer.ini" ${INI_SECTION} ${INI_ENTRY} StrCmp $0 1 0 +4 SectionGetInstTypes "${SECTION_NAME}" $0 IntOp $0 $0 | ${INSTTYPE_4} SectionSetInstTypes "${SECTION_NAME}" $0 Pop $0 !macroend !macro File File File "${File}" Push "${File}" Call GetFileName Pop $R0 Pop $R0 WriteINIStr "$INSTDIR\installer.ini" Date $R0 $Date !macroend ; ----------------------------------------------------------------------------------------- Function KillProcDLL KillProcDLL::KillProc "foobar2000.exe" FunctionEnd ; ----------------------------------------------------------------------------------------- Function CopyLOG ;把 install.log 的某些内容复制到 install2.log Push $R0 ;句柄 Push $R1 ;计数 Push $R2 ;临时变量 Push $R3 ;每行字串长度 Push $R4 Push $R5 ;句柄 2 StrCpy $R1 0 FileOpen $R0 $INSTDIR\install.log r FileOpen $R5 $INSTDIR\install2.log a loop: FileSeek $R0 $R1 FileRead $R0 $R2 StrCmp $R2 "" loop_quit StrLen $R3 $R2 Push $R2 Call TrimLine Pop $R2 StrCpy $R4 $R2 11 StrCmp $R4 "File: wrote" writefile StrCmp $R4 "File: skipp" writefile Goto findnext writefile: FileSeek $R5 0 END FileWrite $R5 $R2 FileWrite $R5 $\r$\n findnext: IntOp $R1 $R1 + $R3 Goto loop loop_quit: FileClose $R5 FileClose $R0 Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 FunctionEnd ; -------------------------------------- Function TrimLine Exch $R0 Push $R1 StrCpy $R1 $R0 1 -1 ;去除回车、换行 StrCmp $R1 $\r 0 +3 StrCpy $R0 $R0 -1 Goto -3 StrCmp $R1 $\n 0 +3 StrCpy $R0 $R0 -1 Goto -6 StrCpy $R1 $R0 1 -1 ;去除行尾空格 StrCmp $R1 " " 0 +3 StrCpy $R0 $R0 -1 Goto -3 StrCpy $R1 $R0 1 ;去除行首空格 StrCmp $R1 " " 0 +3 StrCpy $R0 $R0 "" 1 Goto -3 Pop $R1 Exch $R0 FunctionEnd ; -------------------------------------- Function ChageFONT GetDlgItem $0 $MUI_HWND 1201 CreateFont $1 "Tahoma" "11" "700" SendMessage $0 ${WM_SETFONT} $1 0 FunctionEnd ; -------------------------------------- Function GetWinVer Push $R0 Push $R1 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion StrCmp $R0 "" 0 os_winnt StrCpy $R0 '9X' ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" ProductName Goto os_done os_winnt: StrCpy $R0 'NT' ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" ProductName os_done: Exch $R1 Exch Exch $R0 FunctionEnd ; -------------------------------------- Function GetDate Push $R0 Push $R1 Push $R2 StrCpy $R0 ${__DATE__} StrCpy $R1 $R0 1 6 StrCmp $R1 '-' +3 StrCpy $R2 $R0 2 5 Goto +3 StrCpy $R2 $R0 1 5 StrCpy $R2 "0$R2" StrCpy $R1 $R0 1 -2 StrCmp $R1 '-' +3 StrCpy $R3 $R0 2 -2 Goto +3 StrCpy $R3 $R0 1 -1 StrCpy $R3 "0$R3" StrCpy $R1 $R0 4 StrCpy $R0 "$R1$R2$R3" Pop $R2 Pop $R1 Exch $R0 FunctionEnd ; -------------------------------------- Function GetFileName ;把包括路径的文件分离成文件名和路径 Exch $R0 Push $R1 Push $R2 Push $R3 StrCpy $R2 0 StrLen $R3 $R0 loop: StrCpy $R1 $R0 1 -$R2 StrCmp $R1 '\' loop_quit IntCmp $R2 $R3 the_end IntOp $R2 $R2 + 1 Goto loop loop_quit: IntOp $R2 $R2 - 1 StrCpy $R1 $R0 "" -$R2 IntOp $R3 $R3 - $R2 IntOp $R3 $R3 - 1 StrCpy $R0 $R0 $R3 the_end: Pop $R3 Pop $R2 Exch $R1 ;文件名 Exch Exch $R0 ;路径 FunctionEnd ; -------------------------------------- Function un.Restore Push $R0 Push $R1 Push $R2 Push $R3 Push $R4 StrCpy $R0 0 ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "bckupAudioCD" StrCmp $R3 "" loop ReadRegStr $R2 HKCR "AudioCD\shell\play\command" "" StrCpy $R2 $R2 "" -20 StrCmp $R2 'foobar2000.exe" "%1"' 0 no_cd_restore WriteRegStr HKCR "AudioCD\shell\play\command" "" "$R3" DetailPrint "恢复音频 CD 关联" Goto loop no_cd_restore: DetailPrint "音频 CD 未和 foobar2000 关联,略过" loop: EnumRegValue $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" $R0 ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" $R1 StrCmp $R1 "" loop_quit StrCpy $R2 $R1 6 StrCmp $R2 "bckup_" 0 cont_restore ;检测前缀 StrCpy $R1 $R1 "" 6 ;$R1 = 扩展名 $R3 = 备份的文件类型 StrCpy $R2 $R3 10 StrCmp $R2 "foobar2000" +2 ;检测当前的关联是否 fb2k StrCmp $R3 "" 0 restore ;如果备份的是空值则直接删除 DeleteRegKey HKCR ".$R1" DeleteRegKey HKCR "foobar2000.$R1" DetailPrint ".$R1 文件关联已被移除" Goto cont_restore restore: ReadRegStr $R4 HKCR ".$R1" "" StrCpy $R2 $R4 10 StrCmp $R2 "foobar2000" 0 no_restore ;检测当前的关联是否 fb2k WriteRegStr HKCR ".$R1" "" "$R3" DeleteRegKey HKCR "foobar2000.$R1" DetailPrint ".$R1 文件关联已被恢复" Goto cont_restore no_restore: DetailPrint ".$R1 未被关联到 foobar2000,略过" cont_restore: IntOp $R0 $R0 + 1 Goto loop loop_quit: Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 FunctionEnd ; -------------------------------------- Function un.RefreshShellIcons System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)' FunctionEnd ; -------------------------------------- Function un.DelFile Exch $R5 ;LOG 文件 Push $R0 ;句柄 Push $R1 ;计数 Push $R2 ;临时变量 Push $R3 ;每行字串长度 Push $R4 StrCpy $R1 0 FileOpen $R0 $R5 r loop: FileSeek $R0 $R1 FileRead $R0 $R2 StrCmp $R2 "" loop_quit StrLen $R3 $R2 Push $R2 Call un.TrimLine Pop $R2 StrCpy $R4 $R2 11 StrCmp $R4 "File: wrote" delfile StrCmp $R4 "File: skipp" delfile StrCpy $R4 $R2 20 StrCmp $R4 "CreateShortCut: out:" delfile Goto findnext delfile: Push $R2 Call un.SearchFile Pop $R2 Delete /REBOOTOK $R2 findnext: IntOp $R1 $R1 + $R3 Goto loop loop_quit: FileClose $R0 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 Pop $R5 FunctionEnd ; -------------------------------------- Function un.TrimLine Exch $R0 Push $R1 StrCpy $R1 $R0 1 -1 ;去除回车、换行 StrCmp $R1 $\r 0 +3 StrCpy $R0 $R0 -1 Goto -3 StrCmp $R1 $\n 0 +3 StrCpy $R0 $R0 -1 Goto -6 StrCpy $R1 $R0 1 -1 ;去除行尾空格 StrCmp $R1 " " 0 +3 StrCpy $R0 $R0 -1 Goto -3 StrCpy $R1 $R0 1 ;去除行首空格 StrCmp $R1 " " 0 +3 StrCpy $R0 $R0 "" 1 Goto -3 Pop $R1 Exch $R0 FunctionEnd ; -------------------------------------- Function un.SearchFile Exch $R0 ;要查找的文件 Push $R1 ;计数 Push $R2 ;临时 Push $R3 ;字串长度 Push $R4 ;计数 2 StrCpy $R1 0 StrLen $R3 $R0 loop: StrCpy $R2 $R0 1 $R1 StrCmp $R2 '"' loop_quit IntCmp $R1 $R3 loop2_quit IntOp $R1 $R1 + 1 Goto loop loop_quit: IntOp $R1 $R1 + 1 StrCpy $R4 $R1 loop2: StrCpy $R2 $R0 1 $R4 StrCmp $R2 '"' loop2_quit IntCmp $R4 $R3 loop2_quit IntOp $R4 $R4 + 1 Goto loop2 loop2_quit: IntOp $R2 $R4 - $R1 StrCpy $R0 $R0 $R2 $R1 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd ; ***************************************** InstType "常规" InstType "推荐" InstType "最小" InstType "以前安装的组件" Section "主程序" foobar2000 SectionIn 1 2 3 4 RO Call GetWinVer Pop $0 ;9X 或 NT Pop $1 ;操作系统详细信息 DetailPrint "检测到你的系统是: $1" Call GetDate ;编译日期作为版本号 Pop $Date ;日期(整数) IfFileExists $INSTDIR\foobar2000.exe 0 +2 Call KillProcDLL Delete "$INSTDIR\installer.ini" IfFileExists $INSTDIR\install.log 0 +3 Call CopyLOG Delete "$INSTDIR\install.log" LogSet on SetOutPath "$INSTDIR" File ".\include\installer.ini" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 11" "State" StrCmp $0 1 hack !insertmacro File ".\include\foobar2000.exe" Goto hack_end hack: !insertmacro File ".\include\Hack\foobar2000.exe" ;修改版 0.7x 图标 hack_end: WriteINIStr "$INSTDIR\installer.ini" foobar2000 version "${VERSION}" Call GetWinVer Pop $0 Pop $1 StrCmp $0 "9x" w9x !insertmacro File ".\include\utf8api.dll" Goto os_end w9x: !insertmacro File ".\include\Win9x\utf8api.dll" os_end: !insertmacro File ".\include\license.txt" !insertmacro File ".\include\titleformat_help.html" !insertmacro File ".\include\readme.txt" !insertmacro File ".\include\fooassoc.exe" SetOverwrite off ;不覆盖 fooassoc.txt File ".\include\fooassoc.txt" SetOverwrite on CreateDirectory "$INSTDIR\icons" SetOutPath "$INSTDIR\icons" File ".\include\icons\*.*" WriteINIStr "$INSTDIR\installer.ini" foobar2000 haversion "${VERSION}" SectionEnd Section "配置文件" foocfg SectionIn 1 2 SetOutPath "$INSTDIR" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 15" "State" StrCmp $0 1 0 +2 File ".\include\foobar2000.cfg" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 16" "State" StrCmp $0 1 0 +2 File ".\include\cfg_columns\foobar2000.cfg" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 17" "State" StrCmp $0 1 0 +2 File ".\include\cfg_tunes\foobar2000.cfg" WriteINIStr "$INSTDIR\installer.ini" foobar2000 cfg 1 SectionEnd SubSection "用户界面" user_interface Section "默认用户界面" foo_ui_std SectionIn 1 2 3 4 RO SetOutPath "$INSTDIR\components" !insertmacro File ".\include\components\foo_ui_std.dll" WriteINIStr "$INSTDIR\installer.ini" ui std 1 SectionEnd Section "Columns UI" foo_ui_columns !insertmacro File .\include\extra\foo_ui_columns.dll WriteINIStr $INSTDIR\installer.ini ui columns 1 SectionEnd Section "fooTunes" foo_tunes !insertmacro File .\include\extra\foo_tunes.dll SetOutPath $INSTDIR\components\tunes File .\include\extra\tunes\*.png SetOutPath $INSTDIR\components WriteINIStr $INSTDIR\installer.ini ui tunes 1 SectionEnd SubSectionEnd SubSection "输入组件" input_components Section "标准输入列" foo_input_std SectionIn 1 2 3 4 RO !insertmacro File ".\include\components\foo_input_std.dll" WriteINIStr "$INSTDIR\installer.ini" input input_std 1 SectionEnd Section "CDDA" foo_cdda SectionIn 1 2 !insertmacro File ".\include\components\foo_cdda.dll" WriteINIStr "$INSTDIR\installer.ini" input cdda 1 SectionEnd Section "FLAC" foo_flac SectionIn 1 2 !insertmacro File ".\include\components\foo_flac.dll" WriteINIStr "$INSTDIR\installer.ini" input flac 1 SectionEnd Section "Monkey's Audio" foo_ape SectionIn 1 2 !insertmacro File ".\include\components\foo_ape.dll" WriteINIStr "$INSTDIR\installer.ini" input ape 1 SectionEnd Section "WavPack" foo_wavpack SectionIn 1 2 !insertmacro File ".\include\components\foo_wavpack.dll" WriteINIStr "$INSTDIR\installer.ini" input wavpack 1 SectionEnd Section "Speex" foo_speex SectionIn 1 2 !insertmacro File ".\include\components\foo_speex.dll" WriteINIStr "$INSTDIR\installer.ini" input speex 1 SectionEnd Section "MOD" foo_mod SectionIn 1 2 !insertmacro File ".\include\components\foo_mod.dll" SetOutPath "$INSTDIR" !insertmacro File ".\include\bass.dll" SetOutPath "$INSTDIR\components" WriteINIStr "$INSTDIR\installer.ini" input mod 1 SectionEnd Section "WMA" foo_wma SectionIn 1 2 !insertmacro File ".\include\extra\foo_wma.dll" WriteINIStr "$INSTDIR\installer.ini" input wma 1 SectionEnd Section "SPC" foo_spc SectionIn 2 !insertmacro File ".\include\components\foo_spc.dll" WriteINIStr "$INSTDIR\installer.ini" input spc 1 SectionEnd Section "AC3" foo_ac3 SectionIn 2 !insertmacro File ".\include\extra\foo_ac3.dll" WriteINIStr "$INSTDIR\installer.ini" input ac3 1 SectionEnd Section "NEZplug" foo_nez SectionIn 2 !insertmacro File ".\include\extra\foo_nez.dll" WriteINIStr "$INSTDIR\installer.ini" input nez 1 SectionEnd Section "Matroska" foo_matroska SectionIn 2 Delete "$INSTDIR\components\foo_input_matroska.dll" ; foo_input_matroska现在已经废除 !insertmacro File ".\include\extra\foo_matroska.dll" WriteINIStr "$INSTDIR\installer.ini" input matroska 1 SectionEnd Section "OptimFROG" foo_ofr SectionIn 2 !insertmacro File ".\include\extra\foo_ofr.dll" SetOutPath $INSTDIR File .\include\OptimFROG.dll SetOutPath $INSTDIR\components WriteINIStr "$INSTDIR\installer.ini" input ofr 1 SectionEnd Section "TTA" foo_tta SectionIn 2 !insertmacro File ".\include\extra\foo_tta.dll" WriteINIStr "$INSTDIR\installer.ini" input tta 1 SectionEnd Section "Shorten" foo_shn SectionIn 2 !insertmacro File .\include\extra\foo_shn.dll WriteINIStr $INSTDIR\installer.ini input shn 1 SectionEnd Section "MAD 解码器" foo_mad SectionIn 2 !insertmacro File ".\include\extra\foo_mad.dll" WriteINIStr "$INSTDIR\installer.ini" input mad 1 SectionEnd SubSectionEnd SubSection "输出组件" output_components Section "标准输出" foo_output_std SectionIn 1 2 3 4 RO !insertmacro File ".\include\components\foo_output_std.dll" WriteINIStr "$INSTDIR\installer.ini" output output_std 1 SectionEnd Section "DirectSound v2.0" foo_out_dsound_ex SectionIn 1 2 !insertmacro File ".\include\components\foo_out_dsound_ex.dll" WriteINIStr "$INSTDIR\installer.ini" output dsound_ex 1 SectionEnd Section "Kernel Streaming" foo_out_ks SectionIn 2 !insertmacro File ".\include\components\foo_out_ks.dll" WriteINIStr "$INSTDIR\installer.ini" output ks 1 SectionEnd SubSectionEnd SubSection "常规组件" general_components Section "控制台" foo_console SectionIn 1 2 !insertmacro File ".\include\components\foo_console.dll" WriteINIStr "$INSTDIR\installer.ini" general console 1 SectionEnd Section "Http 媒体流读取" foo_read_http SectionIn 1 2 !insertmacro File ".\include\components\foo_read_http.dll" WriteINIStr "$INSTDIR\installer.ini" general read_http 1 SectionEnd Section "重放增益扫描" foo_rgscan SectionIn 1 2 !insertmacro File ".\include\components\foo_rgscan.dll" WriteINIStr "$INSTDIR\installer.ini" general rgscan 1 SectionEnd Section "专辑列表" foo_albumlist SectionIn 1 2 !insertmacro File ".\include\components\foo_albumlist.dll" WriteINIStr "$INSTDIR\installer.ini" general albumlist 1 SectionEnd Section "批量标签" foo_masstag SectionIn 1 2 !insertmacro File ".\include\components\foo_masstag.dll" WriteINIStr "$INSTDIR\installer.ini" general masstag 1 SectionEnd Section "代码页替换" foo_codepage_action SectionIn 1 2 !insertmacro File ".\include\extra\foo_codepage_action.dll" WriteINIStr "$INSTDIR\installer.ini" general codepage_action 1 SectionEnd Section "文件信息特别版" foo_infobox SectionIn 1 2 !insertmacro File ".\include\extra\foo_infobox.dll" WriteINIStr "$INSTDIR\installer.ini" general infobox 1 SectionEnd Section "乱序控制" foo_shuffle SectionIn 2 !insertmacro File ".\include\extra\foo_shuffle.dll" WriteINIStr "$INSTDIR\installer.ini" general shuffle 1 SectionEnd Section "压缩包免解压播放" foo_unpack SectionIn 2 !insertmacro File ".\include\components\foo_unpack.dll" Delete "$INSTDIR\components\foo_unpack_7z.dll" WriteINIStr "$INSTDIR\installer.ini" general unpack 1 SectionEnd Section "ID3v2 标签支持" foo_id3v2 SectionIn 2 !insertmacro File ".\include\components\foo_id3v2.dll" WriteINIStr "$INSTDIR\installer.ini" general id3v2 1 SectionEnd Section "音乐 CD 刻录" foo_burninate SectionIn 2 !insertmacro File ".\include\extra\foo_burninate.dll" WriteINIStr "$INSTDIR\installer.ini" general burninate 1 SectionEnd Section "Title formatting 随心换(foo_syfm)" foo_syfm SectionIn 2 !insertmacro File ".\include\extra\foo_syfm.dll" SetOutPath "$INSTDIR\configs" File ".\include\configs\*.fb2k" SetOutPath "$INSTDIR\components" WriteINIStr "$INSTDIR\installer.ini" general syfm 1 SectionEnd Section "freedb 批量标签" foo_freedb SectionIn 2 !insertmacro File ".\include\extra\foo_freedb.dll" SetOutPath "$INSTDIR" !insertmacro File ".\include\iconv.dll" SetOutPath "$INSTDIR\components" WriteINIStr "$INSTDIR\installer.ini" general freedb 1 SectionEnd Section "计划任务" foo_scheduler SectionIn 2 !insertmacro File ".\include\extra\foo_scheduler.dll" WriteINIStr "$INSTDIR\installer.ini" general scheduler 1 SectionEnd Section "播放列表产生程序" foo_playlistgen SectionIn 2 !insertmacro File ".\include\extra\foo_playlistgen.dll" WriteINIStr "$INSTDIR\installer.ini" general playlistgen 1 SectionEnd Section "快速标签(foo_quicktag)" foo_quicktag !insertmacro File ".\include\extra\foo_quicktag.dll" WriteINIStr "$INSTDIR\installer.ini" general quicktag 1 SectionEnd Section "CUE 扩展" foo_cue_ex !insertmacro File ".\include\extra\foo_cue_ex.dll" WriteINIStr "$INSTDIR\installer.ini" general cue_ex 1 SectionEnd Section "文件删除管理(foo_delete)" foo_delete !insertmacro File ".\include\extra\foo_delete.dll" WriteINIStr "$INSTDIR\installer.ini" general delete 1 SectionEnd Section "ABX 比较器" foo_abx !insertmacro File ".\include\extra\foo_abx.dll" WriteINIStr "$INSTDIR\installer.ini" general abx 1 SectionEnd Section "播放列表工具(foo_utils)" foo_utils !insertmacro File ".\include\extra\foo_utils.dll" WriteINIStr "$INSTDIR\installer.ini" general utils 1 SectionEnd Section "直接音量控制(Windows)" foo_dirvol Delete "$INSTDIR\components\foo_mixer" !insertmacro File ".\include\extra\foo_dirvol.dll" WriteINIStr "$INSTDIR\installer.ini" general dirvol 1 SectionEnd SubSectionEnd SubSection "数字信号处理(DSP)" dsp_components Section "标准DSP列" foo_dsp_extra SectionIn 1 2 !insertmacro File ".\include\components\foo_dsp_extra.dll" SetOutPath "$INSTDIR\Equalizer Presets" File ".\include\Equalizer Presets\*.*" SetOutPath "$INSTDIR\components" WriteINIStr "$INSTDIR\installer.ini" dsp extra 1 SectionEnd Section "SoundTouch" foo_dsp_soundtouch SectionIn 2 !insertmacro File ".\include\extra\foo_dsp_soundtouch.dll" WriteINIStr "$INSTDIR\installer.ini" dsp soundtouch 1 SectionEnd Section "音轨间暂停" foo_dsp_pause SectionIn 2 !insertmacro File ".\include\extra\foo_dsp_pause.dll" WriteINIStr "$INSTDIR\installer.ini" dsp pause 1 SectionEnd Section "回旋混响" foo_convolve SectionIn 2 !insertmacro File ".\include\extra\foo_convolve.dll" WriteINIStr "$INSTDIR\installer.ini" dsp convolve 1 SectionEnd Section "续流器" foo_dsp_continuator !insertmacro File ".\include\extra\foo_dsp_continuator.dll" WriteINIStr "$INSTDIR\installer.ini" dsp continuator 1 SectionEnd Section "PPHS 重采样" foo_pphsresample !insertmacro File ".\include\extra\foo_pphsresample.dll" WriteINIStr "$INSTDIR\installer.ini" dsp pphsresample 1 SectionEnd SubSectionEnd SubSection "格式转换" diskwriter_outputs Section "格式转换主程序" foo_diskwriter SectionIn 1 2 !insertmacro File ".\include\components\foo_diskwriter.dll" WriteINIStr "$INSTDIR\installer.ini" general diskwriter 1 SectionEnd Section "命令行编码器(CLI)" foo_clienc SectionIn 1 2 !insertmacro File ".\include\components\foo_clienc.dll" WriteINIStr "$INSTDIR\installer.ini" diskwriter clienc 1 SectionEnd Section "Vorbis 编码器" foo_vorbisenc SectionIn 2 !insertmacro File ".\include\extra\foo_vorbisenc.dll" WriteINIStr "$INSTDIR\installer.ini" diskwriter vorbisenc 1 SectionEnd Section "Monkey's Audio 编码器(MAClib v3.98)" foo_monkey SectionIn 2 !insertmacro File ".\include\extra\foo_monkey.dll" WriteINIStr "$INSTDIR\installer.ini" diskwriter monkey 1 SectionEnd Section "FAAC 编码器" foo_faac SectionIn 2 !insertmacro File ".\include\extra\foo_faac.dll" WriteINIStr "$INSTDIR\installer.ini" diskwriter faac 1 SectionEnd Section "lame.exe" lame SectionIn 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\lame.exe" WriteINIStr "$INSTDIR\installer.ini" diskwriter "lame.exe" 1 SectionEnd Section "mppenc.exe" mppenc SectionIn 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\mppenc.exe" WriteINIStr "$INSTDIR\installer.ini" diskwriter "mppenc.exe" 1 SectionEnd Section "oggenc.exe" oggenc SectionIn 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\oggenc.exe" WriteINIStr "$INSTDIR\installer.ini" diskwriter "oggenc.exe" 1 SectionEnd Section "mac.exe" mac SectionIn 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\mac.exe" WriteINIStr "$INSTDIR\installer.ini" diskwriter "mac.exe" 1 SectionEnd Section "flac.exe" flac SectionIn 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\flac.exe" WriteINIStr "$INSTDIR\installer.ini" diskwriter "flac.exe" 1 SectionEnd SubSectionEnd SubSection "可视化组件" vis_components Section "可视化管理器" foo_vis_manager SectionIn 1 2 3 4 RO SetOutPath "$INSTDIR\components" !insertmacro File ".\include\components\foo_vis_manager.dll" WriteINIStr "$INSTDIR\installer.ini" visualization vis_manager 1 SectionEnd Section "简单频谱器" foo_vis_simple_spectrum SetOutPath "$INSTDIR\components" !insertmacro File ".\include\extra\foo_vis_simple_spectrum.dll" WriteINIStr "$INSTDIR\installer.ini" visualization simple_spectrum 1 SectionEnd SubSectionEnd SubSection "小工具" tools Section "LiveUpdate" foo_liveupdate SectionIn 1 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\LiveUpdate.exe" SetOutPath "$INSTDIR\components" !insertmacro File ".\include\extra\foo_liveupdate.dll" WriteINIStr "$INSTDIR\installer.ini" foobar2000 liveupdate 1 SectionEnd Section "foobar2000 配置文件备份工具" fb2kbak SectionIn 1 2 SetOutPath "$INSTDIR" !insertmacro File ".\include\fb2kbak.exe" WriteINIStr "$INSTDIR\installer.ini" foobar2000 fb2kbak 1 SectionEnd SubSectionEnd Section "-个性化设置" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 6" "State" StrCmp $0 1 0 no_context_play WriteRegStr HKCR "Directory\shell\foobar2000.play" "" "用 foobar2000 播放" WriteRegStr HKCR "Directory\shell\foobar2000.play\command" "" '"$INSTDIR\foobar2000.exe" "%1"' WriteINIStr "$INSTDIR\installer.ini" context play 1 no_context_play: ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 7" "State" StrCmp $0 1 0 no_context_enqueue WriteRegStr HKCR "Directory\shell\foobar2000.enqueue" "" "加入 foobar2000 队列" WriteRegStr HKCR "Directory\shell\foobar2000.enqueue\command" "" '"$INSTDIR\foobar2000.exe" /add "%1"' WriteINIStr "$INSTDIR\installer.ini" context enqueue 1 no_context_enqueue: SetOutPath $INSTDIR ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 2" "State" StrCmp $0 1 0 no_shortcut_desktop CreateShortCut "$DESKTOP\foobar2000.lnk" "$INSTDIR\foobar2000.exe" WriteINIStr "$INSTDIR\installer.ini" shortcut desktop 1 no_shortcut_desktop: ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 3" "State" StrCmp $0 1 0 no_shortcut_start_menu Delete "$SMPROGRAMS\foobar2000\*.lnk" ;删除旧的快捷方式 CreateDirectory "$SMPROGRAMS\foobar2000" CreateShortCut "$SMPROGRAMS\foobar2000\foobar2000.lnk" "$INSTDIR\foobar2000.exe" CreateShortCut "$SMPROGRAMS\foobar2000\文件关联.lnk" "$INSTDIR\fooassoc.exe" CreateShortCut "$SMPROGRAMS\foobar2000\卸载.lnk" "$INSTDIR\uninstall.exe" IfFileExists "$INSTDIR\LiveUpdate.exe" 0 +2 CreateShortCut "$SMPROGRAMS\foobar2000\LiveUpdate.lnk" "$INSTDIR\LiveUpdate.exe" "/fb2k" WriteINIStr "$INSTDIR\installer.ini" shortcut start_menu 1 no_shortcut_start_menu: ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 4" "State" StrCmp $0 1 0 no_shortcut_quick_launch CreateShortCut "$QUICKLAUNCH\foobar2000.lnk" "$INSTDIR\foobar2000.exe" WriteINIStr "$INSTDIR\installer.ini" shortcut quick_launch 1 no_shortcut_quick_launch: SectionEnd Section "-post" LogSet off FlushIni "$INSTDIR\installer.ini" ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 8" "State" StrCmp $0 1 regwrite_end WriteRegStr HKCR "Applications\foobar2000.exe" "" "" WriteRegStr HKCR "Applications\foobar2000.exe\shell" "" "play" WriteRegStr HKCR "Applications\foobar2000.exe\shell\play" "" "用 foobar2000 播放" WriteRegStr HKCR "Applications\foobar2000.exe\shell\play\command" "" '"$INSTDIR\foobar2000.exe" "%1"' WriteRegStr HKCR "Applications\foobar2000.exe\shell\enqueue" "" "加入 foobar2000 队列" WriteRegStr HKCR "Applications\foobar2000.exe\shell\enqueue\command" "" '"$INSTDIR\foobar2000.exe" /add "%1"' WriteRegStr HKCU "Software\foobar2000" "InstallDir" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "DisplayName" "foobar2000 汉化增强版 v${VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "DisplayIcon" '"$INSTDIR\foobar2000.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "InstallDir" "$INSTDIR" ;汉化版单独路径,英文版无 WriteUninstaller "$INSTDIR\uninstall.exe" regwrite_end: IfSilent wma_chk_end SectionGetFlags ${foo_wma} $0 IntOp $0 $0 & 1 StrCmp $0 0 wma_chk_end GetDllVersion "$SYSDIR\wmvcore.dll" $0 $1 IntOp $0 $0 / 0x00010000 IntCmp $0 9 wma_chk_end 0 wma_chk_end ;检测 WMP 版本必须大于等于9 MessageBox MB_YESNO|MB_ICONINFORMATION "你选择安装的 WMA 解码器组件(foo_wma.dll)需要 Windows Media Format 9 运行时库。安装程序检测到你没有安装 Windows Media Player 9,按“是”下 载Windows Media Format 9运时行库$\r$\n按“否”跳过下载。" IDNO wma_chk_end !insertmacro dl "wmfdist.exe" "$TEMP" ExecWait "$TEMP\wmfdist.exe" Delete "$TEMP\wmfdist.exe" wma_chk_end: IfSilent msvcp_chk_end SectionGetFlags ${foo_id3v2} $0 IntOp $0 $0 & 1 StrCmp $0 0 msvcp_chk_end ;检查 MSVCP60 运行库 IfFileExists "$SYSDIR\msvcp60.dll" msvcp_chk_end IfFileExists "$WINDIR\msvcp60.dll" msvcp_chk_end MessageBox MB_YESNO|MB_ICONINFORMATION "至少有一个已经安装的组件需要 MSVCP60 运行库$\r$\n现在下载?" IDNO msvcp_chk_end !insertmacro dl "msvcp60.dll" "$SYSDIR" msvcp_chk_end: ;移除foo_mp4,已并入标准输入中 Delete "$INSTDIR\components\foo_mp4.dll" ;文件关联部分 ReadINIStr $0 "$PLUGINSDIR\io.ini" "Field 8" "State" StrCmp $0 1 assoc_end HideWindow SetOutPath "$INSTDIR" IfSilent +3 ExecWait "$INSTDIR\fooassoc.exe" Goto +2 ExecWait '"$INSTDIR\fooassoc.exe" /S' BringToFront assoc_end: SectionEnd ; -------------------------------------- Function .onInit System::Call 'kernel32::CreateMutexA(i 0, i 0, t "foobar2000") i .r1 ?e' Pop $0 StrCmp $0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "安装程序已经在运行" Quit Call Chk3721 InitPluginsDir File /oname=$PLUGINSDIR\io.ini ".\resource\io.ini" File /oname=$PLUGINSDIR\07x.ico ".\resource\07x.ico" File /oname=$PLUGINSDIR\08x.ico ".\resource\08x.ico" File /oname=$PLUGINSDIR\ui1.bmp ".\resource\ui1.bmp" File /oname=$PLUGINSDIR\ui2.bmp ".\resource\ui2.bmp" File /oname=$PLUGINSDIR\ui3.bmp ".\resource\ui3.bmp" WriteINIStr "$PLUGINSDIR\io.ini" "Field 12" "Text" "$PLUGINSDIR\08x.ico" WriteINIStr "$PLUGINSDIR\io.ini" "Field 13" "Text" "$PLUGINSDIR\07x.ico" WriteINIStr "$PLUGINSDIR\io.ini" "Field 18" "Text" "$PLUGINSDIR\ui1.bmp" ReadRegStr $R0 HKCU "Software\foobar2000" InstallDir StrCmp $R0 "" skip_ini 0 IfFileExists "$R0\installer.ini" 0 skip_ini ;查找以前安装的组件 ;用户界面 !insertmacro CheckSection ${foo_ui_columns} ui columns !insertmacro CheckSection ${foo_tunes} ui tunes ; 输入 !insertmacro CheckSection ${foo_cdda} input cdda !insertmacro CheckSection ${foo_flac} input flac !insertmacro CheckSection ${foo_ape} input ape !insertmacro CheckSection ${foo_wavpack} input wavpack !insertmacro CheckSection ${foo_shn} input shn !insertmacro CheckSection ${foo_speex} input speex !insertmacro CheckSection ${foo_mod} input mod !insertmacro CheckSection ${foo_spc} input spc !insertmacro CheckSection ${foo_wma} input wma !insertmacro CheckSection ${foo_ac3} input ac3 !insertmacro CheckSection ${foo_nez} input nez !insertmacro CheckSection ${foo_matroska} input matroska !insertmacro CheckSection ${foo_mad} input mad !insertmacro CheckSection ${foo_tta} input tta !insertmacro CheckSection ${foo_ofr} input ofr ; 输出 !insertmacro CheckSection ${foo_out_dsound_ex} output dsound_ex !insertmacro CheckSection ${foo_out_ks} output ks ; 常规 !insertmacro CheckSection ${foo_console} general console !insertmacro CheckSection ${foo_read_http} general read_http !insertmacro CheckSection ${foo_rgscan} general rgscan !insertmacro CheckSection ${foo_diskwriter} general diskwriter !insertmacro CheckSection ${foo_albumlist} general albumlist !insertmacro CheckSection ${foo_masstag} general masstag !insertmacro CheckSection ${foo_codepage_action} general codepage_action !insertmacro CheckSection ${foo_infobox} general infobox !insertmacro CheckSection ${foo_shuffle} general shuffle !insertmacro CheckSection ${foo_unpack} general unpack !insertmacro CheckSection ${foo_id3v2} general id3v2 !insertmacro CheckSection ${foo_burninate} general burninate !insertmacro CheckSection ${foo_syfm} general syfm !insertmacro CheckSection ${foo_freedb} general freedb !insertmacro CheckSection ${foo_scheduler} general scheduler !insertmacro CheckSection ${foo_dirvol} general dirvol !insertmacro CheckSection ${foo_playlistgen} general playlistgen !insertmacro CheckSection ${foo_quicktag} general quicktag !insertmacro CheckSection ${foo_delete} general delete !insertmacro CheckSection ${foo_cue_ex} general cue_ex !insertmacro CheckSection ${foo_abx} general abx !insertmacro CheckSection ${foo_utils} general utils ; DSP !insertmacro CheckSection ${foo_dsp_extra} dsp extra !insertmacro CheckSection ${foo_dsp_soundtouch} dsp soundtouch !insertmacro CheckSection ${foo_dsp_pause} dsp pause !insertmacro CheckSection ${foo_convolve} dsp convolve !insertmacro CheckSection ${foo_dsp_continuator} dsp continuator !insertmacro CheckSection ${foo_pphsresample} dsp pphsresample ; Diskwriter 输出 !insertmacro CheckSection ${foo_vorbisenc} diskwriter vorbisenc !insertmacro CheckSection ${foo_monkey} diskwriter monkey !insertmacro CheckSection ${foo_clienc} diskwriter clienc !insertmacro CheckSection ${foo_faac} diskwriter faac !insertmacro CheckSection ${lame} diskwriter lame.exe !insertmacro CheckSection ${mppenc} diskwriter mppenc.exe !insertmacro CheckSection ${oggenc} diskwriter oggenc.exe !insertmacro CheckSection ${mac} diskwriter mac.exe !insertmacro CheckSection ${flac} diskwriter flac.exe ; 可视化 !insertmacro CheckSection ${foo_vis_simple_spectrum} visualization simple_spectrum ; 配置文件 !insertmacro CheckSection ${foocfg} foobar2000 cfg ; LiveUpdate !insertmacro CheckSection ${foo_liveupdate} foobar2000 liveupdate !insertmacro CheckSection ${fb2kbak} foobar2000 fb2kbak ; 上下文菜单 ReadINIStr $0 "$R0\installer.ini" context play WriteINIStr "$PLUGINSDIR\io.ini" "Field 6" "State" "$0" ReadINIStr $0 "$R0\installer.ini" context enqueue WriteINIStr "$PLUGINSDIR\io.ini" "Field 7" "State" "$0" ; 快捷方式 ReadINIStr $0 "$R0\installer.ini" shortcut desktop WriteINIStr "$PLUGINSDIR\io.ini" "Field 2" "State" "$0" ReadINIStr $0 "$R0\installer.ini" shortcut start_menu WriteINIStr "$PLUGINSDIR\io.ini" "Field 3" "State" "$0" ReadINIStr $0 "$R0\installer.ini" shortcut quick_launch WriteINIStr "$PLUGINSDIR\io.ini" "Field 4" "State" "$0" SetCurInstType 3 Goto ini_end skip_ini: InstTypeSetText 3 "" ini_end: ; 9X和NT系统下移除 foo_out_ks ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion StrCpy $R0 $R0 1 IntCmp $R0 5 keep_ks 0 keep_ks !insertmacro ClearSectionInInstType ${foo_out_ks} 15 SectionSetText ${foo_out_ks} "" keep_ks: ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion StrCpy $1 $0 1 2 StrCpy $0 $0 1 StrCpy $0 $0$1 IntCmp $0 50 0 0 keep_tunes SectionSetFlags ${foo_tunes} 0 SectionSetInstTypes ${foo_tunes} 0 SectionSetText ${foo_tunes} "" keep_tunes: FunctionEnd ; -------------------------------------- Function .onSelChange SectionGetFlags ${foo_diskwriter} $R0 IntOp $R0 $R0 & 1 StrCmp $R0 0 0 have_diskwrtier ;不选 diskwrtier 组件时清除下列项 !insertmacro UnselectSection ${foo_vorbisenc} !insertmacro UnselectSection ${foo_monkey} !insertmacro UnselectSection ${foo_clienc} !insertmacro UnselectSection ${foo_faac} !insertmacro UnselectSection ${lame} !insertmacro UnselectSection ${mppenc} !insertmacro UnselectSection ${oggenc} !insertmacro UnselectSection ${mac} !insertmacro UnselectSection ${flac} have_diskwrtier: SectionGetFlags ${foo_clienc} $R0 IntOp $R0 $R0 & 1 StrCmp $R0 0 0 have_clienc ;不选 foo_clienc 组件时清除下列项 !insertmacro UnselectSection ${lame} !insertmacro UnselectSection ${mppenc} !insertmacro UnselectSection ${mac} !insertmacro UnselectSection ${flac} have_clienc: SectionGetFlags ${foo_vorbisenc} $R0 SectionGetFlags ${foo_clienc} $R1 IntOp $R0 $R0 | $R1 IntOp $R0 $R0 & 1 StrCmp $R0 0 0 have_vorbisenc ;都不选 foo_clienc、foo_vorbisenc 组件时清除下列项 !insertmacro UnselectSection ${oggenc} have_vorbisenc: SectionGetFlags ${foo_masstag} $R0 IntOp $R0 $R0 & 1 StrCmp $R0 0 0 have_masstag ;不选 foo_masstag 组件时清除下列项 !insertmacro UnselectSection ${foo_codepage_action} have_masstag: FunctionEnd ; -------------------------------------- !define LR_LOADFROMFILE 0x0010 !define LR_CREATEDIBSECTION 0x2000 !define BM_SETCHECK 0x00F1 !macro ShowImage CTRL_ID IMG_NAME Push $1 GetDlgItem $1 $HWND ${CTRL_ID} System::Call 'user32::LoadImageA(i, t, i, i, i, i) i (0, s, 0, 0, 0, ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) .R1' "${IMG_NAME}" SendMessage $1 370 0 $R1 System::Call "gdi32::DeleteObject(i) i (R1)" Pop $1 !macroend Function SetCustom ;禁止上一步按钮 ;GetDlgItem $R0 $HWNDPARENT 3 ;EnableWindow $R0 0 InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\io.ini" Pop $HWND ;获取句柄 !insertmacro MUI_HEADER_TEXT "选择个性化选项" "选定你想要的选项,取消你不想要的选项。$_CLICK" ;如果没有选择配置文件则禁止选择初始界面 SectionGetFlags ${foocfg} $R0 StrCmp $R0 0 0 columns GetDlgItem $R1 $HWND 1214 ;SendMessage $R1 ${BM_SETCHECK} 0 0 EnableWindow $R1 0 GetDlgItem $R1 $HWND 1215 EnableWindow $R1 0 GetDlgItem $R1 $HWND 1216 EnableWindow $R1 0 GetDlgItem $R1 $HWND 1217 SendMessage $R1 ${WM_CLOSE} 0 0 Goto face_end columns: SectionGetFlags ${foo_ui_columns} $R0 StrCmp $R0 0 0 tunes GetDlgItem $R1 $HWND 1215 EnableWindow $R1 0 tunes: SectionGetFlags ${foo_tunes} $R0 StrCmp $R0 0 0 face_end GetDlgItem $R1 $HWND 1216 EnableWindow $R1 0 face_end: InstallOptions::show FunctionEnd ; -------------------------------------- Function LeaveCustom ReadINIStr $R0 $PLUGINSDIR\io.ini Settings State StrCmp $R0 0 validate StrCmp $R0 8 checkbox StrCmp $R0 15 ui1 StrCmp $R0 16 ui2 StrCmp $R0 17 ui3 Abort ;选择绿色安装时禁止下列控件 checkbox: ReadINIStr $R0 "$PLUGINSDIR\io.ini" "Field 8" "State" StrCmp $R0 1 0 +3 StrCpy $R0 0 Goto +2 StrCpy $R0 1 GetDlgItem $R1 $HWND 1201 SendMessage $R1 ${BM_SETCHECK} $R0 0 EnableWindow $R1 $R0 GetDlgItem $R1 $HWND 1202 SendMessage $R1 ${BM_SETCHECK} $R0 0 EnableWindow $R1 $R0 GetDlgItem $R1 $HWND 1203 SendMessage $R1 ${BM_SETCHECK} $R0 0 EnableWindow $R1 $R0 GetDlgItem $R1 $HWND 1205 SendMessage $R1 ${BM_SETCHECK} $R0 0 EnableWindow $R1 $R0 GetDlgItem $R1 $HWND 1206 SendMessage $R1 ${BM_SETCHECK} $R0 0 EnableWindow $R1 $R0 Abort ui1: ;默认界面 !insertmacro ShowImage 1217 $PLUGINSDIR\ui1.bmp Abort ui2: ;Columns UI !insertmacro ShowImage 1217 $PLUGINSDIR\ui2.bmp Abort ui3: ;fooTunes !insertmacro ShowImage 1217 $PLUGINSDIR\ui3.bmp Abort validate: FunctionEnd ; -------------------------------------- ; 卸载段 ; -------------------------------------- Section Uninstall Call un.Restore DeleteRegKey HKCR "foobar2000.File" DeleteRegKey HKCR "foobar2000.m3u" DeleteRegKey HKCR "foobar2000.cue" DeleteRegKey HKCR "Directory\shell\foobar2000.play" DeleteRegKey HKCR "Directory\shell\foobar2000.enqueue" DeleteRegKey HKCR "Applications\foobar2000.exe" DeleteRegKey HKCU "Software\foobar2000" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" Push $INSTDIR\install.log Call un.DelFile IfFileExists $INSTDIR\install2.log 0 +3 Push $INSTDIR\install2.log Call un.DelFile Delete "$INSTDIR\install.log" Delete "$INSTDIR\install2.log" Delete "$INSTDIR\failure*.txt" Delete "$INSTDIR\database.foo" Delete "$INSTDIR\uninstall.exe" RMDir "$SMPROGRAMS\foobar2000" ;fooTunes RMDir $INSTDIR\components\tunes Delete $INSTDIR\components\tunes\foo_tunes.cfg.Content_* Delete $INSTDIR\components\foo_columns.ini RMDir /r "$INSTDIR\playlists" RMDir "$INSTDIR\icons" RMDir "$INSTDIR\Equalizer Presets" RMDir "$INSTDIR\configs" RMDir "$INSTDIR\components" RMDir "$INSTDIR" Call un.RefreshShellIcons SectionEnd ; -------------------------------------- ; 描述 ; -------------------------------------- !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${foobar2000} "foobar2000 和必须的组件以及相关的文档。" !insertmacro MUI_DESCRIPTION_TEXT ${user_interface} "用户界面。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_ui_std} "默认用户界面。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_ui_columns} "分栏形式的界面。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_tunes} "带资源管理器的界面。" !insertmacro MUI_DESCRIPTION_TEXT ${input_components} "支持回放的输入组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_input_std} "标准输入列。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_cdda} "音乐 CD 回放。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_flac} "FLAC 解码器(Free Lossless Audio Codec)。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_ape} "解码 Monkey's Audio 无损格式。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_wavpack} "解码 WavPack 无损格式。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_mod} "回放支持大多数大部分公共音轨 Module 格式。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_spc} "SNES 音乐回放支持。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_speex} "解码 Speex 语音文件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_wma} "Windows Media Audio 回放,需要 Windows Media 运行库 9 或更新的。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_ac3} "解码 AC3 音频。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_nez} "NEZplug 组件,支持 NSF,KSS,GBR,GBS,HES 和 AY 文件的播放。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_matroska} "播放用 Matroska 方式封装的音频文件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_mad} "基于 libmad-0.15.1b 的 MP3、MP2 解码器。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_tta} "TTA 无损音频解码器http://tta.corecodec.org/" !insertmacro MUI_DESCRIPTION_TEXT ${foo_shn} "Shorten 格式输入插件" !insertmacro MUI_DESCRIPTION_TEXT ${output_components} "输出组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_output_std} "标准输出。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_out_dsound_ex} "DirectSound 定位、暂停、停止时淡入淡出。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_out_ks} "实验性的 WDM 内核音频流支持。" !insertmacro MUI_DESCRIPTION_TEXT ${general_components} "常规组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_console} "察看错误,显示警告和其他信息的窗口。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_read_http} "HTTP 音频流支持。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_rgscan} "重放增益扫描,调整音量的匹配。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_diskwriter} "Diskwriter 写入 WAV 文件(或者在加入额外的组件后支持的格式)。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_albumlist} "以自定义的树形格式察看处理专辑。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_masstag} "允许快速编辑标签和文件更名。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_infobox} "更直观的文件信息查看、标签编辑,在不更改系统代码页的情况下使用指定的代码显示文件标签。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_shuffle} "使用播放历史纪录进行灵活的乱序播放控制。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_unpack} "增加直接在 ZIP, RAR, 7-ZIP and GZIP 压缩包中播放文件的支持。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_id3v2} "读、写 ID3v2 标签支持。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_syfm} "可以方便的更换 Title formatting。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_freedb} "对任何格式文件(mp3, mpc, flac, ... - 不仅仅CD音轨)从 freedb 服务器获取标签。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_burninate} "刻录音乐 CD,需要安装有 Nero Burning Rom。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_scheduler} "提供各种计划任务实现开始、停止、关闭系统等功能。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_dirvol} "提供对 Windows 混音器的直接音量控制。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_codepage_action} "通过转换代码页使用指定的代码页察看文件标签,并可以把繁体字形转换为简体字形。查看繁体 ANSI BIG5 码标签必备。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_playlistgen} "根据数据库的查询结果并以之产生新的播放列表。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_quicktag} "快速的给文件打上标签。你可以把常用的标签保存并在播放列表右键菜单里使用。常用于给歌曲打星级,配合定制的 Titlefornatting 可以在播放列表里显示自己对歌曲评定的级别。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_delete} "直接从硬盘上删除歌曲文件而不通过回收站,删除前有对话框提示。慎用!并请自行承担使用风险。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_cue_ex} "foobar2000 内置的 CUE 读取、写入功能仅能保存标准的元数据段比如 %title%、%album% 等,对于如增益信息这样的元数据就无能为力了。扩展的 CUE 插件可以读取、写入这些扩展信息。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_abx} "盲听测试的 ABX 组件" !insertmacro MUI_DESCRIPTION_TEXT ${foo_utils} "播放列表工具,包括剪切、复制、粘贴、插入、收集音轨等,还有查找命令功能,并且每个操作都可以撤销、重做" !insertmacro MUI_DESCRIPTION_TEXT ${dsp_components} "DSP 组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_dsp_extra} "均衡器,重采样,高级限制,硬件限制,立体声转4声道和其他的一些 DSP。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_dsp_soundtouch} "SoundTouch 改变播放速度、音调等。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_dsp_pause} "在文件之间添加用户定义的暂停时间,向MD录音时非常有用。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_convolve} "通过载入脉冲文件模拟诸如真空管、胆机等,占用资源大。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_dsp_continuator} "在更换歌曲时提供淡出、重叠等处理。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_pphsresample} "快速和高质量的多相重采样器" !insertmacro MUI_DESCRIPTION_TEXT ${diskwriter_outputs} "diskwriter的额外组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_vorbisenc} "编码免费的、开放的 Vorbis 格式。使用 foobar 目录下的 oggenc.exe。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_monkey} "Monkey's Audio 编码器,使用 MAClib3.99。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_clienc} "支持任何使用命令行的编码器。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_faac} "MPEG-4 AAC 编码器,使用 libfaac 1.24.可写入 .AAC, .MP4 和 .M4A 文件。" !insertmacro MUI_DESCRIPTION_TEXT ${lame} 'LAME version 3.90.3 MMX (http://www.mp3dev.org/)' !insertmacro MUI_DESCRIPTION_TEXT ${mppenc} 'MPC Encoder 1.14 -Beta- (C) 1999-2002 Buschmann/Klemm/Piecha。' !insertmacro MUI_DESCRIPTION_TEXT ${oggenc} 'OggEnc v1.0.1 (libvorbis 1.0.1) (c) 2000-2003 Michael Smith 。' !insertmacro MUI_DESCRIPTION_TEXT ${mac} "Monkey's Audio Console Front End (v 3.97) (c) Matthew T. Ashland。" !insertmacro MUI_DESCRIPTION_TEXT ${flac} 'FLAC encoderversion 1.1.0 Copyright (C) 2000,2001,2002,2003 Josh Coalson。' !insertmacro MUI_DESCRIPTION_TEXT ${foocfg} "为了避免面对白花花空荡荡的界面无从下手的尴尬,这里有一个简单的界面包含在现成的配置文件里。如果选择则目标文件 foobar2000.cfg 会被覆盖。如果你需要保留以前的配置请不要选择此项。" !insertmacro MUI_DESCRIPTION_TEXT ${vis_components} "可视化组件。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_vis_manager} "可视化组件总管。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_vis_simple_spectrum} "可以简单的辨别无损音频和低码率有损音频。" !insertmacro MUI_DESCRIPTION_TEXT ${tools} "一些实用的小工具。" !insertmacro MUI_DESCRIPTION_TEXT ${foo_liveupdate} "实时在线更新程序,用于及时的修正汉化版的小错误。试验中..." !insertmacro MUI_DESCRIPTION_TEXT ${fb2kbak} "专门备份 foobar2000.cfg 的工具,命令行加参数 /S 静默运行,命令行加参数 /? 查看有效参数。建议和计划任务插件配合使用。" !insertmacro MUI_FUNCTION_DESCRIPTION_END
引用 fooassoc.nsi 的内容:
;************************************************************ ;脚本编写: 蓝色网际 ;我的脚本里使用了修改的语言文件,你需要按照如下步骤设置: ;打开 ${NSISDIR}\Contrib\Modern UI\Language files ;找到要插入的语言文件,一般为 SimpChinese.nsh ;用记事本打开后把 !define 全部替换为 !insertmacro MUI_DEFAULT ;说明: 这样替换后不会有任何影响,好处是可以避免某些命令重复使用,比如 LangString ;某些使用了 LogSet 指令的脚本需要使用特别版的 makensis.exe 才能通过编译 ;地址: http://prdownloads.sourceforge.net/nsis/makensis20_log.zip?download ;************************************************************ Name "foobar2000文件关联" SetCompressor lzma CRCCheck off InstallColors /windows AutoCloseWindow true ShowInstDetails nevershow SilentInstall normal BrandingText "foobar2000 文件关联" SpaceTexts "none" Caption "foobar2000 文件关联" SubCaption 1 " " InstallButtonText "确定" ComponentText "选中你需要关联的文件格式,取消你不想要的文件格式,点确定应用设置。" "关联 foobar2000 为:" "----------------------" OutFile ".\include\fooassoc.exe" !include "Sections.nsh" !include "MUI.nsh" ; -------------------------------------- !define MUI_ICON ".\resource\ico-assoc.ico" !define MUI_HEADERIMAGE ;!define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_BITMAP .\resource\header-foobar.bmp !define MUI_TEXT_COMPONENTS_TITLE "设置关联器" !define MUI_TEXT_COMPONENTS_SUBTITLE "选择 foobar2000 需要关联的音频格式." !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_LANGUAGE "SimpChinese" ChangeUI IDD_SELCOM ".\resource\myui_nodesc.exe" !macro assoc ext desc keyword ico type Push $0 Push $1 !define line ${__LINE__} ReadRegStr $0 HKCR ".${ext}" "" ;备份关联 StrCpy $1 $0 10 StrCmp $1 foobar2000 +2 ;如果当前关联为 foobar2000 ,跳过备份 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "bckup_${ext}" "$0" StrCmp "${type}" "" +3 ;如果没指定文件类型则新建一个文件类型 StrCpy $1 "${type}" Goto +2 StrCpy $1 "${ext}" DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.${ext}" WriteRegStr HKCR ".${ext}" "" "foobar2000.$1" WriteRegStr HKCR foobar2000.$1 "" "${desc}" ;写入注册表 WriteRegStr HKCR foobar2000.$1\shell "" play WriteRegStr HKCR foobar2000.$1\shell\play "" "用 foobar2000 播放" WriteRegStr HKCR foobar2000.$1\shell\play\command "" '"$EXEDIR\foobar2000.exe" "%1"' WriteRegStr HKCR foobar2000.$1\shell\open "" "用 foobar2000 打开" ;弱智的 FlashGet 只认得 open 键 WriteRegStr HKCR foobar2000.$1\shell\open\command "" '"$EXEDIR\foobar2000.exe" "%1"' WriteRegStr HKCR foobar2000.$1\shell\enqueue "" "加入 foobar2000 队列" WriteRegStr HKCR foobar2000.$1\shell\enqueue\command "" '"$EXEDIR\foobar2000.exe" /add "%1"' IfFileExists "$EXEDIR\icons\${ico}" 0 default_icon_${line} ;如果指定图标不存在则使用默认图标 WriteRegStr HKCR foobar2000.$1\DefaultIcon "" "$EXEDIR\icons\${ico}" ReadINIStr $0 "$EXEDIR\fooassoc.txt" Icon ${keyword} ;读取 fooassoc.txt 的设定 StrCmp $0 "" custom_icon_end_${line} ;如果没指定则跳过 IfFileExists "$EXEDIR\icons\$0" 0 default_icon_${line} ;如果指定图标不存在则使用默认图标 WriteRegStr HKCR foobar2000.$1\DefaultIcon "" "$EXEDIR\icons\$0" Goto custom_icon_end_${line} default_icon_${line}: IfFileExists "$EXEDIR\icons\generic.ico" 0 +3 WriteRegStr HKCR foobar2000.$1\DefaultIcon "" "$EXEDIR\icons\generic.ico" Goto +2 WriteRegStr HKCR foobar2000.$1\DefaultIcon "" "$EXEDIR\foobar2000.exe,0" custom_icon_end_${line}: !undef line Pop $1 Pop $0 !macroend !macro CheckSection SECTION_NAME EXT Push $0 ReadRegStr $0 HKCR ".${EXT}" "" StrCpy $0 $0 10 StrCmp $0 "foobar2000" 0 +5 SectionGetInstTypes "${SECTION_NAME}" $0 IntOp $0 $0 | 1 SectionSetInstTypes "${SECTION_NAME}" $0 Goto +4 SectionGetInstTypes "${SECTION_NAME}" $0 IntOp $0 $0 & 6 SectionSetInstTypes "${SECTION_NAME}" $0 Pop $0 !macroend ; -------------------------------------- Function AssocAudioCD Push $1 ReadRegStr $1 HKCR "AudioCD\shell\play\command" "" StrCmp $1 '"$EXEDIR\foobar2000.exe" "%1"' +2 0 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "bckupAudioCD" "$1" WriteRegStr HKCR "AudioCD\shell\play\command" "" '"$EXEDIR\foobar2000.exe" "%1"' Pop $1 FunctionEnd ; -------------------------------------- Function Restore Push $R0 Push $R1 Push $R2 Push $R3 Push $R4 StrCpy $R0 0 ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" "bckupAudioCD" StrCmp $R3 "" loop ReadRegStr $R2 HKCR "AudioCD\shell\play\command" "" StrCpy $R2 $R2 "" -20 StrCmp $R2 'foobar2000.exe" "%1"' 0 no_cd_restore WriteRegStr HKCR "AudioCD\shell\play\command" "" "$R3" Goto loop no_cd_restore: loop: EnumRegValue $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" $R0 ReadRegStr $R3 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\foobar2000" $R1 StrCmp $R1 "" loop_quit StrCpy $R2 $R1 6 StrCmp $R2 "bckup_" 0 cont_restore ;检测前缀 StrCpy $R1 $R1 "" 6 ;$R1 = 扩展名 $R3 = 备份的文件类型 StrCpy $R2 $R3 10 StrCmp $R2 "foobar2000" +2 ;检测当前的关联是否 fb2k StrCmp $R3 "" 0 restore ;如果备份的是空值则直接删除 DeleteRegKey HKCR ".$R1" DeleteRegKey HKCR "foobar2000.$R1" Goto cont_restore restore: ReadRegStr $R4 HKCR ".$R1" "" StrCpy $R2 $R4 10 StrCmp $R2 "foobar2000" 0 no_restore ;检测当前的关联是否 fb2k WriteRegStr HKCR ".$R1" "" "$R3" DeleteRegKey HKCR "foobar2000.$R1" Goto cont_restore no_restore: cont_restore: IntOp $R0 $R0 + 1 Goto loop loop_quit: Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 FunctionEnd ; -------------------------------------- InstType "推荐关联格式" InstType "所有支持的格式" InstType "无任何格式关联" Section "" Call Restore WriteRegStr HKCR "foobar2000.File" "" "foobar2000 音频文件" SectionEnd SubSection "播放列表" Section ".FPL" fpl SectionIn 1 2 !insertmacro assoc fpl "播放列表(fpl)" fpl fpl.ico "" WriteRegDWORD HKCR "foobar2000.fpl" EditFlags 65536 SectionEnd Section ".M3U8" m3u8 SectionIn 1 2 !insertmacro assoc m3u8 "播放列表(m3u8)" m3u8 m3u8.ico "" WriteRegDWORD HKCR "foobar2000.m3u8" EditFlags 65536 SectionEnd Section ".M3U" m3u SectionIn 1 2 !insertmacro assoc m3u "播放列表(m3u)" m3u m3u.ico "" WriteRegDWORD HKCR "foobar2000.m3u" EditFlags 65536 SectionEnd Section ".PLS" pls SectionIn 1 2 !insertmacro assoc pls "播放列表(pls)" pls pls.ico "" WriteRegDWORD HKCR "foobar2000.pls" EditFlags 65536 SectionEnd SubSectionEnd SubSection "未压缩格式" Section "WAV" wav SectionIn 1 2 !insertmacro assoc wav "波形文件" wav wav.ico "" SectionEnd Section "AIFF" aiff SectionIn 1 2 !insertmacro assoc aiff "未压缩音频(aiff)" aiff generic.ico aiff SectionEnd Section "AIF" aif SectionIn 1 2 !insertmacro assoc aif "未压缩音频(aiff)" aiff generic.ico aiff SectionEnd Section "IFF" iff SectionIn 1 2 !insertmacro assoc iff "未压缩音频(aiff)" aiff generic.ico aiff SectionEnd Section "SVX" svx SectionIn 1 2 !insertmacro assoc svx "未压缩音频(svx)" svx generic.ico "" SectionEnd Section "SND" snd SectionIn 1 2 !insertmacro assoc snd "未压缩音频(snd)" snd generic.ico "" SectionEnd Section "AU" au SectionIn 1 2 !insertmacro assoc au "未压缩音频(au)" au generic.ico "" SectionEnd Section "VOC" voc SectionIn 1 2 !insertmacro assoc voc "未压缩音频(voc)" voc generic.ico "" SectionEnd SubSectionEnd SubSection "Matroska" sub_matroska Section ".MKA" mka SectionIn 2 !insertmacro assoc mka "Matroska音频" mka mka.ico "" SectionEnd SubSectionEnd Section "Cue sheet" cue SectionIn 2 !insertmacro assoc cue "Cue sheet" cue cue.ico "" SectionEnd Section "APL" apl SectionIn 2 !insertmacro assoc apl "Monkey's Audio映像连接文件" apl apl.ico "" SectionEnd Section "OGG" ogg SectionIn 1 2 !insertmacro assoc ogg "Ogg音频" ogg ogg.ico "" SectionEnd SubSection "Musepack" Section ".MPC" mpc SectionIn 1 2 !insertmacro assoc mpc "Musepack 音频" mpc mpc.ico mpc SectionEnd Section ".MP+" mp+ SectionIn 1 2 !insertmacro assoc mp+ "Musepack 音频" mpc mpc.ico mpc SectionEnd Section ".MPP" mpp SectionIn 1 2 !insertmacro assoc mpp "Musepack 音频" mpc mpc.ico mpc SectionEnd SubSectionEnd SubSection "MPEG-1音频" Section ".MP3" mp3 SectionIn 1 2 !insertmacro assoc mp3 "MPEG-1 音频(mp3)" mp3 mp3.ico "" SectionEnd Section ".MP2" mp2 SectionIn 1 2 !insertmacro assoc mp2 "MPEG-1 音频(mp3)" mp2 mp2.ico "" SectionEnd SubSectionEnd SubSection "MPEG-4音频" Section "MP4" mp4 SectionIn 1 2 !insertmacro assoc mp4 "MPEG-4 音频" mp4 mp4.ico mp4 SectionEnd Section "M4A" m4a SectionIn 1 2 !insertmacro assoc m4a "MPEG-4 音频" mp4 mp4.ico mp4 SectionEnd Section "AAC" aac SectionIn 1 2 !insertmacro assoc aac "高级音频多媒体数字信号编码" aac aac.ico "" SectionEnd SubSectionEnd SubSection "FLAC 无损音频" sub_flac Section ".FLAC" flac SectionIn 1 2 !insertmacro assoc flac "FLAC 音频" flac flac.ico flac SectionEnd Section ".FLA" fla SectionIn 1 2 !insertmacro assoc fla "FLAC 音频" flac flac.ico flac SectionEnd SubSectionEnd SubSection "Monkey's Audio 无损音频" sub_ape Section ".APE" ape SectionIn 1 2 !insertmacro assoc ape "Monkey's Audio" ape "ape.ico" ape SectionEnd Section ".MAC" mac SectionIn 1 2 !insertmacro assoc mac "Monkey's Audio" ape "ape.ico" ape SectionEnd SubSectionEnd Section "TTA 无损音频" tta SectionIn 2 !insertmacro assoc tta "TTA 无损音频" tta tta.ico "" SectionEnd Section "WavPack" wv SectionIn 2 !insertmacro assoc wv "WavPack 音频" wv wv.ico "" SectionEnd SubSection "Shorten" sub_shn Section ".SHN" shn SectionIn 2 !insertmacro assoc shn "Shorten 音频" shn shn.ico "" SectionEnd SubSectionEnd SubSection "OptimFROG" sub_ofr Section ".OFR" ofr SectionIn 2 !insertmacro assoc ofr "OptimFROG 音频" ofr ofr.ico ofr SectionEnd Section ".OFS" ofs SectionIn 2 !insertmacro assoc ofs "OptimFROG 音频" ofr ofr.ico ofr SectionEnd SubSectionEnd SubSection "LA - 无损音频" sub_la Section ".LA" la SectionIn 2 !insertmacro assoc la "LA - 无损音频" la la.ico "" SectionEnd SubSectionEnd SubSection "LPAC" sub_lpac Section ".PAC" pac SectionIn 2 !insertmacro assoc pac "LPAC 音频" pac pac.ico "" SectionEnd SubSectionEnd SubSection "Speex" sub_spx Section ".SPX" spx SectionIn 2 !insertmacro assoc spx "Speex 音频" spx spx.ico "" SectionEnd SubSectionEnd Section "WMA" wma SectionIn 2 !insertmacro assoc wma "Windows 媒体音频" wma wma.ico "" SectionEnd Section "AC3" ac3 SectionIn 2 !insertmacro assoc ac3 "DVD 音频(AC3)" ac3 ac3.ico "" SectionEnd SubSection "模块音频" sub_mod Section ".XM" xm SectionIn 2 !insertmacro assoc xm "模块音频(xm)" xm xm.ico "" SectionEnd Section ".IT" it SectionIn 2 !insertmacro assoc it "模块音频(it)" it it.ico "" SectionEnd Section ".S3M" s3m SectionIn 2 !insertmacro assoc s3m "模块音频(s3m)" s3m s3m.ico "" SectionEnd Section ".MOD" mod SectionIn 2 !insertmacro assoc mod "模块音频(mod)" mod mod.ico "" SectionEnd Section ".MTM" mtm SectionIn 2 !insertmacro assoc mtm "模块音频(mtm)" mod mod.ico "" SectionEnd Section ".UMX" umx SectionIn 2 !insertmacro assoc umx "模块音频(umx)" mod mod.ico "" SectionEnd SubSectionEnd SubSection "压缩模块音频" sub_c_mod Section ".MDZ" mdz SectionIn 2 !insertmacro assoc mdz "压缩模块音频(mdz)" mod mod.ico "" SectionEnd Section ".S3Z" s3z SectionIn 2 !insertmacro assoc s3z "压缩模块音频(s3z)" mod mod.ico "" SectionEnd Section ".ITZ" itz SectionIn 2 !insertmacro assoc itz "压缩模块音频(itz)" mod mod.ico "" SectionEnd Section ".XMZ" xmz SectionIn 2 !insertmacro assoc xmz "压缩模块音频(xmz)" mod mod.ico "" SectionEnd Section ".MO3" mo3 SectionIn 2 !insertmacro assoc mo3 "压缩模块音频(mo3)" mod mod.ico "" SectionEnd SubSectionEnd SubSection "TFMX" sub_tfmx Section ".TFM" tfm SectionIn 2 !insertmacro assoc tfm "TFMX 音频(tfm)" tfm tfm.ico "" SectionEnd SubSectionEnd Section "SPC" spc SectionIn 2 !insertmacro assoc spc "SPC 音频(spc)" spc spc.ico "" SectionEnd SubSection "PSF" sub_psf Section ".PSF" psf SectionIn 2 !insertmacro assoc psf "PSF 音频(psf)" psf psf.ico "" SectionEnd Section ".MINIPSF" minipsf SectionIn 2 !insertmacro assoc minipsf "PSF 音频(minipsf)" psf psf.ico "" SectionEnd Section ".PSF2" psf2 SectionIn 2 !insertmacro assoc psf2 "PSF 音频(psf2)" psf psf.ico "" SectionEnd Section ".MINIPSF2" minipsf2 SectionIn 2 !insertmacro assoc minipsf2 "PSF 音频(minipsf2)" psf psf.ico "" SectionEnd SubSectionEnd SubSection "NEZplug" sub_nez Section ".NSF" nsf SectionIn 2 !insertmacro assoc nsf "NEZplug 音频(nsf)" nezplug nezplug.ico "" SectionEnd Section ".KSS" kss SectionIn 2 !insertmacro assoc kss "NEZplug 音频(kss)" nezplug nezplug.ico "" SectionEnd Section ".GBR" gbr SectionIn 2 !insertmacro assoc gbr "NEZplug 音频(gbr)" nezplug nezplug.ico "" SectionEnd Section ".GBS" gbs SectionIn 2 !insertmacro assoc gbs "NEZplug 音频(gbs)" nezplug nezplug.ico "" SectionEnd Section ".HES" hes SectionIn 2 !insertmacro assoc hes "NEZplug 音频(hes)" nezplug nezplug.ico "" SectionEnd Section ".PCE" pce SectionIn 2 !insertmacro assoc pce "NEZplug 音频(pce)" nezplug nezplug.ico "" SectionEnd Section ".AY" ay SectionIn 2 !insertmacro assoc ay "NEZplug 音频(ay)" nezplug nezplug.ico "" SectionEnd Section ".CPC" cpc SectionIn 2 !insertmacro assoc cpc "NEZplug 音频(cpc)" nezplug nezplug.ico "" SectionEnd SubSectionEnd ; separate NSF for foo_festalon Section "NSF" nsf_festalon SectionIn 2 !insertmacro assoc nsf "NSF 音频(nsf)" nsf nsf.ico "" SectionEnd Section "SID" sid SectionIn 2 !insertmacro assoc sid "SID 音频(sid)" sid sid.ico "" SectionEnd Section "GYM" gym SectionIn 2 !insertmacro assoc gym "GYM 音频(gym)" gym gym.ico "" SectionEnd Section "XA" xa SectionIn 2 !insertmacro assoc xa "XA 音频(xa)" xa xa.ico "" SectionEnd SubSection "Nero解码器" sub_nero Section ".VQF" vqf SectionIn 2 !insertmacro assoc vqf "VQF 音频" vqf vqf.ico "" SectionEnd Section ".MP3PRO" mp3pro SectionIn 2 !insertmacro assoc mp3pro "MP3PRO 音频" mp3pro mp3pro.ico "" SectionEnd SubSectionEnd SubSection "MIDI 文件" sub_midi Section ".mid" mid SectionIn 2 !insertmacro assoc mid "MIDI 文件(mid)" midi midi.ico "" SectionEnd Section ".midi" midi SectionIn 2 !insertmacro assoc midi "MIDI 文件(midi)" midi midi.ico midi SectionEnd Section ".rmi" rmi SectionIn 2 !insertmacro assoc rmi "MIDI 文件(midi)" midi midi.ico midi SectionEnd SubSectionEnd SubSection "音频CD" sub_cdda Section ".CDA" cda SectionIn 2 !insertmacro assoc cda "CD 音轨" cd cd.ico "" SectionEnd Section "音频CD" audiocd SectionIn 2 Call AssocAudioCD SectionEnd SubSectionEnd Section "-post" System::Call 'shell32.dll::SHChangeNotify(l, l, i, i) v (0x08000000, 0, 0, 0)' ;刷新图标 SectionEnd ; -------------------------------------- Function .onInit IfFileExists "$EXEDIR\foobar2000.exe" +3 0 MessageBox MB_OK|MB_ICONEXCLAMATION "请放到foobar2000目录下运行 " Quit ReadRegStr $0 HKCR "foobar2000.File" "" StrCmp $0 "" skip 0 InstTypeSetText 0 "当前关联的格式" ;检测以前关联的文件 !insertmacro CheckSection ${aac} aac !insertmacro CheckSection ${ac3} ac3 !insertmacro CheckSection ${aif} aif !insertmacro CheckSection ${aiff} aiff !insertmacro CheckSection ${ape} ape !insertmacro CheckSection ${apl} apl !insertmacro CheckSection ${au} au !insertmacro CheckSection ${ay} ay !insertmacro CheckSection ${cda} cda !insertmacro CheckSection ${cpc} cpc !insertmacro CheckSection ${cue} cue !insertmacro CheckSection ${fla} fla !insertmacro CheckSection ${flac} flac !insertmacro CheckSection ${fpl} fpl !insertmacro CheckSection ${gbr} gbr !insertmacro CheckSection ${gbs} gbs !insertmacro CheckSection ${gym} gym !insertmacro CheckSection ${hes} hes !insertmacro CheckSection ${iff} iff !insertmacro CheckSection ${it} it !insertmacro CheckSection ${itz} itz !insertmacro CheckSection ${kss} kss !insertmacro CheckSection ${la} la !insertmacro CheckSection ${mp+} mp+ !insertmacro CheckSection ${m3u8} m3u8 !insertmacro CheckSection ${m3u} m3u !insertmacro CheckSection ${m4a} m4a !insertmacro CheckSection ${mac} mac !insertmacro CheckSection ${mdz} mdz !insertmacro CheckSection ${minipsf} minipsf !insertmacro CheckSection ${minipsf2} minipsf2 !insertmacro CheckSection ${mka} mka !insertmacro CheckSection ${mo3} mo3 !insertmacro CheckSection ${mod} mod !insertmacro CheckSection ${mp2} mp2 !insertmacro CheckSection ${mp3} mp3 !insertmacro CheckSection ${mp3pro} mp3pro !insertmacro CheckSection ${mp4} mp4 !insertmacro CheckSection ${mpc} mpc !insertmacro CheckSection ${mpp} mpp !insertmacro CheckSection ${mtm} mtm !insertmacro CheckSection ${nsf} nsf !insertmacro CheckSection ${ofr} ofr !insertmacro CheckSection ${ofs} ofs !insertmacro CheckSection ${ogg} ogg !insertmacro CheckSection ${pac} pac !insertmacro CheckSection ${pce} pce !insertmacro CheckSection ${pls} pls !insertmacro CheckSection ${psf} psf !insertmacro CheckSection ${psf2} psf2 !insertmacro CheckSection ${s3m} s3m !insertmacro CheckSection ${s3z} s3z !insertmacro CheckSection ${shn} shn !insertmacro CheckSection ${sid} sid !insertmacro CheckSection ${snd} snd !insertmacro CheckSection ${spc} spc !insertmacro CheckSection ${spx} spx !insertmacro CheckSection ${svx} svx !insertmacro CheckSection ${tfm} tfm !insertmacro CheckSection ${tta} tta !insertmacro CheckSection ${voc} voc !insertmacro CheckSection ${vqf} vqf !insertmacro CheckSection ${umx} umx !insertmacro CheckSection ${wav} wav !insertmacro CheckSection ${wma} wma !insertmacro CheckSection ${wv} wv !insertmacro CheckSection ${xa} xa !insertmacro CheckSection ${xm} xm !insertmacro CheckSection ${xmz} xmz ReadRegStr $1 HKCR "AudioCD\shell\play\command" "" StrCpy $1 $1 "" -20 StrCmp $1 'foobar2000.exe" "%1"' 0 no_audiocd !insertmacro SetSectionInInstType ${audiocd} 1 no_audiocd: skip: ; see what components are installed and clear from the list as needed IfFileExists "$EXEDIR\components\foo_matroska.dll" matroska !insertmacro ClearSectionInInstType ${mka} 7 SectionSetText ${sub_matroska} "" SectionSetText ${mka} "" matroska: IfFileExists "$EXEDIR\components\foo_ac3.dll" ac3 !insertmacro ClearSectionInInstType ${ac3} 7 SectionSetText ${ac3} "" ac3: IfFileExists "$EXEDIR\components\foo_ape.dll" ape !insertmacro ClearSectionInInstType ${ape} 7 !insertmacro ClearSectionInInstType ${mac} 7 SectionSetText ${sub_ape} "" SectionSetText ${ape} "" SectionSetText ${mac} "" ape: IfFileExists "$EXEDIR\components\foo_apl.dll" apl !insertmacro ClearSectionInInstType ${apl} 7 SectionSetText ${apl} "" apl: IfFileExists "$EXEDIR\components\foo_wavpack.dll" wv !insertmacro ClearSectionInInstType ${wv} 7 SectionSetText ${wv} "" wv: IfFileExists "$EXEDIR\components\foo_cdda.dll" cdda !insertmacro ClearSectionInInstType ${cda} 7 !insertmacro ClearSectionInInstType ${audiocd} 7 SectionSetText ${sub_cdda} "" SectionSetText ${cda} "" SectionSetText ${audiocd} "" cdda: IfFileExists "$EXEDIR\components\foo_flac.dll" flac !insertmacro ClearSectionInInstType ${flac} 7 !insertmacro ClearSectionInInstType ${fla} 7 SectionSetText ${sub_flac} "" SectionSetText ${flac} "" SectionSetText ${fla} "" flac: IfFileExists "$EXEDIR\components\foo_gym.dll" gym !insertmacro ClearSectionInInstType ${gym} 7 SectionSetText ${gym} "" gym: IfFileExists "$EXEDIR\components\foo_la.dll" la !insertmacro ClearSectionInInstType ${la} 7 SectionSetText ${sub_la} "" SectionSetText ${la} "" la: IfFileExists "$EXEDIR\components\foo_lpac.dll" pac !insertmacro ClearSectionInInstType ${pac} 7 SectionSetText ${sub_lpac} "" SectionSetText ${pac} "" pac: IfFileExists "$EXEDIR\components\foo_mod.dll" mod !insertmacro ClearSectionInInstType ${xm} 7 !insertmacro ClearSectionInInstType ${it} 7 !insertmacro ClearSectionInInstType ${s3m} 7 !insertmacro ClearSectionInInstType ${mod} 7 !insertmacro ClearSectionInInstType ${mtm} 7 !insertmacro ClearSectionInInstType ${umx} 7 !insertmacro ClearSectionInInstType ${mdz} 7 !insertmacro ClearSectionInInstType ${s3z} 7 !insertmacro ClearSectionInInstType ${itz} 7 !insertmacro ClearSectionInInstType ${xmz} 7 !insertmacro ClearSectionInInstType ${mo3} 7 SectionSetText ${sub_mod} "" SectionSetText ${xm} "" SectionSetText ${it} "" SectionSetText ${s3m} "" SectionSetText ${mod} "" SectionSetText ${mtm} "" SectionSetText ${umx} "" SectionSetText ${sub_c_mod} "" SectionSetText ${mdz} "" SectionSetText ${s3z} "" SectionSetText ${itz} "" SectionSetText ${xmz} "" SectionSetText ${mo3} "" mod: IfFileExists "$EXEDIR\components\foo_nez.dll" nez IfFileExists "$EXEDIR\components\foo_festalon.dll" nez_festalon !insertmacro ClearSectionInInstType ${nsf_festalon} 7 SectionSetText ${nsf_festalon} "" nez_festalon: !insertmacro ClearSectionInInstType ${nsf} 7 !insertmacro ClearSectionInInstType ${kss} 7 !insertmacro ClearSectionInInstType ${gbr} 7 !insertmacro ClearSectionInInstType ${gbs} 7 !insertmacro ClearSectionInInstType ${hes} 7 !insertmacro ClearSectionInInstType ${pce} 7 !insertmacro ClearSectionInInstType ${ay} 7 !insertmacro ClearSectionInInstType ${cpc} 7 SectionSetText ${sub_nez} "" SectionSetText ${nsf} "" SectionSetText ${kss} "" SectionSetText ${gbr} "" SectionSetText ${gbs} "" SectionSetText ${hes} "" SectionSetText ${pce} "" SectionSetText ${ay} "" SectionSetText ${cpc} "" Goto nez2 nez: ; clear festalon !insertmacro ClearSectionInInstType ${nsf_festalon} 7 SectionSetText ${nsf_festalon} "" nez2: IfFileExists "$EXEDIR\components\foo_ofr.dll" ofr !insertmacro ClearSectionInInstType ${ofr} 7 !insertmacro ClearSectionInInstType ${ofs} 7 SectionSetText ${sub_ofr} "" SectionSetText ${ofr} "" SectionSetText ${ofs} "" ofr: IfFileExists "$EXEDIR\components\foo_psf.dll" psf !insertmacro ClearSectionInInstType ${psf} 7 !insertmacro ClearSectionInInstType ${minipsf} 7 !insertmacro ClearSectionInInstType ${psf2} 7 !insertmacro ClearSectionInInstType ${minipsf2} 7 SectionSetText ${sub_psf} "" SectionSetText ${psf} "" SectionSetText ${minipsf} "" SectionSetText ${psf2} "" SectionSetText ${minipsf2} "" psf: IfFileExists "$EXEDIR\components\foo_shn.dll" shn !insertmacro ClearSectionInInstType ${shn} 7 SectionSetText ${sub_shn} "" SectionSetText ${shn} "" shn: IfFileExists "$EXEDIR\components\foo_spc.dll" spc !insertmacro ClearSectionInInstType ${spc} 7 SectionSetText ${spc} "" spc: IfFileExists "$EXEDIR\components\foo_sid.dll" sid !insertmacro ClearSectionInInstType ${sid} 7 SectionSetText ${sid} "" sid: IfFileExists "$EXEDIR\components\foo_speex.dll" spx !insertmacro ClearSectionInInstType ${spx} 7 SectionSetText ${sub_spx} "" SectionSetText ${spx} "" spx: IfFileExists "$EXEDIR\components\foo_tfmx.dll" tfmx !insertmacro ClearSectionInInstType ${tfm} 7 SectionSetText ${sub_tfmx} "" SectionSetText ${tfm} "" tfmx: IfFileExists "$EXEDIR\components\foo_nero.dll" nero !insertmacro ClearSectionInInstType ${vqf} 7 !insertmacro ClearSectionInInstType ${mp3pro} 7 SectionSetText ${sub_nero} "" SectionSetText ${vqf} "" SectionSetText ${mp3pro} "" nero: IfFileExists "$EXEDIR\components\foo_wma.dll" wma !insertmacro ClearSectionInInstType ${wma} 7 SectionSetText ${wma} "" wma: IfFileExists "$EXEDIR\components\foo_xa.dll" xa !insertmacro ClearSectionInInstType ${xa} 7 SectionSetText ${xa} "" xa: IfFileExists "$EXEDIR\components\foo_midi.dll" midi !insertmacro ClearSectionInInstType ${mid} 7 !insertmacro ClearSectionInInstType ${midi} 7 !insertmacro ClearSectionInInstType ${rmi} 7 SectionSetText ${sub_midi} "" SectionSetText ${mid} "" SectionSetText ${midi} "" SectionSetText ${rmi} "" midi: IfFileExists "$EXEDIR\components\foo_tta.dll" tta !insertmacro ClearSectionInInstType ${tta} 7 SectionSetText ${tta} "" tta: SetCurInstType 0 FunctionEnd!insertmacro MUI_FUNCTION_DESCRIPTION_END
另存附件。