Esempio n. 1
0
        /// <summary>
        /// If new release is available, then return the new release
        /// otherwise, return null
        /// </summary>
        /// <returns></returns>
        public Release CheckUpgrade(bool forceCheck = false)
        {
            if (checkedUpdate && !forceCheck) return newRelease;
            string json = HttpRequest.Get(updateURL);
            if (string.IsNullOrEmpty(json)) return null;

            try
            {
                newRelease = JsonConvert.DeserializeObject<Release>(json);
                if (!IsNewerThanCurrent(newRelease))
                {
                    newRelease = null;
                }
                checkedUpdate = true;
            }
            catch{}

            return newRelease;
        }
Esempio n. 2
0
        private bool IsNewerThanCurrent(Release release)
        {
            if (release == null) return false;

            string currentVersion = ConfigurationManager.AppSettings["version"];
            return CompareVersion(release.version, currentVersion) > 0;
        }