private bool ProcessRelease(GitHubRelease serverRelease)
        {
            using (AppLogger.Log.InfoCall())
            {
                AppLogger.Log.Info("Checking version: ", serverRelease);
                if (serverRelease.prerelease && !Beta)
                {
                    AppLogger.Log.Info("Pre-release and not in Beta Mode.");
                    return(false);
                }

                var version   = new Version(serverRelease.tag_name.Substring(1));
                var changelog = Regex.Split(serverRelease.body, "\r\n|\r|\n");
                try
                {
                    if (version > AppVersion)
                    {
                        var installer = serverRelease.assets.First(asset => asset.name.EndsWith(".exe"));
                        var release   = new Release(version, installer, serverRelease.name);
                        release.Changelog.AddRange(changelog);
                        UpdateAvailable?.Invoke(this, new NewReleaseEvent(release));
                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    AppLogger.Log.Error("Exception while getting release ", ex);
                }
                return(false);
            }
        }
        private bool ProcessRelease(GitHubRelease serverRelease)
        {
            using (AppLogger.Log.InfoCall())
            {
                AppLogger.Log.Info("Checking version: ", serverRelease);
                if (serverRelease.prerelease && !Beta)
                {
                    AppLogger.Log.Info("Pre-release and not in Beta Mode.");
                    return false;
                }

                if (!serverRelease.prerelease && Beta)
                {
                    AppLogger.Log.Info("Release and in Beta Mode.");
                    return false;
                }

                var version = new Version(serverRelease.tag_name.Substring(1));
                var changelog = Regex.Split(serverRelease.body, "\r\n|\r|\n");
                try
                {
                    if (version > AppVersion)
                    {
                        var installer = serverRelease.assets.First(asset => asset.name.EndsWith(".exe"));
                        var release = new Release(version, installer, serverRelease.name);
                        release.Changelog.AddRange(changelog);
                        UpdateAvailable?.Invoke(this, new NewReleaseEvent(release));
                        return true;
                    }
                }
                catch (Exception ex)
                {
                    AppLogger.Log.Error("Exception while getting release ", ex);
                }
                return false;
            }
        }
Exemple #3
0
 public Release(Version releaseVersion, GitHubRelease.Asset asset, string name)
 {
     ReleaseVersion = releaseVersion;
     Asset = asset;
     Name = name;
 }