Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 private IEnumerable <string> EnumRows_Separator()
 {
     return(TextTool.SplitBy(GetInputText(), LineSeparator, LineSeparatowIsRegex));
 }