App_Code/Sections/HtmlContent.cs

(完整代码) 1KB

//===============================================================================================
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
//
//===============================================================================================

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Collections.Generic;

namespace MyWebPagesStarterKit
{
    public class HtmlContent : Section<HtmlContent.HtmlContentData>
    {
        public HtmlContent() : base() { }
        public HtmlContent(string id) : base(id) { }

        public string Html
        {
            get { return _data.Html; }
            set { _data.Html = value; }
        }

        public override List<SearchResult> Search(string searchString, WebPage page)
        {
            List<SearchResult> foundResults = new List<SearchResult>();
            if ((HttpUtility.HtmlDecode(SearchResult.RemoveHtml(Html))).IndexOf(searchString, StringComparison.CurrentCultureIgnoreCase) > -1)
                foundResults.Add(new SearchResult(
                    string.Format("~/Default.aspx?pg={0}#{1}", page.PageId, SectionId),
                    page.Title,
                    SearchResult.CreateExcerpt((HttpUtility.HtmlDecode(SearchResult.RemoveHtml(Html))), searchString)
                    )
                );

            return foundResults;
        }

        public class HtmlContentData
        {
            public HtmlContentData()
            {
                Html = string.Empty;
            }

            public string Html;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。