Пример #1
0
 /// <summary>parses json into a milestone</summary>
 /// <param name="json">json to parse</param>
 /// <returns>milestone corresponding to the json</returns>
 public static Milestone Parse(JObject json)
 {
     Milestone m = new Milestone();
     m.ID = (ulong)json["id"];
     m.Name = (string)json["name"];
     m.Description = (string)json["description"];
     m.IsCompleted = (bool?)json["is_completed"];
     m.DueOn = ((null == (int?)json["due_on"]) ? (DateTime?)null : new DateTime(1970, 1, 1).AddSeconds((int)json["due_on"]));
     m.CompletedOn = ((null == (int?)json["completed_on"]) ? (DateTime?)null : new DateTime(1970, 1, 1).AddSeconds((int)json["completed_on"]));
     m.ProjectID = (ulong)json["project_id"];
     m.Url = (string)json["url"];
     return m;
 }
Пример #2
0
 /// <summary>parses json into a milestone</summary>
 /// <param name="json">json to parse</param>
 /// <returns>milestone corresponding to the json</returns>
 public static Milestone Parse(JObject json)
 {
     var m = new Milestone
     {
         JsonFromResponse = json,
         ID = (ulong) json["id"],
         Name = (string) json["name"],
         Description = (string) json["description"],
         IsCompleted = (bool?) json["is_completed"],
         DueOn = ((null == (int?) json["due_on"]) ? (DateTime?) null : new DateTime(1970, 1, 1).AddSeconds((int) json["due_on"])),
         CompletedOn = ((null == (int?) json["completed_on"]) ? (DateTime?) null : new DateTime(1970, 1, 1).AddSeconds((int) json["completed_on"])),
         ProjectID = (ulong) json["project_id"],
         Url = (string) json["url"],
     };
     return m;
 }
Пример #3
0
        /// <summary>parses json into a milestone</summary>
        /// <param name="json">json to parse</param>
        /// <returns>milestone corresponding to the json</returns>
        public static Milestone Parse(JObject json)
        {
            var m = new Milestone
            {
                JsonFromResponse = json,
                ID          = (ulong)json["id"],
                Name        = (string)json["name"],
                Description = (string)json["description"],
                IsCompleted = (bool?)json["is_completed"],
                IsStarted   = (bool?)json["is_started"],
                DueOn       = null == (int?)json["due_on"] ? (DateTime?)null : new DateTime(1970, 1, 1).AddSeconds((int)json["due_on"]),
                CompletedOn = null == (int?)json["completed_on"] ? (DateTime?)null : new DateTime(1970, 1, 1).AddSeconds((int)json["completed_on"]),
                ProjectID   = (ulong)json["project_id"],
                Url         = (string)json["url"],
            };

            var jarray = json["milestones"] as JArray;

            if (null != jarray)
            {
                m.Milestones = JsonUtility.ConvertJArrayToList(jarray, Milestone.Parse);
            }
            return(m);
        }