コード例 #1
0
        private async void checkForUpdateAsync()
        {
            try
            {
                var releases = new OsuJsonWebRequest <GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");

                await releases.PerformAsync();

                var latest = releases.ResponseObject;

                if (latest.TagName != version)
                {
                    Notifications.Post(new SimpleNotification
                    {
                        Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n"
                               + "Click here to download the new version, which can be installed over the top of your existing installation",
                        Icon      = FontAwesome.Solid.Upload,
                        Activated = () =>
                        {
                            host.OpenUrlExternally(getBestUrl(latest));
                            return(true);
                        }
                    });
                }
            }
            catch
            {
                // we shouldn't crash on a web failure. or any failure for the matter.
            }
        }
コード例 #2
0
        protected override async Task <bool> PerformUpdateCheck()
        {
            try
            {
                var releases = new OsuJsonWebRequest <GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");

                await releases.PerformAsync().ConfigureAwait(false);

                var latest = releases.ResponseObject;

                // avoid any discrepancies due to build suffixes for now.
                // eventually we will want to support release streams and consider these.
                version = version.Split('-').First();
                string latestTagName = latest.TagName.Split('-').First();

                if (latestTagName != version)
                {
                    Notifications.Post(new SimpleNotification
                    {
                        Text = $"A newer release of osu! has been found ({version} → {latestTagName}).\n\n"
                               + "Check with your package manager / provider to bring osu! up-to-date!",
                        Icon = FontAwesome.Solid.Upload,
                    });

                    return(true);
                }
            }
            catch
            {
                // we shouldn't crash on a web failure. or any failure for the matter.
                return(true);
            }

            return(false);
        }
コード例 #3
0
        protected override async Task <bool> PerformUpdateCheck()
        {
            try
            {
                var releases = new OsuJsonWebRequest <GitHubRelease>("https://github.com/Useless-Kurays/osu-kurays/releases/latest");

                await releases.PerformAsync();

                var latest = releases.ResponseObject;

                if (latest.TagName != version)
                {
                    Notifications.Post(new SimpleNotification
                    {
                        Text = $"Вышла новая версия ({version} → {latest.TagName}).\n\n"
                               + "Нажимай чтобы скачать",
                        Icon      = FontAwesome.Solid.Upload,
                        Activated = () =>
                        {
                            host.OpenUrlExternally(getBestUrl(latest));
                            return(true);
                        }
                    });

                    return(true);
                }
            }
            catch
            {
                // we shouldn't crash on a web failure. or any failure for the matter.
                return(true);
            }

            return(false);
        }
コード例 #4
0
        protected override async Task <bool> PerformUpdateCheck()
        {
            try
            {
                var releases = new OsuJsonWebRequest <GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");

                await releases.PerformAsync().ConfigureAwait(false);

                var latest = releases.ResponseObject;

                // avoid any discrepancies due to build suffixes for now.
                // eventually we will want to support release streams and consider these.
                version = version.Split('-').First();
                string latestTagName = latest.TagName.Split('-').First();

                if (latestTagName != version)
                {
                    Notifications.Post(new SimpleNotification
                    {
                        Text = $"A newer release of osu! has been found ({version} → {latestTagName}).\n\n"
                               + "Click here to download the new version, which can be installed over the top of your existing installation",
                        Icon      = FontAwesome.Solid.Upload,
                        Activated = () =>
                        {
                            host.OpenUrlExternally(getBestUrl(latest));
                            return(true);
                        }
                    });

                    return(true);
                }
            }
            catch
            {
                // we shouldn't crash on a web failure. or any failure for the matter.
                return(true);
            }

            return(false);
        }
コード例 #5
0
        protected override async Task <bool> PerformUpdateCheck()
        {
            // Use translation update repository instead.
            string repo = "https://api.github.com/repos/appleneko2001/osu/releases/latest";

            try
            {
                var releases = new OsuJsonWebRequest <GitHubRelease>(repo);

                await releases.PerformAsync();

                var latest = releases.ResponseObject;

                if (latest.TagName != version)
                {
                    Notifications.Post(new SimpleNotification
                    {
                        Text = $"最新的發行 osu! 已找到 ({version} → {latest.TagName}).\n\n"
                               + "點擊下載新版本 將會進行覆蓋安裝.", //Click here to download the new version, which can be installed over the top of your existing installation
                        Icon      = FontAwesome.Solid.Upload,
                        Activated = () =>
                        {
                            host.OpenUrlExternally(getBestUrl(latest));
                            return(true);
                        }
                    });

                    return(true);
                }
            }
            catch
            {
                // we shouldn't crash on a web failure. or any failure for the matter.
                return(true);
            }

            return(false);
        }