最新消息:

蓝色网际foobar封装脚本

nsis 永恒心锁 2295浏览 0评论
;************************************************************

;脚本编写: 蓝色网际

;我的脚本里使用了修改的语言文件,你需要按照如下步骤设置:

;打开 ${NSISDIR}ContribModern UILanguage 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          ".includelicense.txt"

ShowUninstDetails    show

Caption              "foobar2000 汉化增强版 v${VERSION} 安装"

ComponentText        "" "选定组件安装的类型:" "----------------------"

DirText              "安装程序将安装 $(^NameDA) 在下列文件夹。要安装到不同文件夹,单击 [浏览(B)] 并选择其他的文件夹。 $_CLICK"

InstallDir           "$PROGRAMFILESfoobar2000"

InstallDirRegKey     HKCU "SOFTWAREfoobar2000" "InstallDir"

Var                  HWND                   ;定义句柄变量,自定义页面用到

Var                  Date

;保存文件在最后的数据区块,初始化时加快速度

ReserveFile          ".resourceio.ini" ".resource7x.ico" ".resource8x.ico" ".resourceui1.bmp" ".resourceui2.bmp" ".resourceui3.bmp" "${NSISDIR}PluginsSystem.dll"

!include             MUI2.nsh               ;NSIS 的现代外观

!include             Sections.nsh          ;Section 前后期管理宏

!include             Ban3721.nsi           ;清除 3721 脚本

!define MUI_ICON .resourceico-inst.ico

!define MUI_UNICON .resourceico-uninst.ico

!define MUI_WELCOMEFINISHPAGE_BITMAP .resourcewiz-foobar.bmp

!define MUI_HEADERIMAGE

;!define MUI_HEADERIMAGE_RIGHT

!define MUI_HEADERIMAGE_BITMAP .resourceheader-foobar.bmp

!define MUI_FINISHPAGE_RUN "$INSTDIRfoobar2000.exe"

!define MUI_FINISHPAGE_SHOWREADME "$INSTDIRreadme.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 ".includelicense.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 .resourcemyui.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 "$R0installer.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 "$INSTDIRinstaller.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 $INSTDIRinstall.log r

FileOpen $R5 $INSTDIRinstall2.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 "SOFTWAREMicrosoftWindows NTCurrentVersion" CurrentVersion

StrCmp $R0 "" 0 os_winnt

StrCpy $R0 '9X'

ReadRegStr $R1 HKLM "SOFTWAREMicrosoftWindowsCurrentVersion" ProductName

Goto os_done

os_winnt:

StrCpy $R0 'NT'

ReadRegStr $R1 HKLM "SOFTWAREMicrosoftWindows NTCurrentVersion" 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 "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" "bckupAudioCD"

StrCmp $R3 "" loop

ReadRegStr $R2 HKCR "AudioCDshellplaycommand" ""

StrCpy $R2 $R2 "" -20

StrCmp $R2 'foobar2000.exe" "%1"' 0 no_cd_restore

WriteRegStr HKCR "AudioCDshellplaycommand" "" "$R3"

DetailPrint "恢复音频 CD 关联"

Goto loop

no_cd_restore:

DetailPrint "音频 CD 未和 foobar2000 关联,略过"

loop:

EnumRegValue $R1 HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" $R0

ReadRegStr $R3 HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" $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 $INSTDIRfoobar2000.exe 0 +2

Call KillProcDLL

Delete "$INSTDIRinstaller.ini"

IfFileExists $INSTDIRinstall.log 0 +3

Call CopyLOG

Delete "$INSTDIRinstall.log"

LogSet on

SetOutPath "$INSTDIR"

#File ".includeinstaller.ini"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 11" "State"

StrCmp $0 1 hack

#!insertmacro #File ".includefoobar2000.exe"

Goto hack_end

hack:

#!insertmacro #File ".includeHackfoobar2000.exe"  ;修改版 0.7x 图标

hack_end:

WriteINIStr "$INSTDIRinstaller.ini" foobar2000 version "${VERSION}"

Call GetWinVer

Pop $0

Pop $1

StrCmp $0 "9x" w9x

#!insertmacro #File ".includeutf8api.dll"

Goto os_end

w9x:

#!insertmacro #File ".includeWin9xutf8api.dll"

