public override DataRecord AnalyseRecord(string data) { DataRecord res = new DataRecord(); int index = 0; Dictionary <int, string> fieldNames = Fields.ToDictionary(fld => fld.Position, fld => fld.Name); foreach (string item in TextTool.SplitBy(data, Separator, IsRegex)) { if (fieldNames.ContainsKey(index)) { res.Fields.Add(new DataRecord.Field { Name = fieldNames[index], Value = item }); } else { if (ColNameTemplate != null && ColNameTemplate.Contains("#COLINDEX#")) { res.Fields.Add(new DataRecord.Field { Name = ColNameTemplate.Replace("#COLINDEX#", index.ToString()), Value = item }); } } index++; } return(res); }
private IEnumerable <string> EnumRows_Separator() { return(TextTool.SplitBy(GetInputText(), LineSeparator, LineSeparatowIsRegex)); }