Example #1
0
        public static RawFileReader LoadFile(string path)
        {
            RawFileReader ret = path switch
            {
                var s when s.EndsWith(".xls", StringComparison.OrdinalIgnoreCase) => new XlsFileReader(),
                var s when s.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase) => new XlsxFileReader(),
                _ => new CsvFileReader()
            };

            ret.Load(path);
            return(ret);
        }
Example #2
0
        public static RawFileReader LoadFile(string path)
        {
            RawFileReader ret = null;

            if (path.ToLower().EndsWith(".xls"))
            {
                ret = new XlsFileReader();
            }
            if (path.ToLower().EndsWith(".xlsx"))
            {
                ret = new XlsxFileReader();
            }

            ret = ret ?? new CsvFileReader();
            ret.Load(path);
            return(ret);
        }