示例#1
0
void UpdateChecker::Run()
{
    // no initialization to do, so signal readiness immediately
    SignalReady();

    try
    {
#ifdef _DEBUG
		const std::string url = "https://s3.amazonaws.com/qvivo_releases/v2/win32/testing/appcast.xml";
#else
        const std::string url = Settings::GetAppcastURL();
#endif
        if ( url.empty() )
            throw std::runtime_error("Appcast URL not specified.");

        StringDownloadSink appcast_xml;
        DownloadFile(url, &appcast_xml, GetAppcastDownloadFlags());

        Appcast appcast;
        appcast.Load(appcast_xml.data);

        Settings::WriteConfigValue("LastCheckTime", time(NULL));

        const std::string currentVersion =
                WideToAnsi(Settings::GetAppVersion());

		std::string currentBuild = currentVersion.substr(currentVersion.find(":") + 1);
		std::string appcastBuild = appcast.Build.substr(appcast.Build.find(":") + 1);

		std::string currentProductionVersion = currentVersion.substr(0, currentVersion.find(","));
		std::string appcastProductionVersion = appcast.Build.substr(0, appcast.Build.find(","));

        // Check if our version is out of date.
        if ( CompareVersions(currentProductionVersion, appcastProductionVersion) >= 0 )
        {
            // The same or newer version is already installed.

			if(m_showUI)
				UI::NotifyNoUpdates();
            return;
        }

        // Check if the user opted to ignore this particular version.
        std::string toSkip;
        if ( Settings::ReadConfigValue("SkipThisVersion", toSkip) &&
             toSkip == appcast.Version )
        {
			if(m_showUI)
				UI::NotifyNoUpdates();
            return;
        }

        UI::NotifyUpdateAvailable(appcast);
    }
    catch ( ... )
    {
        UI::NotifyUpdateError();
        throw;
    }
}
示例#2
0
void UpdateChecker::Run()
{
    // no initialization to do, so signal readiness immediately
    SignalReady();

    try
    {
        const std::string url = Settings::GetAppcastURL();
        if ( url.empty() )
            throw std::runtime_error("Appcast URL not specified.");

        StringDownloadSink appcast_xml;
        DownloadFile(url, &appcast_xml, GetAppcastDownloadFlags());

        Appcast appcast;
        appcast.Load(appcast_xml.data);

        Settings::WriteConfigValue("LastCheckTime", time(NULL));

        const std::string currentVersion =
                WideToAnsi(Settings::GetAppVersion());

        // Check if our version is out of date.
        if ( CompareVersions(currentVersion, appcast.Version) >= 0 )
        {
            // The same or newer version is already installed.
            UI::NotifyNoUpdates();
            return;
        }

        // Check if the user opted to ignore this particular version.
        std::string toSkip;
        if ( Settings::ReadConfigValue("SkipThisVersion", toSkip) &&
             toSkip == appcast.Version )
        {
            UI::NotifyNoUpdates();
            return;
        }

        UI::NotifyUpdateAvailable(appcast);
    }
    catch ( ... )
    {
        UI::NotifyUpdateError();
        throw;
    }
}