os_end:

#!insertmacro #File ".includelicense.txt"

#!insertmacro #File ".includetitleformat_help.html"

#!insertmacro #File ".includereadme.txt"

#!insertmacro #File ".includefooassoc.exe"

SetOverwrite off ;不覆盖 fooassoc.txt

#File ".includefooassoc.txt"

SetOverwrite on

CreateDirectory "$INSTDIRicons"

SetOutPath "$INSTDIRicons"

#File ".includeicons*.*"

WriteINIStr "$INSTDIRinstaller.ini" foobar2000 haversion "${VERSION}"

SectionEnd

Section "配置文件" foocfg

SectionIn 1 2

SetOutPath "$INSTDIR"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 15" "State"

StrCmp $0 1 0 +2

#File ".includefoobar2000.cfg"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 16" "State"

StrCmp $0 1 0 +2

#File ".includecfg_columnsfoobar2000.cfg"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 17" "State"

StrCmp $0 1 0 +2

#File ".includecfg_tunesfoobar2000.cfg"

WriteINIStr "$INSTDIRinstaller.ini" foobar2000 cfg 1

SectionEnd

SubSection "用户界面" user_interface

Section "默认用户界面" foo_ui_std

SectionIn 1 2 3 4 RO

SetOutPath "$INSTDIRcomponents"

#!insertmacro #File ".includecomponentsfoo_ui_std.dll"

WriteINIStr "$INSTDIRinstaller.ini" ui std 1

SectionEnd

Section "Columns UI" foo_ui_columns

#!insertmacro #File .includeextrafoo_ui_columns.dll

WriteINIStr $INSTDIRinstaller.ini ui columns 1

SectionEnd

Section "fooTunes" foo_tunes

#!insertmacro #File .includeextrafoo_tunes.dll

SetOutPath $INSTDIRcomponentstunes

#File .includeextratunes*.png

SetOutPath $INSTDIRcomponents

WriteINIStr $INSTDIRinstaller.ini ui tunes 1

SectionEnd

SubSectionEnd

SubSection "输入组件" input_components

Section "标准输入列" foo_input_std

SectionIn 1 2 3 4 RO

#!insertmacro #File ".includecomponentsfoo_input_std.dll"

WriteINIStr "$INSTDIRinstaller.ini" input input_std 1

SectionEnd

Section "CDDA" foo_cdda

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_cdda.dll"

WriteINIStr "$INSTDIRinstaller.ini" input cdda 1

SectionEnd

Section "FLAC" foo_flac

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_flac.dll"

WriteINIStr "$INSTDIRinstaller.ini" input flac 1

SectionEnd

Section "Monkey's Audio" foo_ape

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_ape.dll"

WriteINIStr "$INSTDIRinstaller.ini" input ape 1

SectionEnd

Section "WavPack" foo_wavpack

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_wavpack.dll"

WriteINIStr "$INSTDIRinstaller.ini" input wavpack 1

SectionEnd

Section "Speex" foo_speex

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_speex.dll"

WriteINIStr "$INSTDIRinstaller.ini" input speex 1

SectionEnd

Section "MOD" foo_mod

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_mod.dll"

SetOutPath "$INSTDIR"

#!insertmacro #File ".includebass.dll"

SetOutPath "$INSTDIRcomponents"

WriteINIStr "$INSTDIRinstaller.ini" input mod 1

SectionEnd

Section "WMA" foo_wma

SectionIn 1 2

#!insertmacro #File ".includeextrafoo_wma.dll"

WriteINIStr "$INSTDIRinstaller.ini" input wma 1

SectionEnd

Section "SPC" foo_spc

SectionIn 2

#!insertmacro #File ".includecomponentsfoo_spc.dll"

WriteINIStr "$INSTDIRinstaller.ini" input spc 1

SectionEnd

Section "AC3" foo_ac3

SectionIn 2

#!insertmacro #File ".includeextrafoo_ac3.dll"

WriteINIStr "$INSTDIRinstaller.ini" input ac3 1

SectionEnd

Section "NEZplug" foo_nez

SectionIn 2

#!insertmacro #File ".includeextrafoo_nez.dll"

WriteINIStr "$INSTDIRinstaller.ini" input nez 1

