Exemplo n.º 1
0
        public bool TryAddResult(string Name, string text, string Link, int pageSize = PageMaxSize, int previewSize = PreviewSize)
        {
            if (Text.Length < pageSize)
            {
                string link = !string.IsNullOrEmpty(Name) ? Name : "Ссылка №" + count.ToString();
                string line = link + ":\n" + (text.Length > previewSize ? text.Substring(0, previewSize - 1) + "..." : text) + "\n\n";

                MessageEntity formatting = new MessageEntity()
                {
                    Length = link.Length + 1, Url = Link, Offset = offset, Type = MessageEntityType.TextLink
                };
                offset += line.Length;
                count++;
                Text += line;
                Formatting.Add(formatting);
                return(true);
            }
            else
            {
                return(false);
            }
        }