-
-
Notifications
You must be signed in to change notification settings - Fork 36
/
Installer.nsi
155 lines (115 loc) · 6.36 KB
/
Installer.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
Unicode true
CRCCheck On
SetCompressor /solid lzma
!include "MUI.nsh"
!include "FileFunc.nsh"
!include "DotNetChecker.nsh" ; https://github.com/ReVolly/NsisDotNetChecker
!define APPNAME "TV Rename"
Name "${APPNAME}"
Caption "${APPNAME} ${VERSION} Setup"
BrandingText " "
InstallDir "$PROGRAMFILES\TVRename"
OutFile "TVRename-${TAG}.exe"
!define MUI_ICON "TVRename\App\app.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
Var STARTMENU_FOLDER
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\TVRename"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\TVRename.exe"
!define MUI_FINISHPAGE_LINK "Visit the TV Rename site for the latest news and support"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.tvrename.com/"
!define MUI_TEXT_LICENSE_TITLE "End-User License Agreement"
!define MUI_TEXT_LICENSE_SUBTITLE "Please read the following license agreement carefully"
!define MUI_LICENSEPAGE_TEXT_TOP "Please read the following license agreement carefully"
!define MUI_LICENSEPAGE_BUTTON Accept
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "Licence.rtf"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "Install"
SetOutPath "$INSTDIR"
!insertmacro CheckNetFramework 48
Delete "$INSTDIR\Ionic.Utils.Zip.dll" ; Remove old dependency
File "TVRename\bin\Release\net6.0-windows\TVRename.exe"
File "TVRename\bin\Release\net6.0-windows\*.dll"
File "TVRename\bin\Release\net6.0-windows\*.json"
File "TVRename\bin\Release\net6.0-windows\TVRename.dll.config"
File "TVRename\bin\Release\net6.0-windows\NLog.config"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SetOutPath "$INSTDIR\runtimes\win\lib\net6.0"
File "TVRename\bin\Release\net6.0-windows\runtimes\win\lib\net6.0\*.dll"
SetOutPath "$INSTDIR\runtimes\win\lib\netcoreapp2.1"
File "TVRename\bin\Release\net6.0-windows\runtimes\win\lib\netcoreapp2.1\*.dll"
SetOutPath "$INSTDIR\runtimes\win-x64\lib\netcoreapp3.1"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x64\lib\netcoreapp3.1\*.dll"
SetOutPath "$INSTDIR\runtimes\win-x64\native"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x64\native\*.dll"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x64\native\*.exe"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x64\native\*.json"
File /r TVRename\packages\cef.redist.x64\106.0.29\CEF\*.dll
File /r TVRename\packages\cef.redist.x64\106.0.29\CEF\*.pak
File /r TVRename\packages\cef.redist.x64\106.0.29\CEF\*.bin
File /r TVRename\packages\cef.redist.x64\106.0.29\CEF\*.dat
File /r TVRename\packages\cef.redist.x64\106.0.29\CEF\*.json
SetOutPath "$INSTDIR\runtimes\win-x64\native\locales"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x64\native\locales\*.pak"
SetOutPath "$INSTDIR\runtimes\win-x86\lib\netcoreapp3.1"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x86\lib\netcoreapp3.1\*.dll"
SetOutPath "$INSTDIR\runtimes\win-x86\native"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x86\native\*.dll"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x86\native\*.exe"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x86\native\*.json"
File /r TVRename\packages\cef.redist.x86\106.0.29\CEF\*.dll
File /r TVRename\packages\cef.redist.x86\106.0.29\CEF\*.pak
File /r TVRename\packages\cef.redist.x86\106.0.29\CEF\*.bin
File /r TVRename\packages\cef.redist.x86\106.0.29\CEF\*.dat
File /r TVRename\packages\cef.redist.x86\106.0.29\CEF\*.json
SetOutPath "$INSTDIR\runtimes\win-x86\native\locales"
File "TVRename\bin\Release\net6.0-windows\runtimes\win-x86\native\locales\*.pak"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAME}.lnk" "$INSTDIR\TVRename.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAME} (Recover).lnk" "$INSTDIR\TVRename.exe" /recover
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "DisplayIcon" "$INSTDIR\TVRename.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "Publisher" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "NoRepair" 1
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename" "EstimatedSize" "$0"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\TVRename.exe"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\NLog.config"
Delete "$INSTDIR\TVRename.exe.config"
Delete "$INSTDIR\debug.log"
Delete "$INSTDIR\Uninstall.exe"
RmDir /r "$INSTDIR\x64"
RmDir /r "$INSTDIR\x86"
RmDir /r "$INSTDIR\runtimes"
RmDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $STARTMENU_FOLDER
Delete "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAME}.lnk"
Delete "$SMPROGRAMS\$STARTMENU_FOLDER\${APPNAME} (Recover).lnk"
Delete "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk"
RmDir "$SMPROGRAMS\$STARTMENU_FOLDER"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TVRename"
MessageBox MB_YESNO|MB_ICONEXCLAMATION "Do you wish to remove your ${APPNAME} settings as well?" IDNO done
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "AppData"
RmDir /r "$R0\TVRename"
done:
SectionEnd