Example #1
0
        private UpdateInfo _doUpdateCheck(int currentMajorVersion, int currentMinorVersion, int currentBuild, int currentRevision, 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;
            }
            int major = getLatestMajorVersion(includeBetaVersions);
            int minor = getLatestMinorVersion(includeBetaVersions);
            int build = getLatestBuild(includeBetaVersions);
            int revision = getLatestRevision(includeBetaVersions);

            getChangeLog();
               // return returnCode;
            bool updateAvailable = false;

            if (currentMajorVersion < major)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion < minor)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild < build)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild == build && currentRevision < revision)
            {
                updateAvailable = true;
            }

            if (updateAvailable)
            {
                returnCode.updateAvailable = true;
                returnCode.updateInfoRetrievalSuccessfull = true;
                returnCode.updateMajor = major;
                returnCode.updateMinor = minor;
                returnCode.updateBuild = build;

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

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

                    myUpdateNotification.setDownloadLink(returnCode.manualDownloadUrl.ToString());
                    string myDescription = "";
                    Version newestVersion = new Version("0.0.0.0");

                    foreach (DescriptionOfChanges myChanges in changeLog) {
                        if (myChanges.version < newestVersion)
                        {
                            myDescription += "New in " + myChanges.getFormattedVersionString() + "\n";
                            myDescription += myChanges.updateDescription;
                            myDescription += "\n--------\n";
                        }
                        else
                        {
                            string tempString = "New in " + myChanges.getFormattedVersionString() + "\n";
                            tempString += myChanges.updateDescription;
                            tempString += "\n----------\n";
                            myDescription = tempString + myDescription;
                            newestVersion = myChanges.version;
                        }
                    }
                    myUpdateNotification.setVersion(applicatenName, newestVersion.ToString());
                    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;
        }
Example #3
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 #4
0
        private UpdateInfo _doUpdateCheck(int currentMajorVersion, int currentMinorVersion, int currentBuild, int currentRevision, 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);
            }
            int major    = getLatestMajorVersion(includeBetaVersions);
            int minor    = getLatestMinorVersion(includeBetaVersions);
            int build    = getLatestBuild(includeBetaVersions);
            int revision = getLatestRevision(includeBetaVersions);



            getChangeLog();
            // return returnCode;
            bool updateAvailable = false;

            if (currentMajorVersion < major)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion < minor)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild < build)
            {
                updateAvailable = true;
            }
            else if (currentMajorVersion == major && currentMinorVersion == minor && currentBuild == build && currentRevision < revision)
            {
                updateAvailable = true;
            }

            if (updateAvailable)
            {
                returnCode.updateAvailable = true;
                returnCode.updateInfoRetrievalSuccessfull = true;
                returnCode.updateMajor = major;
                returnCode.updateMinor = minor;
                returnCode.updateBuild = build;

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

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

                    myUpdateNotification.setDownloadLink(returnCode.manualDownloadUrl.ToString());
                    string  myDescription = "";
                    Version newestVersion = new Version("0.0.0.0");

                    foreach (DescriptionOfChanges myChanges in changeLog)
                    {
                        if (myChanges.version < newestVersion)
                        {
                            myDescription += "New in " + myChanges.getFormattedVersionString() + "\n";
                            myDescription += myChanges.updateDescription;
                            myDescription += "\n--------\n";
                        }
                        else
                        {
                            string tempString = "New in " + myChanges.getFormattedVersionString() + "\n";
                            tempString   += myChanges.updateDescription;
                            tempString   += "\n----------\n";
                            myDescription = tempString + myDescription;
                            newestVersion = myChanges.version;
                        }
                    }
                    myUpdateNotification.setVersion(applicatenName, newestVersion.ToString());
                    myUpdateNotification.setDescription(myDescription);
                    myUpdateNotification.Show();
                }

                return(returnCode);
            }

            returnCode.updateInfoRetrievalSuccessfull = true;
            return(returnCode);
        }