public string GenerateTitleIfNecessary(WallPost wallPost) { string str = ""; if (wallPost.attachments == null) { return(str); } if ((wallPost.attachments == null ? 0 : wallPost.attachments.Count <Attachment>((Func <Attachment, bool>)(a => a.photo != null))) > 0) { str = BaseFormatterHelper.FormatNumberOfSomething(wallPost.attachments.Count, BaseResources.OnePhotoFrm, BaseResources.TwoFourPhotosFrm, BaseResources.FivePhotosFrm, true, null, false); } List <Attachment> attachments1 = wallPost.attachments; Func <Attachment, bool> predicate1 = (Func <Attachment, bool>)(a => a.link != null); if (attachments1.Any <Attachment>(predicate1)) { str = BaseResources.Link; } List <Attachment> attachments2 = wallPost.attachments; Func <Attachment, bool> predicate2 = (Func <Attachment, bool>)(a => a.Page != null); if (attachments2.Any <Attachment>(predicate2)) { str = BaseResources.WikiPage; } return(str); }
private string GetPhotoPhotoTagFeedText(NewsItem newsFeedItem, List <Group> groups, List <User> users) { User user = users.FirstOrDefault <User>((Func <User, bool>)(u => u.uid == newsFeedItem.source_id)); if (user != null) { bool flag = user.sex == 2; if (newsFeedItem.Photo_tags != null && newsFeedItem.Photo_tags.Count > 0) { string str1 = flag ? BaseResources.Photo_WasTaggedMale : BaseResources.Photo_WasTaggedFemale; string str2 = BaseFormatterHelper.FormatNumberOfSomething(newsFeedItem.PhotoTagsCount, BaseResources.Photo_OnOnePhotoFrm, BaseResources.Photo_OnFivePhotosFrm, BaseResources.Photo_OnFivePhotosFrm, true, null, false); string str3 = " "; string str4 = str2; return(str1 + str3 + str4); } if (newsFeedItem.Photos != null && newsFeedItem.Photos.Count > 0) { string str1 = flag ? BaseResources.Photo_AddedMale : BaseResources.Photo_AddedFemale; string str2 = BaseFormatterHelper.FormatNumberOfSomething(newsFeedItem.PhotosCount, BaseResources.Photo_OnePhotoAddedFrm, BaseResources.Photo_TwoFourPhotosAddedFrm, BaseResources.Photo_FivePhotosAddedFrm, true, null, false); string str3 = " "; string str4 = str2; return(str1 + str3 + str4); } } return(""); }
private static string GetAttachmentsDesc(Message message) { string str = ""; if (message.attachments != null && message.attachments.Count > 0) { Attachment firstAttachment = message.attachments.First <Attachment>(); int number = message.attachments.Count <Attachment>((Func <Attachment, bool>)(a => a.type == firstAttachment.type)); string lowerInvariant = firstAttachment.type.ToLowerInvariant(); if (!(lowerInvariant == "photo")) { if (!(lowerInvariant == "video")) { if (!(lowerInvariant == "audio")) { if (!(lowerInvariant == "doc")) { if (lowerInvariant == "wall") { str = BaseResources.WallPost; } } else { str = BaseFormatterHelper.FormatNumberOfSomething(number, BaseResources.OneDocFrm, BaseResources.TwoFourDocsFrm, BaseResources.FiveDocsFrm, true, null, false); } } else { str = BaseFormatterHelper.FormatNumberOfSomething(number, BaseResources.OneAudioFrm, BaseResources.TwoFourAudiosFrm, BaseResources.FiveAudiosFrm, true, null, false); } } else { str = BaseFormatterHelper.FormatNumberOfSomething(number, BaseResources.OneVideoFrm, BaseResources.TwoFourVideosFrm, BaseResources.FiveVideosFrm, true, null, false); } } else { str = BaseFormatterHelper.FormatNumberOfSomething(number, BaseResources.OnePhotoFrm, BaseResources.TwoFourPhotosFrm, BaseResources.FivePhotosFrm, true, null, false); } } return(str); }
public static string FormatNumberOfSomething(int number, string oneSomethingFrm, string twoSomethingFrm, string fiveSomethingFrm, bool includeNumberInResult = true, string additionalFormatParam = null, bool includeZero = false) { return(BaseFormatterHelper.FormatNumberOfSomething(number, oneSomethingFrm, twoSomethingFrm, fiveSomethingFrm, includeNumberInResult, additionalFormatParam, includeZero)); }