Esempio n. 1
0
        public static CommitEvent FromJson(JObject jsonObject)
        {
            var result = new CommitEvent();

            result.Sha    = jsonObject.GetValue("sha").ToString();
            result.Author = jsonObject.GetValue("author").ToObject <JObject>().GetValue("login").ToString();
            var dateString = jsonObject.GetValue("commit").ToObject <JObject>().GetValue("committer").ToObject <JObject>().GetValue("date").ToString();

            result.Date = new Date(DateTime.Parse(dateString));
            return(result);
        }
Esempio n. 2
0
        private void GetCommits(string parameter, ref List <CommitEvent> output)
        {
            var jsonResult  = JObject.Parse(GetWebResponse(_baseUrl + "commits/" + parameter));
            var commitEvent = CommitEvent.FromJson(jsonResult);

            if (!output.Select(c => c.Sha).Contains(commitEvent.Sha))
            {
                output.Add(commitEvent);
                var parents = jsonResult.GetValue("parents").ToObject <JArray>();
                if (parents.Count > 0)
                {
                    foreach (JObject parent in parents)
                    {
                        GetCommits(parent.GetValue("sha").ToString(), ref output);
                    }
                }
            }
        }