Exemplo n.º 1
0
        protected override string GetTitle()
        {
            string text = this.oEmbedResponse.Title;

            if (text != null)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(text);
                text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
                return(WebPageLinkPreviewBuilder.Truncate(text, 400));
            }
            return(null);
        }
        // Token: 0x060018D9 RID: 6361 RVA: 0x0005617C File Offset: 0x0005437C
        protected virtual string GetTitle()
        {
            string text  = null;
            Match  match = LinkPreviewBuilder.ExecuteRegEx(WebPageLinkPreviewBuilder.GetHtmlTitleRegEx, this.responseString, "title");

            if (match.Groups["title"].Captures.Count > 0)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["title"].Value);
                text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
            }
            this.logger.Set(GetLinkPreviewMetadata.TitleLength, WebPageLinkPreviewBuilder.GetStringLength(text));
            return(WebPageLinkPreviewBuilder.Truncate(text, 400));
        }
Exemplo n.º 3
0
        // Token: 0x060018E2 RID: 6370 RVA: 0x000563C4 File Offset: 0x000545C4
        protected override string GetDescription(out int descriptionTagCount)
        {
            string text  = null;
            Match  match = LinkPreviewBuilder.ExecuteRegEx(CraigsListLinkPreviewBuilder.GetDescriptionRegEx, this.responseString, "description");

            descriptionTagCount = match.Groups["description"].Captures.Count;
            if (descriptionTagCount > 0)
            {
                text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups["description"].Value);
                text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
            }
            this.logger.Set(GetLinkPreviewMetadata.DescriptionLength, WebPageLinkPreviewBuilder.GetStringLength(text));
            return(WebPageLinkPreviewBuilder.Truncate(text, 1000));
        }
        // Token: 0x060018D1 RID: 6353 RVA: 0x00055EB4 File Offset: 0x000540B4
        protected string GetAttributeValue(string responseString, Regex getTagRegex, string tagRegexKey, Regex getAttributeRegex, string attributeRegexKey, string propertyName, out int tagCount)
        {
            string          text            = null;
            MatchCollection matchCollection = LinkPreviewBuilder.ExecuteRegExForMatchCollection(getTagRegex, responseString, propertyName);

            tagCount = matchCollection.Count;
            if (tagCount > 0)
            {
                Match match = LinkPreviewBuilder.ExecuteRegEx(getAttributeRegex, matchCollection[0].Value, propertyName);
                if (match.Groups[attributeRegexKey].Captures.Count > 0)
                {
                    text = LinkPreviewBuilder.ConvertToSafeHtml(match.Groups[attributeRegexKey].Value);
                    text = WebPageLinkPreviewBuilder.ReplaceSelectedHtmlEntities(text);
                }
            }
            return(text);
        }