Example #1
0
        private UpdateInfo _doUpdateCheck(Version currentVersion, bool includeBetaVersions)
        {
            UpdateInfo returnCode = new UpdateInfo();

            WinkleResponse = getUpdateFile(updateInfoUrl);
            if (WinkleResponse == null)
            {
                returnCode.errorCode = 1;
                returnCode.updateInfoRetrievalSuccessfull = false;
                returnCode.errorTitle       = "Retrieval of update information failed";
                returnCode.errorDescription = "Cannot download the update file description from " + updateInfoUrl;
                return(returnCode);
            }

            Version newestAvailableVersion = currentVersion;
            bool    updateAvailable        = false;

            getChangeLog(includeBetaVersions, currentVersion);
            changeLog.Sort();
            changeLog.Reverse();
            if (changeLog.Count > 0)
            {
                newestAvailableVersion = changeLog[0].version;
            }

            if (includeBetaVersions)
            {
                getChangeLog(includeBetaVersions, newestAvailableVersion);
            }

            changeLog.Sort();
            changeLog.Reverse();
            if (changeLog.Count > 0)
            {
                newestAvailableVersion = changeLog[0].version;
                updateAvailable        = true;
            }

            if (updateAvailable)
            {
                returnCode.updateAvailable = true;
                returnCode.updateInfoRetrievalSuccessfull = true;
                returnCode.version    = newestAvailableVersion;
                returnCode.prettyName = changeLog[0].prettyName;

                returnCode.manualDownloadUrl = new System.Uri(getDownloadLinkUrl(includeBetaVersions));

                if (showWindowIfUpdateAvailable)
                {
                    Winkle.UpdateNotification myUpdateNotification = new UpdateNotification();

                    myUpdateNotification.setDownloadLink(returnCode.manualDownloadUrl.ToString());
                    string myDescription = "";


                    foreach (DescriptionOfChanges myChanges in changeLog)
                    {
                        myDescription += myChanges.getFormattedVersionString() + "\n";
                        myDescription += myChanges.updateDescription;
                        myDescription += "\n============================================\n";
                    }
                    myUpdateNotification.setVersion(applicatenName, newestAvailableVersion.ToString());
                    myUpdateNotification.setShortDescription(applicatenName, newestAvailableVersion.ToString(), currentVersion);
                    myUpdateNotification.setDescription(myDescription);
                    myUpdateNotification.Show();
                }

                return(returnCode);
            }

            returnCode.updateInfoRetrievalSuccessfull = true;
            return(returnCode);
        }
Example #2
0
        private UpdateInfo _doUpdateCheck(Version currentVersion, bool includeBetaVersions)
        {
            UpdateInfo returnCode = new UpdateInfo();
            WinkleResponse = getUpdateFile(updateInfoUrl);
            if (WinkleResponse == null)
            {
                returnCode.errorCode = 1;
                returnCode.updateInfoRetrievalSuccessfull = false;
                returnCode.errorTitle = "Retrieval of update information failed";
                returnCode.errorDescription = "Cannot download the update file description from " + updateInfoUrl;
                return returnCode;
            }

            Version newestAvailableVersion = currentVersion;
            bool updateAvailable = false;

            getChangeLog(includeBetaVersions,currentVersion);
            changeLog.Sort();
            changeLog.Reverse();
            if(changeLog.Count > 0)
            {
                newestAvailableVersion = changeLog[0].version;
            }

            if (includeBetaVersions)
            {
                getChangeLog(includeBetaVersions, newestAvailableVersion);
            }

            changeLog.Sort();
            changeLog.Reverse();
            if (changeLog.Count > 0)
            {
                newestAvailableVersion = changeLog[0].version;
                updateAvailable = true;
            }

            if (updateAvailable)
            {
                returnCode.updateAvailable = true;
                returnCode.updateInfoRetrievalSuccessfull = true;
                returnCode.version = newestAvailableVersion;
                returnCode.prettyName = changeLog[0].prettyName;

                returnCode.manualDownloadUrl = new System.Uri(getDownloadLinkUrl(includeBetaVersions));

                if(showWindowIfUpdateAvailable) {
                    Winkle.UpdateNotification myUpdateNotification = new UpdateNotification();

                    myUpdateNotification.setDownloadLink(returnCode.manualDownloadUrl.ToString());
                    string myDescription = "";

                    foreach (DescriptionOfChanges myChanges in changeLog) {
                            myDescription += myChanges.getFormattedVersionString() + "\n";
                            myDescription += myChanges.updateDescription;
                            myDescription += "\n============================================\n";
                    }
                    myUpdateNotification.setVersion(applicatenName, newestAvailableVersion.ToString());
                    myUpdateNotification.setShortDescription(applicatenName,newestAvailableVersion.ToString(),currentVersion);
                    myUpdateNotification.setDescription(myDescription);
                    myUpdateNotification.Show();
                }

                return returnCode;
            }

            returnCode.updateInfoRetrievalSuccessfull = true;
            return returnCode;
        }