其他分享
首页 > 其他分享> > GeneralUpdate 2021.08.14更新公告

GeneralUpdate 2021.08.14更新公告

作者:互联网

GeneralUpdate是基于.net standard2.0开发的一款(c/s应用)自动升级程序。该组件将更新的核心部分抽离出来方便应用于多种项目当中目前适用于wpf,控制台应用,winfrom。

1.Notice


1.主程序启动时检测升级程序是否需要更新

2.需要更新则把升级程序版本号上传并逐版本更新

3.升级程序更完成后或不需要更新,则进行判断主程序 是否需要更新如果需要更新则启动升级程序

4.请求主程序更新版本

5.请求到主版本多个更新包并逐版本更新 6.更新完成后关闭升级程序启动主程序

2.Nuget

3.Issues & Git 、Gitee

欢迎在以下地址提出issues提出时尽可能的描述清楚异常发生的原因或缺陷详情,check周期为每周的周五。

4.New

 

5.Remove

6.Fix

7.Quick Start

(1) Example GeneralUpdate.ClientCore

//Clinet version.
            var mainVersion = "1.1.1";
            var mianType = 1;

            //Updater version
            clientParameter = new ClientParameter();
            clientParameter.ClientVersion = "1.1.1";
            clientParameter.ClientType = 2;
            clientParameter.AppName = "AutoUpdate.ConsoleApp";
            clientParameter.MainAppName = "AutoUpdate.Test";
            clientParameter.InstallPath = @"D:\update_test";
            clientParameter.UpdateLogUrl = "https://www.baidu.com/";
            clientParameter.ValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }";
            clientParameter.UpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ clientParameter.ClientType }/{ clientParameter.ClientVersion }";
            clientParameter.MainValidateUrl = $"https://127.0.0.1:5001/api/update/getUpdateValidate/{ mianType }/{ mainVersion }";
            clientParameter.MainUpdateUrl = $"https://127.0.0.1:5001/api/update/getUpdateVersions/{ mianType }/{ mainVersion }";

            generalClientBootstrap = new GeneralClientBootstrap();
            generalClientBootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged;
            generalClientBootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics;
            generalClientBootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted;
            generalClientBootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted;
            generalClientBootstrap.MutiDownloadError += OnMutiDownloadError;
            generalClientBootstrap.Exception += OnException;
            generalClientBootstrap.Config(clientParameter).
                Strategy<ClientStrategy>();
            await generalClientBootstrap.LaunchTaskAsync();

(2) Example GeneralUpdate.Core

static void Main(string[] args)
    {
        var resultBase64 = args[0];
        var bootstrap = new GeneralUpdateBootstrap();
        bootstrap.Exception += OnException;
        bootstrap.MutiDownloadError += OnMutiDownloadError;
        bootstrap.MutiDownloadCompleted += OnMutiDownloadCompleted;
        bootstrap.MutiDownloadStatistics += OnMutiDownloadStatistics;
        bootstrap.MutiDownloadProgressChanged += OnMutiDownloadProgressChanged;
        bootstrap.MutiAllDownloadCompleted += OnMutiAllDownloadCompleted;
        bootstrap.Strategy<DefaultStrategy>().
            Option(UpdateOption.DownloadTimeOut, 60).
            RemoteAddressBase64(resultBase64).
            LaunchAsync();
    }

(3) Example GeneralUpdate.AspNetCore

Startup.cs
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllers();
        services.AddSingleton<IUpdateService, GeneralUpdateService>();
    }

    UpdateController.cs

    private readonly ILogger<UpdateController> _logger;
    private readonly IUpdateService _updateService;

    public UpdateController(ILogger<UpdateController> logger, IUpdateService updateService)
    {
        _logger = logger;
        _updateService = updateService;
    }

    /// <summary>
    /// https://localhost:5001/api/update/getUpdateVersions/1/1.1.1
    /// </summary>
    /// <param name="clientType"> 1:ClientApp 2:UpdateApp</param>
    /// <param name="clientVersion"></param>
    /// <returns></returns>
    [HttpGet("getUpdateVersions/{clientType}/{clientVersion}")]
    public async Task<IActionResult> GetUpdateVersions(int clientType, string clientVersion)
    {
        _logger.LogInformation("Client request 'GetUpdateVersions'.");
        var resultJson = await _updateService.UpdateVersionsTaskAsync(clientType, clientVersion, UpdateVersions);
        return Ok(resultJson);
    }

    /// <summary>
    /// https://localhost:5001/api/update/getUpdateValidate/1/1.1.1
    /// </summary>
    /// <param name="clientType"> 1:ClientApp 2:UpdateApp</param>
    /// <param name="clientVersion"></param>
    /// <returns></returns>
    [HttpGet("getUpdateValidate/{clientType}/{clientVersion}")]
    public async Task<IActionResult> GetUpdateValidate(int clientType, string clientVersion)
    {
        _logger.LogInformation("Client request 'GetUpdateValidate'.");
        var lastVersion = GetLastVersion();
        var resultJson = await _updateService.UpdateValidateTaskAsync(clientType, clientVersion, lastVersion, true, GetValidateInfos);
        return Ok(resultJson);
    }

标签:14,2021.08,更新,https,组件,generalClientBootstrap,GeneralUpdate,clientParameter
来源: https://www.cnblogs.com/justzhuzhu/p/15142438.html