Beispiel #1
0
        public CsvProfile(CsvDialectDescriptor descriptor)
        {
            if (descriptor.DoubleQuote)
            {
                throw new ArgumentException("PocketCsvReader doesn't support doubleQuote set to true in the CSV dialect descriptor.");
            }
            if (descriptor.NullSequence?.Length > 0)
            {
                throw new ArgumentException("PocketCsvReader doesn't support nullSequence set to any value in the CSV dialect descriptor.");
            }
            if (descriptor.SkipInitialSpace)
            {
                throw new ArgumentException("PocketCsvReader doesn't support skipInitialSpace set to true in the CSV dialect descriptor.");
            }
            if (descriptor.CaseSensitiveHeader)
            {
                throw new ArgumentException("PocketCsvReader doesn't support caseSensitiveHeader set to true in the CSV dialect descriptor.");
            }

            Descriptor          = descriptor;
            PerformanceOptmized = false;
            EmptyCell           = string.Empty;
            MissingCell         = string.Empty;
            BufferSize          = 4096;
        }
Beispiel #2
0
        public CsvProfile(char fieldSeparator, char textQualifier, char escapeTextQualifier, string recordSeparator, bool firstRowHeader, bool performanceOptimized, int bufferSize, string emptyCell, string missingCell)
        {
            Descriptor = new CsvDialectDescriptor
            {
                Delimiter      = fieldSeparator,
                QuoteChar      = textQualifier,
                EscapeChar     = escapeTextQualifier,
                LineTerminator = recordSeparator,
                Header         = firstRowHeader
            };

            PerformanceOptmized = performanceOptimized;
            EmptyCell           = emptyCell;
            MissingCell         = missingCell;
            BufferSize          = bufferSize;
        }