示例#1
0
        /// <inheritdoc />
        public override async Task <string> DownloadInstallerAsync(UpdateManifest manifest)
        {
            try
            {
                var path = Path.Combine(Globals.AppDataFolder, Globals.Updates.TempFolder);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                var fileName = Path.Combine(path, $"Micser-{manifest.Version}.msi");

                using (var webClient = new WebClient())
                {
                    await webClient.DownloadFileTaskAsync(manifest.FileName, fileName).ConfigureAwait(false);
                }

                return(fileName);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(null);
            }
        }
示例#2
0
        /// <inheritdoc />
        public virtual bool IsUpdateAvailable(UpdateManifest manifest)
        {
            if (manifest == null)
            {
                return(false);
            }

            var updateVersion  = new Version(manifest.Version);
            var currentVersion = Assembly.GetEntryAssembly()?.GetName().Version;

            return(updateVersion > currentVersion);
        }
示例#3
0
 /// <inheritdoc />
 public abstract Task <string> DownloadInstallerAsync(UpdateManifest manifest);