I created a simple AutoIT3-Beta script that will let you update (or install a fresh copy) of Carbonite using Wowinterface latest ZIP file. It's not perfect but it's a start.
I use Windows 7 but it should work for Vista and Windows XP!
Code:
TraySetClick(0)
#include <INet.au3>
; The URL for the download ZIP (using Wowinterface as "lastest version" repository)
Global $zipurl = "http://www.wowinterface.com/downloads/download12965-Carbonite"
; Variables for later use...
Global $forceUpdate = False
Global $versionConversion = False
; Get game information and addon version
Global $installpath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\World of Warcraft", "InstallPath")
If $installpath == "" And @error Then
MsgBox(16, "Ops, can't find World of Warcraft!", "The game is not installed correctly. Please update the addon manually because the updater can't find the game path -sorry!")
Exit
EndIf
$tocversion = FileRead($installpath & "\interface\addons\carbonite\carbonite.toc")
$tocversion = StringLower($tocversion)
$tocversion = StringRegExp($tocversion, "## version: (.*)", 1)
If @error Or UBound($tocversion) <> 1 Then
Local $reply = MsgBox(52, "Carbonite is not installed...", "Would you like the updater to install Carbonite (fresh install)?")
If $reply == 6 Then
$forceUpdate = True
Else
Exit
EndIf
Else
$tocversion = StringRegExpReplace($tocversion[0], "\D", "")
EndIf
; Get page header data using winhttp (skip if forceupdate is requested)
If $forceUpdate == False Then
$winhttp = ObjCreate("winhttp.winhttprequest.5.1")
$winhttp.open("GET", $zipurl)
$winhttp.send()
;~ $headers = $winhttp.GetAllResponseHeaders
; Assign values to variables
$filesize = $winhttp.GetResponseHeader("Content-Length") + 0 ; force str to int
$filetype = $winhttp.GetResponseHeader("Content-Type")
$filedisp = $winhttp.GetResponseHeader("Content-Disposition")
$fileenc = $winhttp.GetResponseHeader("Content-transfer-encoding")
;~ MsgBox(0,"",$filesize) "# bytes"
;~ MsgBox(0,"",$filetype) "application/zip"
;~ MsgBox(0,"",$filedisp) '="(.*?)"'
;~ MsgBox(0,"",$fileenc) "binary"
; Terminate if file is too small (404 page error, server load, e.g.)
If Not IsNumber($filesize) Or $filesize < 262144 Then
MsgBox(48, "Wowinterface.com seems to be too busy!", "Unable to fetch the latest addon version, try again later!")
Exit
EndIf
; Get version from content-disposition ("Carbonite-3.23.zip" becomes "")
$filenames = StringRegExp($filedisp, "=""(.*?)""", 1)
If @error Or UBound($filenames) <> 1 Then
Local $reply = MsgBox(52, "Unable to fetch addon version!", "Unable to read addon version from zip, click ""Yes"" to enforce an update or ""No"" to exit.")
If $reply == 6 Then
$forceUpdate = True
Else
Exit
EndIf
Else
$version = StringRegExpReplace($filenames[0], "\D", "")
EndIf
; Format our versions properly now
Local $longlen = StringLen($tocversion)
If StringLen($version) > StringLen($tocversion) Then
$longlen = StringLen($version)
EndIf
While StringLen($version) < $longlen
$version = $version & "0"
WEnd
While StringLen($tocversion) < $longlen
$tocversion = $tocversion & "0"
WEnd
$version = $version + 0
$tocversion = $tocversion + 0
$versionConversion = True
; Check versions and decide if it should update or not
If $version > $tocversion Then
$forceUpdate = True
EndIf
EndIf
; Update the local addon using remote zip-file
If $forceUpdate == True Then
If $versionConversion == True Then
Local $reply = MsgBox(68, "New version found!", "Do you want to update (from """ & $tocversion & """) to """ & $version & """?")
If $reply == 6 Then
UpdateAddon()
Else
Exit
EndIf
Else
UpdateAddon()
EndIf
Else
MsgBox(64, "Information", "Nothing to update, you either..." & @CRLF & "1) Have the latest version" & @CRLF & "2) Have chosen to abort updating")
EndIf
; Function to update addon
Func UpdateAddon()
Local $7zip = @TempDir & "\7z.exe"
FileInstall("D:\Program Files\7-Zip\7z.exe", $7zip, 1)
Local $tempfile = @TempDir & "\Carbonite_" & @YEAR & @MON & @MDAY & "-" & @HOUR & @MIN & @SEC & ".zip"
FileDelete($tempfile)
Local $inetsize = InetGetSize($zipurl)
Local $handle = InetGet($zipurl, $tempfile, 1, 1)
While InetGetInfo($handle, 0) < $inetsize
TrayTip("Downloading...", Round((InetGetInfo($handle, 0) / $inetsize) * 100, 0) & "% downloaded", 1)
Sleep(25)
WEnd
TrayTip("Downloading...", "100% downloaded", 1)
Sleep(250)
TrayTip("", "", 0)
DirCreate($installpath & "\Interface")
DirCreate($installpath & "\Interface\Addons")
TrayTip("Installing...", "Please wait...", 3)
Local $exe = @TempDir & '\7z.exe x -y -o"' & $installpath & "\Interface\Addons" & '" "' & $tempfile & '"'
RunWait($exe, @TempDir, @SW_HIDE)
TrayTip("Installing...", "Done!", 3)
Sleep(250)
FileDelete($tempfile)
TrayTip("", "", 0)
MsgBox(64, "Done!", "The update was completed, you are now using the latest Carbonite available!")
EndFunc
; Bye!
Exit
link removed
I don't expect anything, it didn't take much time to make and I was bored! :P