Exemplo n.º 1
0
 public static T[] ReadContext <T>(IEnumerable <string> lines, CsvConfig config) where T : new()
 {
     return(ReadContext <T>(lines, config, null, null));
 }
Exemplo n.º 2
0
 public static T[] ReadContext <T>(string all, CsvConfig config) where T : new()
 {
     return(ReadContext <T>(all, config, null, null));
 }
Exemplo n.º 3
0
 public static T[] ReadContext <T>(string all, CsvConfig config, Predicate <string> preFilter, Predicate <T> postFilter) where T : new()
 {
     string[] lines = all.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
     return(ReadContext(lines, config, preFilter, postFilter));//
 }
Exemplo n.º 4
0
        private static PropertyInfo GetPropertyInfo(List <PropertyInfo> pis, int ordial, string title, CsvConfig config)
        {
            switch (config.MappingType)
            {
            case CsvMappingType.Title:
                return(GetPropertyInfoBase(pis, attr =>
                {
                    if (attr.Name == title)
                    {
                        return true;
                    }

                    if (Contains(attr.Alias, title))
                    {
                        return true;
                    }

                    if (config.ContainsColumn(attr.Name))
                    {
                        return Contains(config.GetAlias(attr.Name), title);
                    }
                    return false;
                }));

            case CsvMappingType.Order:
            default:
                return(GetPropertyInfoBase(pis, attr => attr.Ordinal == ordial));
            }
        }