This repository has been archived by the owner on Jul 27, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CardSharp | ||
{ | ||
public static class ReleaseGetter | ||
{ | ||
public static ReleaseData Get() | ||
{ | ||
ServicePointManager.Expect100Continue = true; | ||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; | ||
var wc = new WebClient { Encoding = Encoding.UTF8 }; | ||
wc.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"); | ||
return wc.DownloadString("https://api.github.com/repos/Cyl18/CardSharp/releases/latest").JsonDeserialize<ReleaseData>(); | ||
} | ||
} | ||
|
||
public class ReleaseData | ||
{ | ||
public string url { get; set; } | ||
public string assets_url { get; set; } | ||
public string upload_url { get; set; } | ||
public string html_url { get; set; } | ||
public int id { get; set; } | ||
public string tag_name { get; set; } | ||
public string target_commitish { get; set; } | ||
public object name { get; set; } | ||
public bool draft { get; set; } | ||
public Author2 author { get; set; } | ||
public bool prerelease { get; set; } | ||
public DateTime created_at { get; set; } | ||
public DateTime published_at { get; set; } | ||
public Asset[] assets { get; set; } | ||
public string tarball_url { get; set; } | ||
public string zipball_url { get; set; } | ||
public object body { get; set; } | ||
} | ||
|
||
public class Author2 | ||
{ | ||
public string login { get; set; } | ||
public int id { get; set; } | ||
public string avatar_url { get; set; } | ||
public string gravatar_id { get; set; } | ||
public string url { get; set; } | ||
public string html_url { get; set; } | ||
public string followers_url { get; set; } | ||
public string following_url { get; set; } | ||
public string gists_url { get; set; } | ||
public string starred_url { get; set; } | ||
public string subscriptions_url { get; set; } | ||
public string organizations_url { get; set; } | ||
public string repos_url { get; set; } | ||
public string events_url { get; set; } | ||
public string received_events_url { get; set; } | ||
public string type { get; set; } | ||
public bool site_admin { get; set; } | ||
} | ||
|
||
public class Asset | ||
{ | ||
public string url { get; set; } | ||
public int id { get; set; } | ||
public string name { get; set; } | ||
public string label { get; set; } | ||
public Uploader uploader { get; set; } | ||
public string content_type { get; set; } | ||
public string state { get; set; } | ||
public int size { get; set; } | ||
public int download_count { get; set; } | ||
public DateTime created_at { get; set; } | ||
public DateTime updated_at { get; set; } | ||
public string browser_download_url { get; set; } | ||
} | ||
|
||
public class Uploader | ||
{ | ||
public string login { get; set; } | ||
public int id { get; set; } | ||
public string avatar_url { get; set; } | ||
public string gravatar_id { get; set; } | ||
public string url { get; set; } | ||
public string html_url { get; set; } | ||
public string followers_url { get; set; } | ||
public string following_url { get; set; } | ||
public string gists_url { get; set; } | ||
public string starred_url { get; set; } | ||
public string subscriptions_url { get; set; } | ||
public string organizations_url { get; set; } | ||
public string repos_url { get; set; } | ||
public string events_url { get; set; } | ||
public string received_events_url { get; set; } | ||
public string type { get; set; } | ||
public bool site_admin { get; set; } | ||
} | ||
} |