public override IFormat Clone() { CsvFormat other = new CsvFormat(Name, Separator, Columns.ToArray()); other.SkipRows = SkipRows.ToArray(); other.SkipColumns = SkipColumns.ToArray(); return(other); }
public override IFormat Clone() { PathTableFormat other = new PathTableFormat(Name, Path, Columns.ToArray()); other.SkipRows = SkipRows.ToArray(); other.SkipColumns = SkipColumns.ToArray(); return(other); }
public void ToFormattedTable(DataTable rawTable, DataTable targetTable) { for (int r = 0; r < rawTable.Rows.Count; ++r) { if (SkipRows.Contains(r)) { continue; } DataRow rawRow = rawTable.Rows[r]; DataRow row = targetTable.NewRow(); int targetCol = 0; bool isEmpty = true; for (int c = 0; c < rawRow.ItemArray.Length; ++c) { if (SkipColumns.Contains(c)) { continue; } if (targetCol == Columns.Length) { break; } FormatColumn formatCol = Columns[targetCol]; object value = formatCol.Convert(rawRow[c].ToString()); row[formatCol.Name] = (value != null ? value : DBNull.Value); if (row[formatCol.Name] != DBNull.Value) { isEmpty = false; } targetCol++; } if (!isEmpty) { targetTable.Rows.Add(row); } } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("BaseTableFormat: SkipRows='"); sb.Append(SkipRows.Join(',')); sb.Append("', Columns("); for (int i = 0; i < Columns.Length; ++i) { sb.Append("["); sb.Append(Columns[i].ToString()); sb.Append("]"); if (i < Columns.Length - 1) { sb.Append(", "); } } sb.Append(")"); return(sb.ToString()); }
/// <summary> /// Creates a deep copy of the given object. /// </summary> protected void CloneTo(AbstractSeriesFormat other) { other.Expand = Expand; other.SeriesNamePosition = SeriesNamePosition; other.TimeAxisPosition = TimeAxisPosition; if (SkipRows != null) { other.SkipRows = SkipRows.ToArray(); } if (SkipColumns != null) { other.SkipColumns = SkipColumns.ToArray(); } if (ValueFormat != null) { other.ValueFormat = new FormatColumn(ValueFormat); } if (TimeAxisFormat != null) { other.TimeAxisFormat = new FormatColumn(TimeAxisFormat); } }