private List<TwitterTextPart> GetTwitterParts(ref List<string> DataArr, ref int DataCounter, string FormatString, string SplitText, TwitterTextType NonStringType, bool IsReturnNull)
        {
            List<TwitterTextPart> parts = new List<TwitterTextPart>();

            string[] linkSplitted = FormatString.Split(new string[] { SplitText }, StringSplitOptions.None);
            if (linkSplitted.Length > 1) {
                bool IsFirstAdded = false;
                foreach (string part in linkSplitted) {
                    if (IsFirstAdded) {
                        parts.Add(new TwitterTextPart {
                            Type = NonStringType,
                            Data = DataArr[DataCounter++]
                        });
                    }
                    parts.Add(new TwitterTextPart {
                        Type = TwitterTextType.Text,
                        Data = part
                    });
                    IsFirstAdded = true;
                }
                return parts;
            } else {
                if (IsReturnNull) {
                    return null;
                }
                parts.Add(new TwitterTextPart {
                    Data = FormatString,
                    Type = TwitterTextType.Text
                });
                return parts;
            }
        }
Example #2
0
        private List <TwitterTextPart> GetTwitterParts(ref List <string> DataArr, ref int DataCounter, string FormatString, string SplitText, TwitterTextType NonStringType, bool IsReturnNull)
        {
            List <TwitterTextPart> parts = new List <TwitterTextPart>();

            string[] linkSplitted = FormatString.Split(new string[] { SplitText }, StringSplitOptions.None);
            if (linkSplitted.Length > 1)
            {
                bool IsFirstAdded = false;
                foreach (string part in linkSplitted)
                {
                    if (IsFirstAdded)
                    {
                        parts.Add(new TwitterTextPart {
                            Type = NonStringType,
                            Data = DataArr[DataCounter++]
                        });
                    }
                    parts.Add(new TwitterTextPart {
                        Type = TwitterTextType.Text,
                        Data = part
                    });
                    IsFirstAdded = true;
                }
                return(parts);
            }
            else
            {
                if (IsReturnNull)
                {
                    return(null);
                }
                parts.Add(new TwitterTextPart {
                    Data = FormatString,
                    Type = TwitterTextType.Text
                });
                return(parts);
            }
        }