示例#1
0
        public static DelimitedFileDetectionResultWithColumns ReadManifestFileSystem(string fileName)
        {
            var posExt = fileName.LastIndexOf('.');

            if (posExt == -1)
            {
                return(null);
            }
            var manifest = fileName.EndsWith(cCsvManifestExtension, StringComparison.OrdinalIgnoreCase)
                                ? fileName
                                : fileName.Substring(0, posExt) + cCsvManifestExtension;

            if (FileSystemUtils.FileExists(manifest))
            {
                var dataFile = manifest.ReplaceCaseInsensitive(cCsvManifestExtension, ".csv");
                if (FileSystemUtils.FileExists(dataFile))
                {
                    return(ReadManifestFromStream(FileSystemUtils.OpenRead(manifest), manifest, dataFile, string.Empty));
                }

                dataFile = manifest.ReplaceCaseInsensitive(cCsvManifestExtension, ".txt");
                if (FileSystemUtils.FileExists(dataFile))
                {
                    return(ReadManifestFromStream(FileSystemUtils.OpenRead(manifest), manifest, dataFile, string.Empty));
                }
            }

            return(null);
        }