Contrib/ExperienceUI/Utils/Source/UpdateWiz.nsi
changeset 0 d5ce4c64ef88
equal deleted inserted replaced
-1:000000000000 0:d5ce4c64ef88
       
     1 !ifdef MAKEFILE
       
     2   !verbose 0
       
     3 !else
       
     4   !define VERSION 1.1
       
     5 !endif
       
     6 ;!define BETA
       
     7 !define BETA_IP 192.168.0.253
       
     8 !define BETA_PORT 8765
       
     9 SetCompress off
       
    10 XPStyle on
       
    11 Icon Update.ico
       
    12 Name "ExperienceUI Downloader"
       
    13 Caption "ExperienceUI Update Wizard"
       
    14 OutFile ..\Updater.exe
       
    15 ChangeUI all ..\..\UIs\tinyui.exe
       
    16 SubCaption 3 " "
       
    17 SubCaption 4 " "
       
    18 InstallColors 0x000000 0xFFFFFF
       
    19 BrandingText " "
       
    20 CompletedText "Done."
       
    21 !define VER_MAJOR 1
       
    22 !define VER_TENS 1
       
    23 !define VER_ONES 0
       
    24 
       
    25 Page custom welcome lock
       
    26 Page custom infonotice lock
       
    27 Page instfiles
       
    28 
       
    29 Function welcome
       
    30 LockWindow on
       
    31 SetOutPath $TEMP
       
    32 File Updater.ini
       
    33 InstallOptions::initDialog /NOUNLOAD $TEMP\Updater.ini
       
    34 Pop $1
       
    35 SetCtlColors $1 0xFFFFFF 0xFFFFFF
       
    36 GetDlgItem $0 $1 1200
       
    37 SetCtlColors $0 0xC0C0C0 0xFFFFFF
       
    38 CreateFont $2 "Verdana" 28 100
       
    39 SendMessage $0 0x30 $2 ""
       
    40 GetDlgItem $0 $1 1201
       
    41 SetCtlColors $0 0x000000 transparent
       
    42 CreateFont $2 "MS Sans Serif" 8 700
       
    43 SendMessage $0 0x30 $2 ""
       
    44 !ifdef BETA
       
    45 SendMessage $0 0xC 0 "STR:This is a ßeta release."
       
    46 !endif
       
    47 GetDlgItem $0 $1 1202
       
    48 SetCtlColors $0 0x000000 transparent
       
    49 CreateFont $2 "MS Sans Serif" 8 350
       
    50 SendMessage $0 0x30 $2 ""
       
    51 !ifdef BETA
       
    52 SendMessage $0 0xC 0 "STR:This updater will fail unless you have a computer with the IP address ${BETA_IP} on your network, and it has the file xpui/updates.ini on port ${BETA_PORT}.  Please e-mail dandaman32@users.sourceforge.net for an updated version of this program!"
       
    53 !endif
       
    54 LockWindow off
       
    55 InstallOptions::show
       
    56 FunctionEnd
       
    57 
       
    58 Function infonotice
       
    59 SetOutPath $TEMP
       
    60 File Updater.ini
       
    61 WriteINIStr $TEMP\Updater.ini "Field 1" Left -173
       
    62 InstallOptions::initDialog /NOUNLOAD $TEMP\Updater.ini
       
    63 Pop $1
       
    64 SetCtlColors $1 0xFFFFFF 0xFFFFFF
       
    65 GetDlgItem $0 $1 1200
       
    66 SetCtlColors $0 0xC0C0C0 0xFFFFFF
       
    67 CreateFont $2 "Verdana" 28 100
       
    68 SendMessage $0 0x30 $2 ""
       
    69 SendMessage $0 0xC 0 "STR:privacy notice"
       
    70 GetDlgItem $0 $1 1201
       
    71 SetCtlColors $0 0x000000 transparent
       
    72 CreateFont $2 "MS Sans Serif" 8 700
       
    73 SendMessage $0 0x30 $2 ""
       
    74 SendMessage $0 0xC 0 "STR:Your privacy is important."
       
    75 GetDlgItem $0 $1 1202
       
    76 SetCtlColors $0 0x000000 transparent
       
    77 CreateFont $2 "MS Sans Serif" 8 350
       
    78 SendMessage $0 0x30 $2 ""
       
    79 SendMessage $0 0xC 0 "STR:This program does not send any information about to or your computer to anyone.  The only thing it does is download a text file from my web server and check its version information."
       
    80 LockWindow off
       
    81 InstallOptions::show
       
    82 FunctionEnd
       
    83 
       
    84 Function lock
       
    85 LockWindow on
       
    86 FunctionEnd
       
    87 
       
    88 Function .onUserAbort
       
    89 LockWindow off
       
    90 FunctionEnd
       
    91 
       
    92 !define LVM_DELETEALLITEMS 0x1009
       
    93 !macro CLS
       
    94 Push $0
       
    95 FindWindow $0 "#32770" "" $HWNDPARENT
       
    96 GetDlgItem $0 $0 1016
       
    97 SendMessage $0 ${LVM_DELETEALLITEMS} 0 0
       
    98 Pop $0
       
    99 !macroend
       
   100 
       
   101 Section
       
   102 LockWindow off
       
   103 GetDlgItem $0 $HWNDPARENT 1044
       
   104 ShowWindow $0 0
       
   105 GetDlgItem $0 $HWNDPARENT 3
       
   106 ShowWindow $0 0
       
   107 FindWindow $0 "#32770" "" $HWNDPARENT
       
   108 GetDlgItem $0 $0 1004
       
   109 ShowWindow $0 0
       
   110 FindWindow $0 "#32770" "" $HWNDPARENT
       
   111 GetDlgItem $0 $0 1027
       
   112 ShowWindow $0 0
       
   113 GetDlgItem $0 $HWNDPARENT 1
       
   114 ShowWindow $0 0
       
   115 DetailPrint "Connecting to the Internet..."
       
   116 Dialer::AttemptConnect
       
   117 IfErrors noie3
       
   118 Pop $R0
       
   119 !insertmacro CLS
       
   120 DetailPrint "Connecting to the Internet...$R0"
       
   121 StrCmp $R0 "online" connected      
       
   122 MessageBox MB_OK|MB_ICONSTOP "The ExperienceUI was unable to establish a connection to the Internet.  A few possible reasons for this are:$\n$\n1) You have an Internet provider that requires authentication (such as dial-up) and you did not supply a valid$\n     username or password.$\n2) Your firewall is preventing this program ($CMDLINE) from accessing the Internet.$\n3) You do not have an Internet connection set up on this computer.$\n$\nThe updater cannot continue.  Please click OK to exit."
       
   123 Call cleanup
       
   124 Abort "Unable to connect."
       
   125 noie3:
       
   126 !insertmacro CLS
       
   127 DetailPrint "Connecting to the Internet...cannot find IE3 or later"
       
   128 MessageBox MB_OK|MB_ICONINFORMATION "The ExperienceUI has detected that you do not have Microsoft Internet Explorer 3 or later installed.  The automatic internet connection feature requires MSIE3 or later to work right.$\n$\nPlease connect to the Internet now, and then click OK to continue updating the ExperienceUI."
       
   129 connected:
       
   130 !ifdef BETA
       
   131   nsisdl::download /TRANSLATE "Downloading the update information file..." "Initializing..." " " " " " "  s " "                        "Time left: %d %s%s"   "http://${BETA_IP}:${BETA_PORT}/xpui/Updates.ini" "$TEMP\xpuiupd.ini"
       
   132     !else
       
   133   nsisdl::download /TRANSLATE "Downloading the update information file..." "Initializing..." " " " " " "  s " "                        "Time left: %d %s%s"   http://xpui.sourceforge.net/bin/Updates.ini "$TEMP\xpuiupd.ini"
       
   134 !endif
       
   135 Pop $0
       
   136 StrCmp $0 success GoodINI
       
   137 MessageBox MB_OK|MB_ICONINFORMATION "The ExperienceUI updater was unable to download the update information file from the web site.$\nThe web server may be down, or there may be a problem with your Internet connection.$\n$\nError: $0"
       
   138 Call cleanup
       
   139 SetDetailsPrint textonly
       
   140 DetailPrint "The updater cannot continue. Click Cancel to exit."
       
   141 SetDetailsPrint listonly
       
   142 Abort "Release info download failed: $0"
       
   143 Goto Done
       
   144 GoodINI:
       
   145 DetailPrint "Checking version..."
       
   146 DetailPrint "  Current: ${VERSION}"
       
   147 ReadINIStr $0 $TEMP\xpuiupd.ini ExperienceUI Display
       
   148 DetailPrint "  Latest: $0"
       
   149 ReadINIStr $1 $TEMP\xpuiupd.ini ExperienceUI Major
       
   150 ReadINIStr $2 $TEMP\xpuiupd.ini ExperienceUI Tens
       
   151 ReadINIStr $3 $TEMP\xpuiupd.ini ExperienceUI Ones
       
   152 ReadINIStr $4 $TEMP\xpuiupd.ini ExperienceUI Size
       
   153 IntCmp $1 ${VER_MAJOR} "" "" Updates
       
   154 IntCmp $2 ${VER_TENS} "" "" Updates
       
   155 IntCmp $3 ${VER_ONES} "" "" Updates
       
   156 Goto NoUpdates
       
   157 Updates:
       
   158 ReadINIStr $5 $TEMP\xpuiupd.ini ExperienceUI Class
       
   159 ReadINIStr $6 $TEMP\xpuiupd.ini ExperienceUI HighlightsLine1
       
   160 ReadINIStr $7 $TEMP\xpuiupd.ini ExperienceUI HighlightsLine2 
       
   161 ReadINIStr $8 $TEMP\xpuiupd.ini ExperienceUI TimeID
       
   162 DetailPrint "Update ready!"
       
   163 MessageBox MB_YESNO|MB_ICONQUESTION "An update is available!$\n$\nYour version: ${VERSION}$\nNew version: $0 (Release ID: $8) $\n$\nThis update is classified as $5.$\n$\nRelease highlights:$\n$6$\n$7$\n$\nDownload it now? (size: ~$4kb)" IDYES Download
       
   164 DetailPrint "Update found, but not downloaded."
       
   165 Goto done
       
   166 Download:
       
   167 !ifdef BETA
       
   168 nsisdl::download /TRANSLATE "Downloading ExperienceUI version $0..."  "Connecting to server..." second minute hour s "%dKB (%d%%) of %dKB at %d.%01dKB/second" "; Time left: %d %s%s" http://${BETA_IP}:${BETA_PORT}/xpui/$0/ExperienceUISetup$0.exe "$DESKTOP\ExperienceUI Setup $0.exe"
       
   169 !else
       
   170 nsisdl::download /TRANSLATE "Downloading ExperienceUI version $0..."  "Connecting to server..." second minute hour s "%dKB (%d%%) of %dKB at %d.%01dKB/second" "; Time left: %d %s%s" http://internap.dl.sourceforge.net/sourceforge/xpui/ExperienceUISetup$0.exe "$DESKTOP\ExperienceUI Setup $0.exe"
       
   171 !endif
       
   172 Pop $0
       
   173 StrCmp $0 cancel DLCancelled
       
   174 StrCmp $0 success "" DLError
       
   175 MessageBox MB_OK|MB_ICONINFORMATION "The file was downloaded successfully to your Desktop."
       
   176 DetailPrint "Update found and downloaded successfully."
       
   177 Goto done
       
   178 DLCancelled:
       
   179 DetailPrint "Download cancelled."
       
   180 MessageBox MB_OK|MB_ICONINFORMATION "The download was cancelled."
       
   181 Goto done
       
   182 DLError:
       
   183 SetDetailsPrint textonly
       
   184 DetailPrint "The updater cannot continue. Click Cancel to exit."
       
   185 SetDetailsPrint listonly
       
   186 Call Cleanup
       
   187 Abort "Download error: $0"
       
   188 MessageBox MB_OK|MB_ICONINFORMATION "The updater was unable to download the file from the web site.$\n$\nThe following error occurred:$\n$0"
       
   189 Goto done
       
   190 NoUpdates:
       
   191 DetailPrint "No updates available."
       
   192 MessageBox MB_OK|MB_ICONINFORMATION "No updates are available at this time.  Please try again later.$\n$\nCurrent version: ${VERSION}$\nLatest version: $0$\n"
       
   193 Done:
       
   194 Call Cleanup
       
   195 SectionEnd
       
   196 
       
   197 Function cleanup
       
   198 SetDetailsPrint none
       
   199 Delete $TEMP\xpuiupd.ini
       
   200 SetDetailsPrint both
       
   201 FindWindow $R0 "#32770" "" $HWNDPARENT
       
   202 GetDlgItem $R0 $R0 1016
       
   203 ShowWindow $R0 5
       
   204 GetDlgItem $R0 $HWNDPARENT 1
       
   205 ShowWindow $R0 5
       
   206 Functionend