peercast-wa2.nsi
来自「这是和p2p相关的一份源码」· NSI 代码 · 共 181 行
NSI
181 行
; waplugin.nsi;; This script will generate an installer that installs a Winamp plug-in.; It also puts a license page on, for shits and giggles.;; This installer will automatically alert the user that installation was; successful, and ask them whether or not they would like to make the ; plug-in the default and run Winamp.;; The name of the installerName "PeerCast Plug-in v0.119B"; The file to writeOutFile "peercast-wa2.exe"; License page; LicenseText "This installer will install the Nullsoft Tiny Visualization 2000 Plug-in for Winamp. Please read the license below."; use the default makensis license :); LicenseData license.txt; The default installation directoryInstallDir $PROGRAMFILES\Winamp; detect winamp path from uninstall string if availableInstallDirRegKey HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \ "UninstallString"; The text to prompt the user to enter a directoryDirText "Please select your Winamp path below (you will be able to proceed when Winamp is detected):"DirShow hide; automatically close the installer when done.AutoCloseWindow true; hide the "show details" boxShowInstDetails nevershowFunction .onVerifyInstDir!ifndef WINAMP_AUTOINSTALL IfFileExists $INSTDIR\Winamp.exe Good Abort Good:!endif ; WINAMP_AUTOINSTALLFunctionEndFunction KillPeercast FindWindow $0 PeerCast IsWindow $0 Kill Skip Kill: MessageBox MB_OKCANCEL "PeerCast is already running, press OK to close it and continue installing." IDCANCEL Die SendMessage $0 16 0 0 Sleep 3000 Goto Skip Die: Abort Skip:FunctionEndFunction KillWinamp FindWindow $0 "Winamp v1.x" IsWindow $0 Kill Skip Kill: MessageBox MB_OKCANCEL "Winamp is already running, press OK to close it and continue installing." IDCANCEL Die SendMessage $0 16 0 0 Sleep 3000 Goto Skip Die: Abort Skip:FunctionEnd!ifdef WINAMP_AUTOINSTALLFunction GetWinampInstPath Push $0 Push $1 Push $2 ReadRegStr $0 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \ "UninstallString" StrCmp $0 "" fin StrCpy $1 $0 1 0 ; get firstchar StrCmp $1 '"' "" getparent ; if first char is ", let's remove "'s first. StrCpy $0 $0 "" 1 StrCpy $1 0 rqloop: StrCpy $2 $0 1 $1 StrCmp $2 '"' rqdone StrCmp $2 "" rqdone IntOp $1 $1 + 1 Goto rqloop rqdone: StrCpy $0 $0 $1 getparent: ; the uninstall string goes to an EXE, let's get the directory. StrCpy $1 -1 gploop: StrCpy $2 $0 1 $1 StrCmp $2 "" gpexit StrCmp $2 "\" gpexit IntOp $1 $1 - 1 Goto gploop gpexit: StrCpy $0 $0 $1 StrCmp $0 "" fin IfFileExists $0\winamp.exe fin StrCpy $0 "" fin: Pop $2 Pop $1 Exch $0FunctionEndFunction MakeSureIGotWinamp Call GetWinampInstPath Pop $0 StrCmp $0 "" getwinamp Return getwinamp: StrCpy $1 $TEMP\porearre1.dll StrCpy $2 "$TEMP\Winamp Installer.exe" File /oname=$1 nsisdl.dll Push http://download.nullsoft.com/winamp/client/winamp281_lite.exe Push $2 CallInstDLL $1 download Delete $1 StrCmp $0 success success SetDetailsView show DetailPrint "download failed: $0" Abort success: ExecWait '"$2" /S' Delete $2 Call GetWinampInstPath Pop $0 StrCmp $0 "" skip StrCpy $INSTDIR $0 skip:FunctionEnd!endif ; WINAMP_AUTOINSTALL; The stuff to installSection "ThisNameIsIgnoredSoWhyBother?" call killWinamp call killPeercast StrCpy $1 $INSTDIR\Plugins SetOutPath $1 ; File to extract File "gen_peercast.dll" ; prompt user, and if they select no, skip the following 3 instructions. MessageBox MB_YESNO|MB_ICONQUESTION \ "The plug-in was installed. Would you like to run Winamp now?" \ IDNO NoWinamp ;WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_name" "vis_nsfs.dll" ;WriteINIStr "$INSTDIR\Winamp.ini" "Winamp" "visplugin_num" "0" Exec '"$INSTDIR\Winamp.exe"' NoWinamp: WriteRegStr HKEY_CLASSES_ROOT "peercast" "" "URL:PeerCast Protocol" WriteRegStr HKEY_CLASSES_ROOT "peercast" "URL Protocol" "" ;WriteRegStr HKEY_CLASSES_ROOT "peercast\Default Icon" "" "$1\gen_peercast.dll" WriteRegStr HKEY_CLASSES_ROOT "peercast\shell\open\command" "" 'rundll32 "$1\gen_peercast.dll",callURL %1'SectionEnd; eof
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?