/// <summary> /// Create /// /// Parses the standard Facebook user JSON object for the properties. Note that picture /// has been added manually to be included in the user object /// </summary> /// <param name="jsonUser"></param> /// <returns></returns> /// public static FacebookUser Create(System.Web.Security.FormsIdentity identity, JObject jsonUser) { FacebookUser user = new FacebookUser(); user.identity = identity; if (jsonUser != null) { JToken value = null; if (jsonUser.TryGetValue("id", out value)) { user.id = jsonUser.SelectToken("id").Value <String>(); } if (jsonUser.TryGetValue("name", out value)) { user.name = jsonUser.SelectToken("name").Value <String>(); } if (jsonUser.TryGetValue("first_name", out value)) { user.first_name = jsonUser.SelectToken("first_name").Value <String>(); } if (jsonUser.TryGetValue("last_name", out value)) { user.last_name = jsonUser.SelectToken("last_name").Value <String>(); } if (jsonUser.TryGetValue("gender", out value)) { user.gender = jsonUser.SelectToken("gender").Value <String>(); } if (jsonUser.TryGetValue("link", out value)) { user.link = jsonUser.SelectToken("link").Value <String>(); } if (jsonUser.TryGetValue("about", out value)) { user.about = jsonUser.SelectToken("about").Value <String>(); } if (jsonUser.TryGetValue("bio", out value)) { user.bio = jsonUser.SelectToken("bio").Value <String>(); } if (jsonUser.TryGetValue("birthday", out value)) { user.birthday = jsonUser.SelectToken("birthday").Value <String>(); } if (jsonUser.TryGetValue("email", out value)) { user.email = jsonUser.SelectToken("email").Value <String>(); } if (jsonUser.TryGetValue("hometown", out value)) { user.hometown = jsonUser.SelectToken("hometown").Value <String>(); } if (jsonUser.TryGetValue("location", out value)) { user.location = jsonUser.SelectToken("location").Value <String>(); } if (jsonUser.TryGetValue("quotes", out value)) { user.quotes = jsonUser.SelectToken("quotes").Value <String>(); } if (jsonUser.TryGetValue("picture", out value)) { user.picture = jsonUser.SelectToken("picture").Value <String>(); } if (jsonUser.TryGetValue("significant_other", out value)) { user.significant_other = FacebookFriend.Create((JObject)jsonUser.SelectToken("significant_other")); } } return(user); }