SectionEnd

Section "Matroska" foo_matroska

SectionIn 2

Delete "$INSTDIRcomponentsfoo_input_matroska.dll" ; foo_input_matroska现在已经废除

#!insertmacro #File ".includeextrafoo_matroska.dll"

WriteINIStr "$INSTDIRinstaller.ini" input matroska 1

SectionEnd

Section "OptimFROG" foo_ofr

SectionIn 2

#!insertmacro #File ".includeextrafoo_ofr.dll"

SetOutPath $INSTDIR

#File .includeOptimFROG.dll

SetOutPath $INSTDIRcomponents

WriteINIStr "$INSTDIRinstaller.ini" input ofr 1

SectionEnd

Section "TTA" foo_tta

SectionIn 2

#!insertmacro #File ".includeextrafoo_tta.dll"

WriteINIStr "$INSTDIRinstaller.ini" input tta 1

SectionEnd

Section "Shorten" foo_shn

SectionIn 2

#!insertmacro #File .includeextrafoo_shn.dll

WriteINIStr $INSTDIRinstaller.ini input shn 1

SectionEnd

Section "MAD 解码器" foo_mad

SectionIn 2

#!insertmacro #File ".includeextrafoo_mad.dll"

WriteINIStr "$INSTDIRinstaller.ini" input mad 1

SectionEnd

SubSectionEnd

SubSection "输出组件" output_components

Section "标准输出" foo_output_std

SectionIn 1 2 3 4 RO

#!insertmacro #File ".includecomponentsfoo_output_std.dll"

WriteINIStr "$INSTDIRinstaller.ini" output output_std 1

SectionEnd

Section "DirectSound v2.0" foo_out_dsound_ex

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_out_dsound_ex.dll"

WriteINIStr "$INSTDIRinstaller.ini" output dsound_ex 1

SectionEnd

Section "Kernel Streaming" foo_out_ks

SectionIn 2

#!insertmacro #File ".includecomponentsfoo_out_ks.dll"

WriteINIStr "$INSTDIRinstaller.ini" output ks 1

SectionEnd

SubSectionEnd

SubSection "常规组件" general_components

Section "控制台" foo_console

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_console.dll"

WriteINIStr "$INSTDIRinstaller.ini" general console 1

SectionEnd

Section "Http 媒体流读取" foo_read_http

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_read_http.dll"

WriteINIStr "$INSTDIRinstaller.ini" general read_http 1

SectionEnd

Section "重放增益扫描" foo_rgscan

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_rgscan.dll"

WriteINIStr "$INSTDIRinstaller.ini" general rgscan 1

SectionEnd

Section "专辑列表" foo_albumlist

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_albumlist.dll"

WriteINIStr "$INSTDIRinstaller.ini" general albumlist 1

SectionEnd

Section "批量标签" foo_masstag

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_masstag.dll"

WriteINIStr "$INSTDIRinstaller.ini" general masstag 1

SectionEnd

Section "代码页替换" foo_codepage_action

SectionIn 1 2

#!insertmacro #File ".includeextrafoo_codepage_action.dll"

WriteINIStr "$INSTDIRinstaller.ini" general codepage_action 1

SectionEnd

Section "文件信息特别版" foo_infobox

SectionIn 1 2

#!insertmacro #File ".includeextrafoo_infobox.dll"

WriteINIStr "$INSTDIRinstaller.ini" general infobox 1

SectionEnd

Section "乱序控制" foo_shuffle

SectionIn 2

#!insertmacro #File ".includeextrafoo_shuffle.dll"

WriteINIStr "$INSTDIRinstaller.ini" general shuffle 1

SectionEnd

Section "压缩包免解压播放" foo_unpack

SectionIn 2

#!insertmacro #File ".includecomponentsfoo_unpack.dll"

Delete "$INSTDIRcomponentsfoo_unpack_7z.dll"

WriteINIStr "$INSTDIRinstaller.ini" general unpack 1

SectionEnd

Section "ID3v2 标签支持" foo_id3v2

SectionIn 2

#!insertmacro #File ".includecomponentsfoo_id3v2.dll"

WriteINIStr "$INSTDIRinstaller.ini" general id3v2 1

SectionEnd

Section "音乐 CD 刻录" foo_burninate

