public GenericStatementParser(string filePath, string[] allowedFileExtentions, Settings fileFormatParserSettings = null) { var fileExtension = ValidateFilePath(filePath, allowedFileExtentions); switch (fileExtension) { case ".csv": fileFormatParser = CreateFileFormatParser <CsvFileParser>(filePath, fileFormatParserSettings); break; case ".json": fileFormatParser = CreateFileFormatParser <JsonFileParser>(filePath, fileFormatParserSettings); break; case ".iif": fileFormatParser = CreateFileFormatParser <IifFileParser>(filePath, fileFormatParserSettings); break; default: throw new NotSupportedException("Cannot parse statement because extention {0} is not supported for file {1}".FormatEx(fileExtension, filePath)); } }
public void Add(MediaFormatExtension mediaFormat, IFileFormatParser fileFormatParser) { fileFormatParserCollection.Add(mediaFormat, fileFormatParser); }