Esempio n. 1
0
        public static string FormatSecondaryContentMessage(List <Attachment> attachments, Geo geo)
        {
            if (attachments == null)
            {
                attachments = new List <Attachment>();
            }
            bool              flag  = SocialDataManager.AreAllMultiAttachmentsOfOneType(attachments, geo);
            string            str1  = "";
            string            str2  = "";
            List <Attachment> list1 = attachments.Where <Attachment>((Func <Attachment, bool>)(a => a.video != null)).ToList <Attachment>();

            if (list1.Count > 0)
            {
                if (!flag)
                {
                    str2 = str2 + SocialDataManager.FormatSecondaryContentTitle(attachments, null) + Environment.NewLine;
                }
                foreach (Attachment attachment in list1)
                {
                    str2 = str2 + SocialDataManager.FormatVideoStr(attachment.video) + Environment.NewLine;
                }
            }
            if (str2 != "")
            {
                str1 = str1 + str2 + Environment.NewLine;
            }
            List <Attachment> list2 = attachments.Where <Attachment>((Func <Attachment, bool>)(a => a.audio != null)).ToList <Attachment>();
            string            str3  = "";

            if (list2.Count > 0)
            {
                if (!flag)
                {
                    str3 = SocialDataManager.FormatSecondaryContentTitle(attachments, null) + Environment.NewLine;
                }
                foreach (Attachment attachment in list2)
                {
                    str3 = str3 + SocialDataManager.FormatAudioStr(attachment.audio) + Environment.NewLine;
                }
            }
            if (str3 != "")
            {
                str1 = str1 + str3 + Environment.NewLine;
            }
            List <Attachment> list3 = attachments.Where <Attachment>((Func <Attachment, bool>)(a => a.doc != null)).ToList <Attachment>();
            string            str4  = "";

            if (list3.Count > 0)
            {
                if (!flag)
                {
                    str4 = SocialDataManager.FormatSecondaryContentTitle(attachments, null) + Environment.NewLine;
                }
                foreach (Attachment attachment in list3)
                {
                    str4 = str4 + SocialDataManager.FormatDocStr(attachment.doc) + Environment.NewLine;
                }
            }
            if (str4 != "")
            {
                str1 += str4;
            }
            List <Attachment> list4 = attachments.Where <Attachment>((Func <Attachment, bool>)(a => a.poll != null)).ToList <Attachment>();
            string            str5  = "";

            if (list4.Count > 0)
            {
                if (!flag)
                {
                    str5 = BaseResources.Poll + Environment.NewLine;
                }
                str5 = str5 + list4[0].poll.question + Environment.NewLine;
            }
            if (str5 != "")
            {
                str1 = str1 + str5 + Environment.NewLine;
            }
            List <Attachment> list5 = attachments.Where <Attachment>((Func <Attachment, bool>)(a => a.note != null)).ToList <Attachment>();
            string            str6  = "";

            if (list5.Count > 0)
            {
                if (!flag)
                {
                    str6 = SocialDataManager.FormatSecondaryContentTitle(attachments, null) + Environment.NewLine;
                }
                foreach (Attachment attachment in list5)
                {
                    str6 = str6 + SocialDataManager.FormatNoteStr(attachment.note) + Environment.NewLine;
                }
            }
            if (str6 != "")
            {
                str1 = str1 + str6 + Environment.NewLine;
            }
            return(str1);
        }
Esempio n. 2
0
        public static string FormatSecondaryContentTitle(List <Attachment> attachments, Geo geo)
        {
            if (attachments == null)
            {
                attachments = new List <Attachment>();
            }
            attachments = attachments.Where <Attachment>((Func <Attachment, bool>)(a =>
            {
                if (a.photo == null && a.link == null)
                {
                    return(a.Page == null);
                }
                return(false);
            })).ToList <Attachment>();
            int count = attachments.Count;

            if (geo != null)
            {
                ++count;
            }
            if (count == 0)
            {
                return("");
            }
            if (count == 1)
            {
                if (geo != null)
                {
                    return(BaseResources.Location);
                }
                Attachment attachment = attachments[0];
                if (attachment.video != null)
                {
                    return(BaseResources.Video);
                }
                if (attachment.audio != null)
                {
                    return(BaseResources.Audio);
                }
                if (attachment.doc != null)
                {
                    return(BaseResources.Document);
                }
                if (attachment.note != null)
                {
                    return(BaseResources.Note);
                }
                if (attachment.poll != null)
                {
                    return(BaseResources.Poll);
                }
            }
            if (count > 1)
            {
                if (!SocialDataManager.AreAllMultiAttachmentsOfOneType(attachments, geo))
                {
                    return(BaseResources.Attachments);
                }
                List <Attachment>       source1    = attachments;
                Func <Attachment, bool> predicate1 = (Func <Attachment, bool>)(a => a.video != null);
                if (source1.Where <Attachment>(predicate1).Count <Attachment>() > 0)
                {
                    return(BaseResources.Videos);
                }
                List <Attachment>       source2    = attachments;
                Func <Attachment, bool> predicate2 = (Func <Attachment, bool>)(a => a.audio != null);
                if (source2.Where <Attachment>(predicate2).Count <Attachment>() > 0)
                {
                    return(BaseResources.Audios);
                }
                List <Attachment>       source3    = attachments;
                Func <Attachment, bool> predicate3 = (Func <Attachment, bool>)(a => a.doc != null);
                if (source3.Where <Attachment>(predicate3).Count <Attachment>() > 0)
                {
                    return(BaseResources.Documents);
                }
                List <Attachment>       source4    = attachments;
                Func <Attachment, bool> predicate4 = (Func <Attachment, bool>)(a => a.note != null);
                if (source4.Where <Attachment>(predicate4).Count <Attachment>() > 0)
                {
                    return(BaseResources.Notes);
                }
                List <Attachment>       source5    = attachments;
                Func <Attachment, bool> predicate5 = (Func <Attachment, bool>)(a => a.poll != null);
                if (source5.Where <Attachment>(predicate5).Count <Attachment>() > 0)
                {
                    return(BaseResources.Poll);
                }
            }
            return("");
        }