Exemplo n.º 1
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress <double> progress)
        {
            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, _remotePackageName, null, ApplicationVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);

            var isUpdateAvailable = versionObject != null && versionObject > ApplicationVersion;

            var result = versionObject != null ?
                         new CheckForUpdateResult {
                AvailableVersion = versionObject.ToString(), IsUpdateAvailable = isUpdateAvailable, Package = version
            } :
            new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false
            };

            HasUpdateAvailable = result.IsUpdateAvailable;

            if (result.IsUpdateAvailable)
            {
                Logger.Info("New application version is available: {0}", result.AvailableVersion);
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public async override Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress <double> progress)
        {
            var availablePackages = await PackageManager.GetAvailablePackages(CancellationToken.None).ConfigureAwait(false);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MBServerPkgName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            return(version != null ? new CheckForUpdateResult {
                AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion, IsUpdateAvailable = false
            });
        }
Exemplo n.º 3
0
        /// <summary>
        /// Checks for application update internal.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        private async Task <CheckForUpdateResult> CheckForApplicationUpdateInternal(CancellationToken cancellationToken,
                                                                                    IProgress <double> progress)
        {
            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None).ConfigureAwait(false);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, ApplicationUpdatePackageName, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            return(version != null ? new CheckForUpdateResult {
                AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion, IsUpdateAvailable = false
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress <double> progress)
        {
            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", null, ApplicationVersion,
                                                                         ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            HasUpdateAvailable = version != null && version.version >= ApplicationVersion;

            return(version != null ? new CheckForUpdateResult {
                AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion, IsUpdateAvailable = false
            });
        }
Exemplo n.º 5
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken,
                                                                                    IProgress <double> progress)
        {
            var serverInfo = await ApiClient.GetSystemInfoAsync().ConfigureAwait(false);

            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            var serverVersion = new Version(serverInfo.Version);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbTheaterPkgName, serverVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            return(version != null ? new CheckForUpdateResult {
                AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion, IsUpdateAvailable = false
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken,
                                                                                    IProgress <double> progress)
        {
            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            // Fake this with a really high number
            // With the idea of multiple servers there's no point in making server version a part of this
            var serverVersion = new Version(10, 0, 0, 0);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBTheater", null, serverVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);

            return(versionObject != null ? new CheckForUpdateResult {
                AvailableVersion = versionObject.ToString(), IsUpdateAvailable = versionObject > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false
            });
        }
Exemplo n.º 7
0
        /// <summary>
        /// Checks for update.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="progress">The progress.</param>
        /// <returns>Task{CheckForUpdateResult}.</returns>
        public override async Task <CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken,
                                                                                    IProgress <double> progress)
        {
            var serverInfo = await ApiClient.GetSystemInfoAsync(cancellationToken).ConfigureAwait(false);

            var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);

            var serverVersion = new Version(serverInfo.Version);

            var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBTheater", null, serverVersion, ConfigurationManager.CommonConfiguration.SystemUpdateLevel);

            var versionObject = version == null || string.IsNullOrWhiteSpace(version.versionStr) ? null : new Version(version.versionStr);

            return(versionObject != null ? new CheckForUpdateResult {
                AvailableVersion = versionObject.ToString(), IsUpdateAvailable = versionObject > ApplicationVersion, Package = version
            } :
                   new CheckForUpdateResult {
                AvailableVersion = ApplicationVersion.ToString(), IsUpdateAvailable = false
            });
        }