From 25b4ff771e8e86d6eb42c10e281747c507899d3a Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Fri, 5 Aug 2022 20:28:20 +0800 Subject: [PATCH] fix Pre-Release Updates --- v2rayN/v2rayN/Handler/UpdateHandle.cs | 2 +- v2rayN/v2rayN/Mode/GitHubRelease.cs | 75 ++++++++++++++------------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 4e56f3ad..90408c25 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -398,7 +398,7 @@ namespace v2rayN.Handler { try { - var gitHubReleases = JsonConvert.DeserializeObject>(gitHubReleaseApi); + var gitHubReleases = Utils.FromJson>(gitHubReleaseApi); string version; if (preRelease) { diff --git a/v2rayN/v2rayN/Mode/GitHubRelease.cs b/v2rayN/v2rayN/Mode/GitHubRelease.cs index 9296d991..eaa374c6 100644 --- a/v2rayN/v2rayN/Mode/GitHubRelease.cs +++ b/v2rayN/v2rayN/Mode/GitHubRelease.cs @@ -2,68 +2,69 @@ using System.Collections.Generic; using Newtonsoft.Json; -namespace v2rayN.Mode; - -public class Asset +namespace v2rayN.Mode { - [JsonProperty("url")] public string Url { get; set; } + public class GitHubReleaseAsset + { + [JsonProperty("url")] public string Url { get; set; } - [JsonProperty("id")] public int Id { get; set; } + [JsonProperty("id")] public int Id { get; set; } - [JsonProperty("node_id")] public string NodeId { get; set; } + [JsonProperty("node_id")] public string NodeId { get; set; } - [JsonProperty("name")] public string Name { get; set; } + [JsonProperty("name")] public string Name { get; set; } - [JsonProperty("label")] public object Label { get; set; } - - [JsonProperty("content_type")] public string ContentType { get; set; } + [JsonProperty("label")] public object Label { get; set; } - [JsonProperty("state")] public string State { get; set; } + [JsonProperty("content_type")] public string ContentType { get; set; } - [JsonProperty("size")] public int Size { get; set; } + [JsonProperty("state")] public string State { get; set; } - [JsonProperty("download_count")] public int DownloadCount { get; set; } + [JsonProperty("size")] public int Size { get; set; } - [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } + [JsonProperty("download_count")] public int DownloadCount { get; set; } - [JsonProperty("updated_at")] public DateTime UpdatedAt { get; set; } + [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } - [JsonProperty("browser_download_url")] public string BrowserDownloadUrl { get; set; } -} + [JsonProperty("updated_at")] public DateTime UpdatedAt { get; set; } -public class GitHubRelease -{ - [JsonProperty("url")] public string Url { get; set; } + [JsonProperty("browser_download_url")] public string BrowserDownloadUrl { get; set; } + } + + public class GitHubRelease + { + [JsonProperty("url")] public string Url { get; set; } + + [JsonProperty("assets_url")] public string AssetsUrl { get; set; } - [JsonProperty("assets_url")] public string AssetsUrl { get; set; } + [JsonProperty("upload_url")] public string UploadUrl { get; set; } - [JsonProperty("upload_url")] public string UploadUrl { get; set; } + [JsonProperty("html_url")] public string HtmlUrl { get; set; } - [JsonProperty("html_url")] public string HtmlUrl { get; set; } + [JsonProperty("id")] public int Id { get; set; } - [JsonProperty("id")] public int Id { get; set; } - - [JsonProperty("node_id")] public string NodeId { get; set; } + [JsonProperty("node_id")] public string NodeId { get; set; } - [JsonProperty("tag_name")] public string TagName { get; set; } + [JsonProperty("tag_name")] public string TagName { get; set; } - [JsonProperty("target_commitish")] public string TargetCommitish { get; set; } + [JsonProperty("target_commitish")] public string TargetCommitish { get; set; } - [JsonProperty("name")] public string Name { get; set; } + [JsonProperty("name")] public string Name { get; set; } - [JsonProperty("draft")] public bool Draft { get; set; } + [JsonProperty("draft")] public bool Draft { get; set; } - [JsonProperty("prerelease")] public bool Prerelease { get; set; } + [JsonProperty("prerelease")] public bool Prerelease { get; set; } - [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } + [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } - [JsonProperty("published_at")] public DateTime PublishedAt { get; set; } + [JsonProperty("published_at")] public DateTime PublishedAt { get; set; } - [JsonProperty("assets")] public List Assets { get; set; } + [JsonProperty("assets")] public List Assets { get; set; } - [JsonProperty("tarball_url")] public string TarballUrl { get; set; } + [JsonProperty("tarball_url")] public string TarballUrl { get; set; } - [JsonProperty("zipball_url")] public string ZipballUrl { get; set; } + [JsonProperty("zipball_url")] public string ZipballUrl { get; set; } - [JsonProperty("body")] public string Body { get; set; } + [JsonProperty("body")] public string Body { get; set; } + } } \ No newline at end of file