Exemplo n.º 1
0
        private SeparatedValueReader(TextReader reader, SeparatedValueSchema schema, SeparatedValueOptions options, bool hasSchema)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }
            if (hasSchema && schema == null)
            {
                throw new ArgumentNullException(nameof(schema));
            }
            if (options == null)
            {
                options = new SeparatedValueOptions();
            }
            if (options.RecordSeparator == options.Separator)
            {
                throw new ArgumentException(Resources.SameSeparator, nameof(options));
            }
            RetryReader retryReader = new RetryReader(reader);

            parser   = new SeparatedValueRecordParser(retryReader, options);
            metadata = new SeparatedValueRecordContext()
            {
                ExecutionContext = new SeparatedValueExecutionContext()
                {
                    Schema  = hasSchema ? schema : null,
                    Options = parser.Options
                }
            };
        }
Exemplo n.º 2
0
 public SeparatedValueRecordWriter(TextWriter writer, SeparatedValueSchema schema, SeparatedValueOptions options)
 {
     this.writer = writer;
     Metadata    = new SeparatedValueRecordContext()
     {
         ExecutionContext = new SeparatedValueExecutionContext()
         {
             Schema  = schema,
             Options = options.Clone()
         }
     };
     quoteString       = String.Empty + options.Quote;
     doubleQuoteString = String.Empty + options.Quote + options.Quote;
 }