Esempio n. 1
0
        private string GetTagVisbleTypeText(RawlerLib.MarkupLanguage.TagClass tag)
        {
            string txt = string.Empty;

            switch (tagVisbleType)
            {
            case TagVisbleType.Inner:
                txt = tag.Inner;
                break;

            case TagVisbleType.Outer:
                txt = tag.Outer;
                break;

            case TagVisbleType.Parameter:
                txt = tag.Parameter;
                break;

            default:
                txt = tag.Inner;
                break;
            }
            return(txt);
        }
Esempio n. 2
0
        private void NewMethod(bool runChildren)
        {
            List <RawlerLib.MarkupLanguage.TagClass> list;

            var test = this.GetAncestorRawler().Skip(1).TakeWhile(n => (n is Page) == false);
            var tags = this.GetAncestorRawler().Skip(1).TakeWhile(n => (n is Page) == false).OfType <Tags>().Where(n => n.Tag == this.Tag).FirstOrDefault();

            if (tags != null)
            {
                list = ExtendList(tags.currentTagClass.Children).ToList();
            }
            else
            {
                if (UseTagRank)
                {
                    list = new List <RawlerLib.MarkupLanguage.TagClass>(RawlerLib.MarkupLanguage.TagAnalyze.GetTopTag(GetText(), Tag));
                }
                else
                {
                    list = new List <RawlerLib.MarkupLanguage.TagClass>(RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), Tag));
                }
            }

            if (this.ParameterFilter != null && this.ParameterFilter.Length > 0)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.Parameter.Contains(this.ParameterFilter)));
            }
            if (this.ContextFilter != null && this.ContextFilter.Length > 0)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.Inner.Contains(this.ContextFilter)));
            }
            if (this.ClassName != null && this.ClassName.Length > 0)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckClassName(ClassName)));
            }
            if (string.IsNullOrEmpty(Itemprop) == false)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckItempropName(Itemprop)));
            }
            if (this.IdName != null && this.IdName.Length > 0)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckIdName(IdName)));
            }
            if (this.TargetName != null && this.TargetName.Length > 0)
            {
                list = new List <RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckName(TargetName)));
            }


            if (emptyReport && list.Count == 0)
            {
                ReportManage.ErrReport(this, "該当するものは一つも見つかりませんでした。");
            }
            texts = list.Select(n => GetTagVisbleTypeText(n));


            if (IsSingle)
            {
                if (list.Count > 0)
                {
                    SetText(GetTagVisbleTypeText(list.First()));
                    currentTagClass = list.First();
                    RunChildren(runChildren);
                }
            }
            else
            {
                RunChildrenForArray <RawlerLib.MarkupLanguage.TagClass>(runChildren, list, (n) => GetTagVisbleTypeText(n), (n) => this.currentTagClass = n);
            }
        }
Esempio n. 3
0
        private void NewMethod(bool runChildren)
        {
            List<RawlerLib.MarkupLanguage.TagClass> list;

            var test = this.GetAncestorRawler().Skip(1).TakeWhile(n => (n is Page) == false);
            var tags = this.GetAncestorRawler().Skip(1).TakeWhile(n => (n is Page) == false).OfType<Tags>().Where(n => n.Tag == this.Tag).FirstOrDefault();
            if (tags != null)
            {
                list = ExtendList( tags.currentTagClass.Children).ToList();
            }
            else
            {

                if (UseTagRank)
                {
                    list = new List<RawlerLib.MarkupLanguage.TagClass>(RawlerLib.MarkupLanguage.TagAnalyze.GetTopTag(GetText(), Tag));
                }
                else
                {
                    list = new List<RawlerLib.MarkupLanguage.TagClass>(RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), Tag));
                }
            }

            if (this.ParameterFilter != null && this.ParameterFilter.Length > 0)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.Parameter.Contains(this.ParameterFilter)));
            }
            if (this.ContextFilter != null && this.ContextFilter.Length > 0)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.Inner.Contains(this.ContextFilter)));
            }
            if (this.ClassName != null && this.ClassName.Length > 0)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckClassName(ClassName)));
            }
            if (string.IsNullOrEmpty(Itemprop) == false)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckItempropName(Itemprop)));
            }
            if (this.IdName != null && this.IdName.Length > 0)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckIdName(IdName)));
            }
            if (this.TargetName != null && this.TargetName.Length > 0)
            {
                list = new List<RawlerLib.MarkupLanguage.TagClass>(list.Where(n => n.CheckName(TargetName)));
            }

            if (emptyReport && list.Count == 0)
            {
                ReportManage.ErrReport(this, "該当するものは一つも見つかりませんでした。");
            }
            texts = list.Select(n=>GetTagVisbleTypeText(n));

            if (IsSingle)
            {
                if (list.Count > 0)
                {
                    SetText(GetTagVisbleTypeText(list.First()));
                    currentTagClass = list.First();
                    RunChildren(runChildren);
                }
            }
            else
            {
                RunChildrenForArray<RawlerLib.MarkupLanguage.TagClass>(runChildren, list,(n)=> GetTagVisbleTypeText(n),(n)=>this.currentTagClass = n );
            }
        }