SectionIn 2

#!insertmacro #File ".includeextrafoo_burninate.dll"

WriteINIStr "$INSTDIRinstaller.ini" general burninate 1

SectionEnd

Section "Title formatting 随心换(foo_syfm)" foo_syfm

SectionIn 2

#!insertmacro #File ".includeextrafoo_syfm.dll"

SetOutPath "$INSTDIRconfigs"

#File ".includeconfigs*.fb2k"

SetOutPath "$INSTDIRcomponents"

WriteINIStr "$INSTDIRinstaller.ini" general syfm 1

SectionEnd

Section "freedb 批量标签" foo_freedb

SectionIn 2

#!insertmacro #File ".includeextrafoo_freedb.dll"

SetOutPath "$INSTDIR"

#!insertmacro #File ".includeiconv.dll"

SetOutPath "$INSTDIRcomponents"

WriteINIStr "$INSTDIRinstaller.ini" general freedb 1

SectionEnd

Section "计划任务" foo_scheduler

SectionIn 2

#!insertmacro #File ".includeextrafoo_scheduler.dll"

WriteINIStr "$INSTDIRinstaller.ini" general scheduler 1

SectionEnd

Section "播放列表产生程序" foo_playlistgen

SectionIn 2

#!insertmacro #File ".includeextrafoo_playlistgen.dll"

WriteINIStr "$INSTDIRinstaller.ini" general playlistgen 1

SectionEnd

Section "快速标签(foo_quicktag)" foo_quicktag

#!insertmacro #File ".includeextrafoo_quicktag.dll"

WriteINIStr "$INSTDIRinstaller.ini" general quicktag 1

SectionEnd

Section "CUE 扩展" foo_cue_ex

#!insertmacro #File ".includeextrafoo_cue_ex.dll"

WriteINIStr "$INSTDIRinstaller.ini" general cue_ex 1

SectionEnd

Section "文件删除管理(foo_delete)" foo_delete

#!insertmacro #File ".includeextrafoo_delete.dll"

WriteINIStr "$INSTDIRinstaller.ini" general delete 1

SectionEnd

Section "ABX 比较器" foo_abx

#!insertmacro #File ".includeextrafoo_abx.dll"

WriteINIStr "$INSTDIRinstaller.ini" general abx 1

SectionEnd

Section "播放列表工具(foo_utils)" foo_utils

#!insertmacro #File ".includeextrafoo_utils.dll"

WriteINIStr "$INSTDIRinstaller.ini" general utils 1

SectionEnd

Section "直接音量控制(Windows)" foo_dirvol

Delete "$INSTDIRcomponentsfoo_mixer"

#!insertmacro #File ".includeextrafoo_dirvol.dll"

WriteINIStr "$INSTDIRinstaller.ini" general dirvol 1

SectionEnd

SubSectionEnd

SubSection "数字信号处理(DSP)" dsp_components

Section "标准DSP列" foo_dsp_extra

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_dsp_extra.dll"

SetOutPath "$INSTDIREqualizer Presets"

#File ".includeEqualizer Presets*.*"

SetOutPath "$INSTDIRcomponents"

WriteINIStr "$INSTDIRinstaller.ini" dsp extra 1

SectionEnd

Section "SoundTouch" foo_dsp_soundtouch

SectionIn 2

#!insertmacro #File ".includeextrafoo_dsp_soundtouch.dll"

WriteINIStr "$INSTDIRinstaller.ini" dsp soundtouch 1

SectionEnd

Section "音轨间暂停" foo_dsp_pause

SectionIn 2

#!insertmacro #File ".includeextrafoo_dsp_pause.dll"

WriteINIStr "$INSTDIRinstaller.ini" dsp pause 1

SectionEnd

Section "回旋混响" foo_convolve

SectionIn 2

#!insertmacro #File ".includeextrafoo_convolve.dll"

WriteINIStr "$INSTDIRinstaller.ini" dsp convolve 1

SectionEnd

Section "续流器" foo_dsp_continuator

#!insertmacro #File ".includeextrafoo_dsp_continuator.dll"

WriteINIStr "$INSTDIRinstaller.ini" dsp continuator 1

SectionEnd

Section "PPHS 重采样" foo_pphsresample

