The full code is available in this fork
http://wix.codeplex.com/SourceControl/network/forks/nsleightholm/bundleselfupdates/changeset/232ffc24aa57
Neil
From: Neil Sleightholm [mailto:[email protected]]
Sent: 19 February 2013 15:34
To: Windows Installer XML toolset developer mailing list
Subject: Re: [WiX-devs] WixStdBA and bundle self updates
What I did was hook in to the OnDetectUpdateBegin() event and create a thread
to check a website, if the website reports that there is an update I enable a
link on the welcome page that calls OnPlan(BOOTSTRAPPER_ACTION_UPDATE_REPLACE).
I set the check link to include the bundle version e.g. Update
Location="https://example.com/checkupgrade.asp?version=1.2.3.4” (this could do
with being a formatted value so that you can use [WixBundleVersion]). The
website returns the update URL and optionally the size of the download.
Most of the code was already in place so I just had to join the dots.
The thread code looks like this:
// Load the update XML from a location url and parse it for an update.
//
// <?xml version="1.0" encoding="utf-8"?>
// <Setup>
// <Upgrade Url="https://somewhere.co.uk/download/Setup.exe"
Size="123" />
// </Setup>
hr = XmlLoadDocumentFromFile(pThis->m_wzUpdateLocation, &pixd);
BalExitOnFailure(hr, "Failed to load version check XML document.");
hr = XmlSelectSingleNode(pixd, L"/Setup/Upgrade", &pNode);
BalExitOnFailure(hr, "Failed to select upgrade node.");
if (S_OK == hr)
{
hr = XmlGetAttributeEx(pNode, L"Url", &sczUpdateUrl);
BalExitOnFailure(hr, "Failed to get url attribute.");
hr = XmlGetAttributeLargeNumber(pNode, L"Size", &qwSize);
pThis->m_fUpdate = (sczUpdateUrl && *sczUpdateUrl);
}
if (pThis->m_fUpdate)
{
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Update available, url:
%ls; size: %I64u.", sczUpdateUrl, qwSize);
pThis->m_pEngine->SetUpdate(NULL, sczUpdateUrl, qwSize,
BOOTSTRAPPER_UPDATE_HASH_TYPE_NONE, NULL, 0);
ThemeControlEnable(pThis->m_pTheme, WIXSTDBA_CONTROL_UPGRADE_LINK,
TRUE);
}
else
{
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "No update available.");
}
I’ll try and create a fork for this tonight.
Neil
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs