コード例 #1
0
        public static Contributor FromJsonValue(JsonObject Source)
        {
            Contributor toret = new Contributor();

            toret.Account       = Source["login"].TryGetString();
            toret.DisplayName   = Source["name"].TryGetString();
            toret.AvatarUrl     = Source["avatar_url"].TryGetString();
            toret.ProfileUrl    = Source["profile"].TryGetString();
            toret.Contributions = new List <Contribution>();
            var contributions = Source["contributions"].GetArray();

            foreach (var contribution in contributions)
            {
                toret.Contributions.Add(stringToContribution(contribution.TryGetString()));
            }
            return(toret);
        }
コード例 #2
0
        public async static Task <List <Contributor> > GetContributorsAsync()
        {
            try
            {
                List <Contributor> toret  = new List <Contributor>();
                HttpClient         client = new HttpClient();
                var res = await client.GetAsync("https://raw.githubusercontent.com/tobiichiamane/pixivfs-uwp/master/.all-contributorsrc");

                var json  = JsonObject.Parse(await res.Content.ReadAsStringAsync());
                var array = json["contributors"].GetArray();
                foreach (var i in array)
                {
                    toret.Add(Contributor.FromJsonValue(i.GetObject()));
                }
                return(toret);
            }
            catch
            {
                return(null);
            }
        }