#!insertmacro #File ".includeextrafoo_pphsresample.dll"

WriteINIStr "$INSTDIRinstaller.ini" dsp pphsresample 1

SectionEnd

SubSectionEnd

SubSection "格式转换" diskwriter_outputs

Section "格式转换主程序" foo_diskwriter

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_diskwriter.dll"

WriteINIStr "$INSTDIRinstaller.ini" general diskwriter 1

SectionEnd

Section "命令行编码器(CLI)" foo_clienc

SectionIn 1 2

#!insertmacro #File ".includecomponentsfoo_clienc.dll"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter clienc 1

SectionEnd

Section "Vorbis 编码器" foo_vorbisenc

SectionIn 2

#!insertmacro #File ".includeextrafoo_vorbisenc.dll"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter vorbisenc 1

SectionEnd

Section "Monkey's Audio 编码器(MAClib v3.98)" foo_monkey

SectionIn 2

#!insertmacro #File ".includeextrafoo_monkey.dll"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter monkey 1

SectionEnd

Section "FAAC 编码器" foo_faac

SectionIn 2

#!insertmacro #File ".includeextrafoo_faac.dll"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter faac 1

SectionEnd

Section "lame.exe" lame

SectionIn 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includelame.exe"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter "lame.exe" 1

SectionEnd

Section "mppenc.exe" mppenc

SectionIn 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includemppenc.exe"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter "mppenc.exe" 1

SectionEnd

Section "oggenc.exe" oggenc

SectionIn 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includeoggenc.exe"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter "oggenc.exe" 1

SectionEnd

Section "mac.exe" mac

SectionIn 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includemac.exe"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter "mac.exe" 1

SectionEnd

Section "flac.exe" flac

SectionIn 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includeflac.exe"

WriteINIStr "$INSTDIRinstaller.ini" diskwriter "flac.exe" 1

SectionEnd

SubSectionEnd

SubSection "可视化组件" vis_components

Section "可视化管理器" foo_vis_manager

SectionIn 1 2 3 4 RO

SetOutPath "$INSTDIRcomponents"

#!insertmacro #File ".includecomponentsfoo_vis_manager.dll"

WriteINIStr "$INSTDIRinstaller.ini" visualization vis_manager 1

SectionEnd

Section "简单频谱器" foo_vis_simple_spectrum

SetOutPath "$INSTDIRcomponents"

#!insertmacro #File ".includeextrafoo_vis_simple_spectrum.dll"

WriteINIStr "$INSTDIRinstaller.ini" visualization simple_spectrum 1

SectionEnd

SubSectionEnd

SubSection "小工具" tools

Section "LiveUpdate" foo_liveupdate

SectionIn 1 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includeLiveUpdate.exe"

SetOutPath "$INSTDIRcomponents"

#!insertmacro #File ".includeextrafoo_liveupdate.dll"

WriteINIStr "$INSTDIRinstaller.ini" foobar2000 liveupdate 1

SectionEnd

Section "foobar2000 配置文件备份工具" fb2kbak

SectionIn 1 2

SetOutPath "$INSTDIR"

#!insertmacro #File ".includefb2kbak.exe"

WriteINIStr "$INSTDIRinstaller.ini" foobar2000 fb2kbak 1

SectionEnd

SubSectionEnd

Section "-个性化设置"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 6" "State"

StrCmp $0 1 0 no_context_play

WriteRegStr HKCR "Directoryshellfoobar2000.play" "" "用 foobar2000 播放"

WriteRegStr HKCR "Directoryshellfoobar2000.playcommand" "" '"$INSTDIRfoobar2000.exe" "%1"'

WriteINIStr "$INSTDIRinstaller.ini" context play 1

no_context_play:

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 7" "State"

StrCmp $0 1 0 no_context_enqueue

WriteRegStr HKCR "Directoryshellfoobar2000.enqueue" "" "加入 foobar2000 队列"

WriteRegStr HKCR "Directoryshellfoobar2000.enqueuecommand" "" '"$INSTDIRfoobar2000.exe" /add "%1"'

WriteINIStr "$INSTDIRinstaller.ini" context enqueue 1

no_context_enqueue:

SetOutPath $INSTDIR

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 2" "State"

