/// <summary> /// Gets a typed writer for writing the objects to the file. /// </summary> /// <param name="writer">The writer to use.</param> /// <param name="options">The separate value options to use.</param> /// <returns>The typed writer.</returns> public ITypedWriter <object> GetWriter(TextWriter writer, FixedLengthOptions options = null) { var injector = new FixedLengthSchemaInjector(); var valueWriter = new FixedLengthWriter(writer, injector, options); var multiWriter = new MultiplexingTypedWriter(valueWriter, this); foreach (var matcher in matchers) { injector.When((values) => matcher.IsMatch).Use(matcher.TypeMapper.GetSchema()); } if (defaultMatcher != nonMatcher) { injector.WithDefault(defaultMatcher.TypeMapper.GetSchema()); } return(multiWriter); }
/// <summary> /// Gets a typed writer for writing the objects to the file. /// </summary> /// <param name="writer">The writer to use.</param> /// <param name="options">The separate value options to use.</param> /// <returns>The typed writer.</returns> public ITypedWriter <object> GetWriter(TextWriter writer, SeparatedValueOptions options = null) { var injector = new SeparatedValueSchemaInjector(); var valueWriter = new SeparatedValueWriter(writer, injector, options); var multiWriter = new MultiplexingTypedWriter(valueWriter, this); foreach (var matcher in matchers) { matcher.Reset(); injector.When(values => matcher.IsMatch).Use(matcher.Schema); } if (defaultMatcher != nonMatcher) { defaultMatcher.Reset(); injector.WithDefault(defaultMatcher.Schema); } return(multiWriter); }