예제 #1
0
        private static void NotifyOfNewUpdate(IApplicationManager manager, TheVersion currentVersion, Package package)
        {
            var window = GetWindowWithRect <UpdateCheckWindow>(new Rect(100, 100, 580, 400), true, windowTitle);

            window.Initialize(manager, currentVersion, package);
            window.Show();
        }
예제 #2
0
        private void Initialize(IApplicationManager manager, TheVersion current, Package newPackage)
        {
            package        = new GUIPackage(newPackage);
            currentVersion = current.ToString();
            var requiresRedraw = guiLogo != null;

            guiLogo = null;
            this.InitializeWindow(manager, requiresRedraw);
        }
예제 #3
0
        public static void CheckForUpdates(IApplicationManager manager)
        {
            var download = new DownloadTask(manager.TaskManager.Token, manager.Environment.FileSystem, UpdateFeedUrl, manager.Environment.UserCachePath)
                           .Catch(ex =>
            {
                LogHelper.Warning(@"Error downloading update check:{0} ""{1}""", UpdateFeedUrl, ex.GetExceptionMessageShort());
                return(true);
            });

            download.OnEnd += (thisTask, result, success, exception) =>
            {
                if (success)
                {
                    try
                    {
                        Package    package    = result.ReadAllText().FromJson <Package>(lowerCase: true, onlyPublic: false);
                        TheVersion current    = TheVersion.Parse(ApplicationInfo.Version);
                        TheVersion newVersion = package.Version;

                        var versionToSkip = manager.UserSettings.Get <TheVersion>(Constants.SkipVersionKey);
                        if (versionToSkip == newVersion)
                        {
                            LogHelper.Info("Skipping GitHub for Unity update v" + newVersion);
                            return;
                        }

                        if (newVersion <= current)
                        {
                            LogHelper.Trace("Skipping GitHub for Unity update v" + newVersion + ", we already have it");
                            return;
                        }

                        manager.TaskManager.RunInUI(() =>
                        {
                            NotifyOfNewUpdate(manager, current, package);
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.GetLogger <UpdateCheckWindow>().Error(ex);
                    }
                }
            };
            download.Start();
        }