StrCmp $0 1 0 no_shortcut_desktop

CreateShortCut "$DESKTOPfoobar2000.lnk" "$INSTDIRfoobar2000.exe"

WriteINIStr "$INSTDIRinstaller.ini" shortcut desktop 1

no_shortcut_desktop:

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 3" "State"

StrCmp $0 1 0 no_shortcut_start_menu

Delete "$SMPROGRAMSfoobar2000*.lnk" ;删除旧的快捷方式

CreateDirectory "$SMPROGRAMSfoobar2000"

CreateShortCut "$SMPROGRAMSfoobar2000foobar2000.lnk" "$INSTDIRfoobar2000.exe"

CreateShortCut "$SMPROGRAMSfoobar2000文件关联.lnk" "$INSTDIRfooassoc.exe"

CreateShortCut "$SMPROGRAMSfoobar2000卸载.lnk" "$INSTDIRuninstall.exe"

IfFileExists "$INSTDIRLiveUpdate.exe" 0 +2

CreateShortCut "$SMPROGRAMSfoobar2000LiveUpdate.lnk" "$INSTDIRLiveUpdate.exe" "/fb2k"

WriteINIStr "$INSTDIRinstaller.ini" shortcut start_menu 1

no_shortcut_start_menu:

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 4" "State"

StrCmp $0 1 0 no_shortcut_quick_launch

CreateShortCut "$QUICKLAUNCHfoobar2000.lnk" "$INSTDIRfoobar2000.exe"

WriteINIStr "$INSTDIRinstaller.ini" shortcut quick_launch 1

no_shortcut_quick_launch:

SectionEnd

Section "-post"

LogSet off

FlushIni "$INSTDIRinstaller.ini"

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 8" "State"

StrCmp $0 1 regwrite_end

WriteRegStr HKCR "Applicationsfoobar2000.exe" "" ""

WriteRegStr HKCR "Applicationsfoobar2000.exeshell" "" "play"

WriteRegStr HKCR "Applicationsfoobar2000.exeshellplay" "" "用 foobar2000 播放"

WriteRegStr HKCR "Applicationsfoobar2000.exeshellplaycommand" "" '"$INSTDIRfoobar2000.exe" "%1"'

WriteRegStr HKCR "Applicationsfoobar2000.exeshellenqueue" "" "加入 foobar2000 队列"

WriteRegStr HKCR "Applicationsfoobar2000.exeshellenqueuecommand" "" '"$INSTDIRfoobar2000.exe" /add "%1"'

WriteRegStr HKCU "Softwarefoobar2000" "InstallDir" "$INSTDIR"

WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" "DisplayName" "foobar2000 汉化增强版 v${VERSION}"

WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" "UninstallString" '"$INSTDIRuninstall.exe"'

WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" "DisplayIcon" '"$INSTDIRfoobar2000.exe"'

WriteRegStr HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000" "InstallDir" "$INSTDIR" ;汉化版单独路径,英文版无

WriteUninstaller "$INSTDIRuninstall.exe"

regwrite_end:

IfSilent wma_chk_end

SectionGetFlags ${foo_wma} $0

IntOp $0 $0 & 1

StrCmp $0 0 wma_chk_end

GetDllVersion "$SYSDIRwmvcore.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 "$TEMPwmfdist.exe"

Delete "$TEMPwmfdist.exe"

wma_chk_end:

IfSilent msvcp_chk_end

SectionGetFlags ${foo_id3v2} $0

IntOp $0 $0 & 1

StrCmp $0 0 msvcp_chk_end   ;检查 MSVCP60 运行库

IfFileExists "$SYSDIRmsvcp60.dll" msvcp_chk_end

IfFileExists "$WINDIRmsvcp60.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 "$INSTDIRcomponentsfoo_mp4.dll"

;文件关联部分

ReadINIStr $0 "$PLUGINSDIRio.ini" "Field 8" "State"

StrCmp $0 1 assoc_end

HideWindow

SetOutPath "$INSTDIR"

IfSilent +3

ExecWait "$INSTDIRfooassoc.exe"

Goto +2

ExecWait '"$INSTDIRfooassoc.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=$PLUGINSDIRio.ini ".resourceio.ini"

File /oname=$PLUGINSDIR7x.ico ".resource7x.ico"

