Exemplo n.º 1
0
        public override void Run(bool runChildren)
        {
            base.Run(runChildren);
            if (doLastFileSave)
            {
                SaveFile();
            }

            if (string.IsNullOrEmpty(Attribute) == false)
            {
                Data.DataWrite(this, Attribute, this.ToJson(), DataWriteType.add, DataAttributeType.Json);
            }

            if (EndDataClear || string.IsNullOrEmpty(Attribute) == false)
            {
                dataDic.Clear();
                dataList.Clear();
                currentDataRow = new DataRowObject();
                dataList.Add(currentDataRow);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// このクラスでの実行すること。
        /// </summary>
        /// <param name="runChildren"></param>
        public override void Run(bool runChildren)
        {
            var  t    = GetText();
            bool flag = false;
            var  json = JObject.Parse(t);

            foreach (var item in FieldName.Split('.'))
            {
                if (json.Properties().Where(n => n.Name == item).Any())
                {
                    if (json.Property(item).Value.Type == JTokenType.Object)
                    {
                        json = JObject.Parse(json.Property(item).Value.ToString());
                    }
                    else
                    {
                        Data.DataWrite(this, FieldName, json.Property(item).Value.ToString(), this.WriteType, DataAttributeType.Text);
                        flag = true;
                    }
                }
                else
                {
                    break;
                }
            }
            if (json.Type == JTokenType.Object && flag == false)
            {
                Data.DataWrite(this, FieldName, json.ToString(), this.WriteType, DataAttributeType.Text);
            }
            if (flag == false)
            {
                if (ErrorThrow)
                {
                    ReportManage.ErrReport(this, "FieldName:「" + FieldName + "」がありません。");
                }
            }
            base.Run(runChildren);
        }
Exemplo n.º 3
0
        //public new void Run()
        //{
        //    Run(true);
        //}

        /// <summary>
        /// 実行
        /// </summary>
        /// <param name="runChildren"></param>
        public override void Run(bool runChildren)
        {
            string txt = string.Empty;

            if (Value == null || Value.Length == 0)
            {
                txt = GetText();
            }
            else
            {
                txt = Value.Convert(this);
            }
            if (useHtmlDecode)
            {
                txt = System.Net.WebUtility.HtmlDecode(txt);
            }

            string attribute = string.Empty;

            if (this.Attribute == null && attributeTree != null)
            {
                if (this.Parent != null)
                {
                    attribute = RawlerBase.GetText(this.Parent.Text, attributeTree, this);
                }
            }
            else if (this.Attribute != null)
            {
                attribute = this.Attribute.Convert(this);
            }

            Data.DataWrite(this, attribute, txt, writeType, AttributeType);

            //IData data = null;

            //IRawler current = this.Parent;
            //while (current != null)
            //{
            //    if (current is IData)
            //    {
            //        data = current as IData;
            //        break;
            //    }
            //    current = current.Parent;
            //}
            //if (data != null)
            //{
            //    string txt = string.Empty;
            //    if (Value == null || Value.Length == 0)
            //    {
            //        txt = GetText();
            //    }
            //    else
            //    {
            //        txt = Value;
            //    }
            //    if (useHtmlDecode)
            //    {
            //        txt = System.Net.WebUtility.HtmlDecode(txt);
            //    }

            //    if (this.Attribute == null && attributeTree != null)
            //    {
            //        string tmpAttributeText = string.Empty;
            //        if (this.Parent != null)
            //        {
            //            tmpAttributeText = RawlerBase.GetText(this.Parent.Text, attributeTree,this);

            //        }
            //        data.DataWrite(tmpAttributeText, txt, writeType,AttributeType);

            //    }
            //    else
            //    {
            //        if (this.Attribute != null)
            //        {
            //            data.DataWrite(this.Attribute, txt, writeType,AttributeType);
            //        }
            //        else
            //        {
            //            data.DataWrite(string.Empty, txt, writeType, AttributeType);
            //        }
            //    }

            //    //if (this.AttributeObjectName != null && this.AttributeObjectName.Length>0)
            //    //{
            //    //    var list = this.GetConectAllRawler().Where(n => n.Name == this.AttributeObjectName);
            //    //    if (list.Count() > 0)
            //    //    {
            //    //        data.DataWrite(list.First().Text, txt,writeType);
            //    //    }
            //    //    else
            //    //    {
            //    //        ReportManage.ErrReport(this, "AttributeObjectNameの指定が不正です。オブジェクトが見つかりませんでした。");
            //    //    }
            //    //}

            //}
            //else
            //{
            //    ReportManage.ErrReport(this,"書き込み先のDataオブジェクトが見つかりません。");
            //}
            this.RunChildren(runChildren);
        }