/// <summary> /// クローンを作る /// </summary> /// <param name="parent"></param> /// <returns></returns> public override RawlerBase Clone(RawlerBase parent) { var clone = new DataWrite(); RawlerLib.ObjectLib.FildCopy(this, clone); clone.SetParent(parent); this.CloneEvent(clone); clone.children.Clear(); foreach (var item in this.Children) { var child = item.Clone(clone); clone.AddChildren(child); } return(clone); }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { string t = GetText(); if (string.IsNullOrEmpty(Json) == false) { t = Json; } var j = JObject.Parse(t); foreach (var item in j.Properties()) { if (item.Value != null) { if (item.Value.Type == Newtonsoft.Json.Linq.JTokenType.Null) { SetText("Null"); } else if (item.Value.Type == Newtonsoft.Json.Linq.JTokenType.Object) { DataWriteAllJsonData all = new DataWriteAllJsonData(); all.SetParent(this); all.Json = item.Value.ToString(); all.PropertyName = this.PropertyName.NullIsEmpty() + item.Name + "."; all.Run(); } else { SetText(item.Value.ToString()); } } else { SetText("Null"); } DataWrite dataWrite = new DataWrite(); dataWrite.SetParent(this); dataWrite.Attribute = PropertyName.NullIsEmpty() + item.Name; dataWrite.Run(); } base.Run(runChildren); }
/// <summary> /// クローンを作る /// </summary> /// <param name="parent"></param> /// <returns></returns> public override RawlerBase Clone(RawlerBase parent) { var clone = new DataWrite(); RawlerLib.ObjectLib.FildCopy(this, clone); clone.SetParent(parent); this.CloneEvent(clone); clone.children.Clear(); foreach (var item in this.Children) { var child = item.Clone(clone); clone.AddChildren(child); } return clone; }
/// <summary> /// このクラスでの実行すること。 /// </summary> /// <param name="runChildren"></param> public override void Run(bool runChildren) { string t = GetText(); if (string.IsNullOrEmpty(Json) == false) t = Json; var j = JObject.Parse(t); foreach (var item in j.Properties()) { if (item.Value != null) { if (item.Value.Type == Newtonsoft.Json.Linq.JTokenType.Null) { SetText("Null"); } else if (item.Value.Type == Newtonsoft.Json.Linq.JTokenType.Object) { DataWriteAllJsonData all = new DataWriteAllJsonData(); all.SetParent(this); all.Json = item.Value.ToString(); all.PropertyName = this.PropertyName.NullIsEmpty() + item.Name + "."; all.Run(); } else { SetText(item.Value.ToString()); } } else { SetText("Null"); } DataWrite dataWrite = new DataWrite(); dataWrite.SetParent(this); dataWrite.Attribute = PropertyName.NullIsEmpty()+ item.Name; dataWrite.Run(); } base.Run(runChildren); }