File /oname=$PLUGINSDIR8x.ico ".resource8x.ico"

File /oname=$PLUGINSDIRui1.bmp ".resourceui1.bmp"

File /oname=$PLUGINSDIRui2.bmp ".resourceui2.bmp"

File /oname=$PLUGINSDIRui3.bmp ".resourceui3.bmp"

WriteINIStr "$PLUGINSDIRio.ini" "Field 12" "Text" "$PLUGINSDIR8x.ico"

WriteINIStr "$PLUGINSDIRio.ini" "Field 13" "Text" "$PLUGINSDIR7x.ico"

WriteINIStr "$PLUGINSDIRio.ini" "Field 18" "Text" "$PLUGINSDIRui1.bmp"

ReadRegStr $R0 HKCU "Softwarefoobar2000" InstallDir

StrCmp $R0 "" skip_ini 0

IfFileExists "$R0installer.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 "$R0installer.ini" context play

WriteINIStr "$PLUGINSDIRio.ini" "Field 6" "State" "$0"

ReadINIStr $0 "$R0installer.ini" context enqueue

WriteINIStr "$PLUGINSDIRio.ini" "Field 7" "State" "$0"

; 快捷方式

ReadINIStr $0 "$R0installer.ini" shortcut desktop

WriteINIStr "$PLUGINSDIRio.ini" "Field 2" "State" "$0"

ReadINIStr $0 "$R0installer.ini" shortcut start_menu

WriteINIStr "$PLUGINSDIRio.ini" "Field 3" "State" "$0"

ReadINIStr $0 "$R0installer.ini" shortcut quick_launch

WriteINIStr "$PLUGINSDIRio.ini" "Field 4" "State" "$0"

SetCurInstType 3

Goto ini_end

skip_ini:

InstTypeSetText 3 ""

ini_end:

; 9X和NT系统下移除 foo_out_ks

ReadRegStr $R0 HKLM "SOFTWAREMicrosoftWindows NTCurrentVersion" 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 "SOFTWAREMicrosoftWindows NTCurrentVersion" 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 "$PLUGINSDIRio.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 $PLUGINSDIRio.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 "$PLUGINSDIRio.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 $PLUGINSDIRui1.bmp

Abort

ui2:

;Columns UI

!insertmacro ShowImage 1217 $PLUGINSDIRui2.bmp

Abort

ui3:

;fooTunes

!insertmacro ShowImage 1217 $PLUGINSDIRui3.bmp

Abort

validate:

FunctionEnd

; --------------------------------------

; 卸载段

; --------------------------------------

Section Uninstall

Call un.Restore

DeleteRegKey HKCR "foobar2000.File"

DeleteRegKey HKCR "foobar2000.m3u"

DeleteRegKey HKCR "foobar2000.cue"

DeleteRegKey HKCR "Directoryshellfoobar2000.play"

DeleteRegKey HKCR "Directoryshellfoobar2000.enqueue"

DeleteRegKey HKCR "Applicationsfoobar2000.exe"

DeleteRegKey HKCU "Softwarefoobar2000"

DeleteRegKey HKLM "SoftwareMicrosoftWindowsCurrentVersionUninstallfoobar2000"

Push $INSTDIRinstall.log

Call un.DelFile

IfFileExists $INSTDIRinstall2.log 0 +3

Push $INSTDIRinstall2.log

Call un.DelFile

Delete "$INSTDIRinstall.log"

Delete "$INSTDIRinstall2.log"

Delete "$INSTDIRfailure*.txt"

Delete "$INSTDIRdatabase.foo"

Delete "$INSTDIRuninstall.exe"

RMDir "$SMPROGRAMSfoobar2000"

;fooTunes

RMDir $INSTDIRcomponentstunes

Delete $INSTDIRcomponentstunesfoo_tunes.cfg.Content_*

Delete $INSTDIRcomponentsfoo_columns.ini

RMDir /r "$INSTDIRplaylists"

RMDir "$INSTDIRicons"

RMDir "$INSTDIREqualizer Presets"

RMDir "$INSTDIRconfigs"

RMDir "$INSTDIRcomponents"

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 <msmith@xiph.org>。'

!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
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 蓝色网际foobar封装脚本

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