50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Security.Permissions;
|
|
|
|
namespace updater
|
|
{
|
|
public class UpgradeInfo
|
|
{
|
|
public int Id { get; set; }
|
|
public int PublishType { get; set; }
|
|
public string Version { get; set; }
|
|
[JsonProperty("download_url")]
|
|
public string DownloadUrl { get; set; }
|
|
public string Message { get; set; }
|
|
|
|
/// <summary>
|
|
/// 1强制升级
|
|
/// 2强制提示
|
|
/// 3弱提示
|
|
/// </summary>
|
|
[JsonProperty("upgrade_type")]
|
|
public int UpgradeType { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否显示弹框 1:显示2:不显示
|
|
/// </summary>
|
|
[JsonProperty("is_show_pop")]
|
|
public int ShowPop { get; set; }
|
|
|
|
//public int VersionCode { get; set; }
|
|
//public string Log { get; set; }
|
|
//public string UpdateFile { get; set; }
|
|
|
|
public bool NeedUpgrade(string currentVersion)
|
|
{
|
|
var remoteVer = new Version(Version);
|
|
var currentVer = new Version(currentVersion);
|
|
return remoteVer > currentVer;
|
|
}
|
|
}
|
|
public class UpgradeModel
|
|
{
|
|
[JsonProperty("msg")]
|
|
public string Message { get; set; }
|
|
public int Code { get; set; }
|
|
[JsonProperty("data")]
|
|
public UpgradeInfo Info { get; set; }
|
|
}
|
|
}
|