public string[] GetWordsFromComment(ActivityComment comment) { if (comment == null) { return(null); } return(GetWords(comment.Text, (comment.FromUser != null) ? comment.FromUser.Name : "")); }
private ActivityComment _DeserializePhotoComment(JSON_OBJECT jsonComment) { var comment = new ActivityComment(_service) { CommentType = ActivityComment.Type.Photo, CommentId = _SafeGetId(jsonComment, "pcid"), FromUserId = _SafeGetId(jsonComment, "from"), Time = _SafeGetDateTime(jsonComment, "time") ?? _UnixEpochTime, Text = _SafeGetString(jsonComment, "body"), }; return(comment); }
public object[] GetRelevantFacebookObjects(object o) { List <object> objects = new List <object>(); FacebookContact contact = o as FacebookContact; if (contact != null) { foreach (var post in _service.RawNewsFeed) { if (post.ActorUserId == contact.UserId) { objects.Add(post); } foreach (var comment in post.Comments) { if (comment.FromUserId == contact.UserId) { objects.Add(comment); } } } foreach (var album in _service.RawPhotoAlbums) { if (album.OwnerId == contact.UserId) { objects.Add(album); } foreach (var photo in album.Photos) { if (photo.OwnerId == contact.UserId) { objects.Add(photo); continue; } foreach (var tag in photo.Tags) { if (tag.Contact != null && tag.Contact.UserId == contact.UserId) { objects.Add(photo); goto next; } } next :; } } } FacebookPhoto p = o as FacebookPhoto; if (p != null) { objects.Add(p.Album); if (p.Album.Owner != null) { objects.Add(p.Album.Owner); } foreach (var tag in p.Tags) { if (tag.Contact != null && !objects.Contains(tag.Contact)) { objects.Add(tag.Contact); } } } FacebookPhotoAlbum a = o as FacebookPhotoAlbum; if (a != null) { if (a.Owner != null) { objects.Add(a.Owner); } foreach (var photo in a.Photos) { objects.Add(photo); foreach (var tag in photo.Tags) { if (tag.Contact != null && !objects.Contains(tag.Contact)) { objects.Add(tag.Contact); } } } } ActivityPost activityPost = o as ActivityPost; if (activityPost != null) { if (activityPost.Actor != null) { objects.Add(activityPost.Actor); } if (activityPost.Target != null) { objects.Add(activityPost.Target); } foreach (var comment in activityPost.Comments) { objects.Add(comment); } } ActivityComment activityComment = o as ActivityComment; if (activityComment != null) { if (activityComment.FromUser != null) { objects.Add(activityComment.FromUser); } } objects.Sort(new SearchResultsComparer()); return(objects.ToArray()); }