تهیهی گزارش از آخرین ارائههای یک پروژه در GitHub
نویسنده: وحید نصیری
تاریخ: ۱۳۹۴/۰۱/۰۳ ۱۱:۲۰
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
[
{
release_info,
"assets": [
{
}
]
}
] using Newtonsoft.Json;
using System;
namespace ApplicationAnnouncements
{
public class GitHubProjectRelease
{
[JsonProperty(PropertyName = "url")]
public string Url { get; set; }
[JsonProperty(PropertyName = "assets_url")]
public string AssetsUrl { get; set; }
[JsonProperty(PropertyName = "upload_url")]
public string UploadUrl { get; set; }
[JsonProperty(PropertyName = "html_url")]
public string HtmlUrl { get; set; }
[JsonProperty(PropertyName = "id")]
public int Id { get; set; }
[JsonProperty(PropertyName = "tag_name")]
public string TagName { get; set; }
[JsonProperty(PropertyName = "target_commitish")]
public string TargetCommitish { get; set; }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "body")]
public string Body { get; set; }
[JsonProperty(PropertyName = "draft")]
public bool Draft { get; set; }
[JsonProperty(PropertyName = "prerelease")]
public bool PreRelease { get; set; }
[JsonProperty(PropertyName = "created_at")]
public DateTime CreatedAt { get; set; }
[JsonProperty(PropertyName = "published_at")]
public DateTime PublishedAt { get; set; }
[JsonProperty(PropertyName = "assets")]
public Asset[] Assets { get; set; }
}
public class Asset
{
[JsonProperty(PropertyName = "url")]
public string Url { get; set; }
[JsonProperty(PropertyName = "id")]
public int Id { get; set; }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "label")]
public string Label { get; set; }
[JsonProperty(PropertyName = "content_type")]
public string ContentType { get; set; }
[JsonProperty(PropertyName = "state")]
public string State { get; set; }
[JsonProperty(PropertyName = "size")]
public int Size { get; set; }
[JsonProperty(PropertyName = "download_count")]
public int DownloadCount { get; set; }
[JsonProperty(PropertyName = "created_at")]
public DateTime CreatedAt { get; set; }
[JsonProperty(PropertyName = "updated_at")]
public DateTime UpdatedAt { get; set; }
}
} using (var webClient = new WebClient())
{
webClient.Headers.Add("user-agent", "DNTProfiler");
var jsonData = webClient.DownloadString(url);
var gitHubProjectReleases = JsonConvert.DeserializeObject<GitHubProjectRelease[]>(jsonData);
foreach (var release in gitHubProjectReleases)
{
foreach (var asset in release.Assets)
{
// …
}
}
}