Esempio n. 1
0
        public bool Matches(string text, bool nameOnly)
        {
            CultureInfo Culture = CultureInfo.InvariantCulture;

            if (nameOnly)
            {
                return(Culture.CompareInfo.IndexOf(Name ?? "", text, CompareOptions.IgnoreCase) >= 0);
            }
            return(Culture.CompareInfo.IndexOf(Name ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Source ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Description ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Alignment ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Speeds.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Senses.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Resistances.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Vulnerablities.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Immunities.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Languages.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   ConditionImmunities.Exists(s => Culture.CompareInfo.IndexOf(s ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Descriptions.Exists(s => s.Matches(text, nameOnly)) ||
                   Traits.Exists(s => s.Matches(text, nameOnly)) ||
                   LegendaryActions.Exists(s => s.Matches(text, nameOnly)) ||
                   Actions.Exists(s => s.Matches(text, nameOnly)) ||
                   Keywords.Exists(s => Culture.CompareInfo.IndexOf(s.Name ?? "", text, CompareOptions.IgnoreCase) >= 0));
        }
Esempio n. 2
0
 private void SaveKeyword(string keyword)
 {
     if (Keywords.Exists(keyword))
     {
         Keywords.UpdateHitsByKeywordName(keyword);
     }
 }
        public override bool Matches(string text, bool nameOnly)
        {
            CultureInfo Culture = CultureInfo.InvariantCulture;

            if (nameOnly)
            {
                return(Culture.CompareInfo.IndexOf(Name ?? "", text, CompareOptions.IgnoreCase) >= 0);
            }
            return(Culture.CompareInfo.IndexOf(Name ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Text ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Prerequisite ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Culture.CompareInfo.IndexOf(Category ?? "", text, CompareOptions.IgnoreCase) >= 0 ||
                   Keywords.Exists(s => Culture.CompareInfo.IndexOf(s.Name ?? "", text, CompareOptions.IgnoreCase) >= 0) ||
                   Features.Exists(f => f.Matches(text, nameOnly)));
        }
Esempio n. 4
0
        public override void OnInitTemplateInfo(EventArgs e)
        {
            TemplateInfo info        = new TemplateInfo();
            string       keywordText = DataSecurity.FilterBadChar(BasePage.RequestString("keyword"));

            if (Keywords.Exists(keywordText))
            {
                Keywords.UpdateHitsByKeywordName(keywordText);
            }
            info.QueryList = base.Request.QueryString;
            info.PageName  = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
            string path = "";

            path = "/其他模板/Tag标签页模板.html";
            info.TemplateContent = Template.GetTemplateContent(path);
            info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
            info.IsDynamicPage   = true;
            info.PageType        = 1;
            base.TemplateInfo    = info;
        }
Esempio n. 5
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string text = this.TxtKeywordText.Text;

            if (string.IsNullOrEmpty(text))
            {
                AdminPage.WriteErrMsg("<li>关键字不能为空!</li>");
            }
            if (string.IsNullOrEmpty(this.TxtPriority.Text))
            {
                AdminPage.WriteErrMsg("<li>关键字权重不能为空!</li>");
            }
            KeywordInfo keywordInfo = new KeywordInfo();

            if (this.ViewState["action"].ToString() == "Add")
            {
                if (!Keywords.Exists(text))
                {
                    keywordInfo.KeywordText = text;
                    keywordInfo.KeywordType = DataConverter.CLng(this.RadlKeywordType.SelectedValue);
                    keywordInfo.Priority    = DataConverter.CLng(this.TxtPriority.Text);
                    if (Keywords.Add(keywordInfo))
                    {
                        AdminPage.WriteSuccessMsg("<li>添加关键字成功!</li>", "KeyWordManage.aspx");
                    }
                    else
                    {
                        AdminPage.WriteErrMsg("<li>添加关键字操作失败!</li>");
                    }
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>数据库中已经存在此关键字!</li>");
                }
            }
            else
            {
                bool flag;
                if (text == this.HdnKeywordText.Value)
                {
                    flag = false;
                }
                else
                {
                    flag = Keywords.Exists(text);
                }
                if (!flag)
                {
                    keywordInfo.KeywordId   = BasePage.RequestInt32("KeywordID");
                    keywordInfo.KeywordText = text;
                    keywordInfo.KeywordType = DataConverter.CLng(this.RadlKeywordType.SelectedValue);
                    keywordInfo.Priority    = DataConverter.CLng(this.TxtPriority.Text);
                    if (Keywords.Update(keywordInfo))
                    {
                        AdminPage.WriteSuccessMsg("<li>修改关键字成功!</li>", "KeyWordManage.aspx");
                    }
                    else
                    {
                        AdminPage.WriteErrMsg("<li>修改关键字操作失败!</li>");
                    }
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>数据库中已经存在此关键字!</li>");
                }
            }
        }