Beispiel #1
0
        /// <summary>
        /// このクラスでの実行すること。
        /// </summary>
        /// <param name="runChildren"></param>
        public override void Run(bool runChildren)
        {
            var list = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), "dl").ToList();

            if (ClassName.IsNullOrEmpty() == false)
            {
                list = list.Where(n => n.Parameter.Contains("class=\"" + ClassName + "\"")).ToList();
            }
            if (IdName.IsNullOrEmpty() == false)
            {
                list = list.Where(n => n.Parameter.Contains("id=\"" + IdName + "\"")).ToList();
            }

            definitionList = new List <KeyValuePair <string, string> >();
            foreach (var item in list)
            {
                foreach (var item2 in RawlerLib.Web.GetTagContentList(item.Inner, "<dt", "</dd>", true))
                {
                    var key = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(item2, "dt", true);
                    var val = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(item2, "dd", true);
                    definitionList.Add(new KeyValuePair <string, string>(key.First().Inner, val.First().Inner));
                }
            }
            RunChildren(runChildren);
        }
Beispiel #2
0
        /// <summary>执行生成</summary>
        public virtual void Execute()
        {
            var option = Option;

            if (ClassName.IsNullOrEmpty())
            {
                if (!option.ClassNameTemplate.IsNullOrEmpty())
                {
                    ClassName = option.ClassNameTemplate.Replace("{name}", Table.Name);
                }
                else
                {
                    ClassName = option.Interface ? ("I" + Table.Name) : Table.Name;
                }
            }
            WriteLog("生成 {0} {1} {2}", Table.Name, Table.DisplayName, new { option.ClassNameTemplate, option.BaseClass, option.ModelNameForCopy, option.Namespace }.ToJson(false, false, false));

            Clear();
            if (Writer == null)
            {
                Writer = new StringWriter();
            }

            OnExecuting();

            BuildItems();

            OnExecuted();
        }
Beispiel #3
0
        /// <summary>执行生成</summary>
        public virtual void Execute()
        {
            if (ClassName.IsNullOrEmpty())
            {
                if (!Option.ClassNameTemplate.IsNullOrEmpty())
                {
                    ClassName = Option.ClassNameTemplate.Replace("{name}", Table.Name);
                }
                else
                {
                    ClassName = Option.Interface ? ("I" + Table.Name) : Table.Name;
                }
            }
            //WriteLog("生成 {0} {1}", Table.Name, Table.DisplayName);

            Clear();
            if (Writer == null)
            {
                Writer = new StringWriter();
            }

            OnExecuting();

            BuildItems();

            OnExecuted();
        }
Beispiel #4
0
        /// <summary>
        /// このクラスでの実行すること。
        /// </summary>
        /// <param name="runChildren"></param>
        public override void Run(bool runChildren)
        {
            var list = RawlerLib.MarkupLanguage.TagAnalyze.GetTag(GetText(), "dl").ToList();

            if (ClassName.IsNullOrEmpty() == false)
            {
                list = list.Where(n => n.Parameter.Contains("class=\"" + ClassName + "\"")).ToList();
            }
            if (IdName.IsNullOrEmpty() == false)
            {
                list = list.Where(n => n.Parameter.Contains("id=\"" + IdName + "\"")).ToList();
            }

            List <string> txtList = new List <string>();

            foreach (var item in list)
            {
                txtList.AddRange(RawlerLib.Web.GetTagContentList(item.Inner, "<dt", "</dd>", true));
            }
            base.RunChildrenForArray(true, txtList);
        }