Add Line field to SaneTsvRecord
So extending formats can have line information
This commit is contained in:
parent
ee46c93ce1
commit
a5eedef36b
|
@ -214,7 +214,7 @@ public class SaneTsv
|
||||||
comment = currentComment.ToString();
|
comment = currentComment.ToString();
|
||||||
currentComment.Clear();
|
currentComment.Clear();
|
||||||
}
|
}
|
||||||
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment));
|
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line));
|
||||||
fields.Clear();
|
fields.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ public class SaneTsv
|
||||||
comment = currentComment.ToString();
|
comment = currentComment.ToString();
|
||||||
currentComment.Clear();
|
currentComment.Clear();
|
||||||
}
|
}
|
||||||
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment));
|
parsed.Records.Add(new SaneTsvRecord(parsed, ParseCurrentRecord(parsed, fields, line), comment, line));
|
||||||
fields.Clear();
|
fields.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,14 +491,18 @@ public class SaneTsv
|
||||||
public SaneTsv Parent { get; }
|
public SaneTsv Parent { get; }
|
||||||
public string Comment { get; }
|
public string Comment { get; }
|
||||||
public object[] Fields { get; }
|
public object[] Fields { get; }
|
||||||
|
public int Line { get; }
|
||||||
|
|
||||||
public object this[string columnName] => Fields[Array.IndexOf(Parent.ColumnNames, columnName)];
|
public object this[string columnName] => Fields[Array.IndexOf(Parent.ColumnNames, columnName)];
|
||||||
|
|
||||||
public SaneTsvRecord(SaneTsv parent, object[] fields, string comment)
|
public object this[int columnIndex] => Fields[columnIndex];
|
||||||
|
|
||||||
|
public SaneTsvRecord(SaneTsv parent, object[] fields, string comment, int line)
|
||||||
{
|
{
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
Fields = fields;
|
Fields = fields;
|
||||||
Comment = comment;
|
Comment = comment;
|
||||||
|
Line = line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user