public override void Run(bool runChildren) { currentDataRow = new DataRowObject(); SetText(GetText()); base.Run(runChildren); if (MustAttributes.IsNullOrEmpty() == false) { var must = MustAttributes.Split(','); if (currentDataRow.Attributes.Intersect(must).Count() == must.Count()) { Data.AddDataRow(this, currentDataRow); } } else { Data.AddDataRow(this, currentDataRow); } if (currentDataRow.IsDataNull()) { if (EmptyTree != null) { EmptyTree.SetParent(this); EmptyTree.Run(); } } }
/// <summary> /// AddDataRowの共通呼び出し。 /// </summary> /// <param name="rawler"></param> /// <param name="datarow"></param> public static void AddDataRow(RawlerBase rawler, DataRowObject datarow) { var r = (IDataRows)rawler.GetUpperInterface <IDataRows>(); if (r != null) { r.AddDataRow(datarow); } else { ReportManage.ErrUpperNotFound <IDataRows>(rawler); } }
public void ChangeCurrentDataRow(string key) { if (dataDic.ContainsKey(key)) { currentDataRow = dataDic[key]; } else { currentDataRow = new DataRowObject(); currentDataRow.AddData("Key", key); dataDic.Add(key, currentDataRow); dataList.Add(currentDataRow); } }
public void NextDataRow(DataRowObject cDataRow) { ReportManage.Report(this, "NextDataRow"); if (Commited != null) { Commited(this, new EventDataRow(cDataRow)); } if (FileSaveMode == FileSaveMode.Sequential) { File?.SequentialWriteLine(CreateSaveOneLine(cDataRow, SaveFileType)); } else { dataList.Add(cDataRow); } currentDataRow = new DataRowObject(); }
public string CreateSaveOneLine(DataRowObject row, FileType ftype) { string line = string.Empty; switch (ftype) { case FileType.Tsv: line = CreateTsvLine(row); break; case FileType.Json: line = Newtonsoft.Json.Linq.JObject.FromObject(row).ToString(Newtonsoft.Json.Formatting.None); break; case FileType.LTsv: line = row.ToLtsv(); break; default: break; } return(line); }
private string CreateTsvLine(DataRowObject row) { StringBuilder sb = new StringBuilder(); foreach (var item2 in order) { if (row.DataDic.ContainsKey(item2)) { var item = row.DataDic[item2]; if (item.First() != null) { var line = item.Select(n => n.ReadLines(true).Select(m => m.Replace("\t", " ").Trim()).JoinText(" ")).JoinText(","); sb.Append(line); } } sb.Append("\t"); } var kList = row.DataDic.Keys.Except(order); if (kList.Any()) { foreach (var item in kList) { var r = row.DataDic[item].Select(n => n.ReadLines(true).Select(m => m.Replace("\t", " ").Trim()).JoinText(" ")).JoinText(","); if (item.Length > 0 & r.Length > 0) { sb.Append(item + ":" + r); } else { sb.Append(r); } sb.Append("\t"); } } return(sb.ToString()); }
public override void Run(bool runChildren) { FileInit(); base.Run(runChildren); if (fileSaveMode == FileSaveMode.Completed) { if (File != null) { File.WriteLines(CreateSaveLines(SaveFileType)); } } if (FileSaveMode == FileSaveMode.Sequential) { File.Close(); } if (EndDataClear) { dataDic.Clear(); dataList.Clear(); currentDataRow = new DataRowObject(); dataList.Add(currentDataRow); } }
/// <summary> /// DataRowに関するEventArgs /// /// </summary> /// <param name="row"></param> public EventDataRow(DataRowObject row) : base() { DataRow = row; }
public virtual void AddDataRow(DataRowObject datarow) { currentDataRow.UpDate(datarow); NextDataRow(); }
public void AddDataRow(DataRowObject datarow) { list.Enqueue(datarow); }
public void UpDate(DataRowObject row) { dataTypeDic = row.dataTypeDic; dataDic = row.dataDic; }