using System; using System.Diagnostics.CodeAnalysis; using System.Text; using System.Text.Json.Serialization; namespace FastGithub.Upgrade { /// /// 发行记录 /// public class GithubRelease { /// /// 标签名 /// [JsonPropertyName("tag_name")] public string TagName { get; set; } = string.Empty; /// /// 是否预览版本 /// [JsonPropertyName("prerelease")] public bool Prerelease { get; set; } /// /// 发行说明 /// [JsonPropertyName("body")] public string Body { get; set; } = string.Empty; /// /// 发行时间 /// [JsonPropertyName("created_at")] public DateTime CreatedAt { get; set; } /// /// 下载页面 /// [AllowNull] [JsonPropertyName("html_url")] public Uri HtmlUrl { get; set; } /// /// 获取产品版本 /// /// public ProductionVersion GetProductionVersion() { var version = this.TagName.TrimStart('v', 'V'); return ProductionVersion.Parse(version); } public override string ToString() { return new StringBuilder() .Append("最新版本:").AppendLine(this.TagName) .Append("发布时间:").AppendLine(this.CreatedAt.ToString()) .AppendLine("更新内容:").AppendLine(this.Body) .ToString(); } } }