示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CSF.Zpt.Rendering.IRenderingSettings"/> class.
        /// </summary>
        /// <param name="addSourceFileAnnotation">Indicates whether or not source file annotation is to be added.</param>
        /// <param name="elementVisitors">The element visitors to use.</param>
        /// <param name="contextFactory">The rendering context factory.</param>
        /// <param name="outputEncoding">The desired output encoding.</param>
        /// <param name="omitXmlDeclaration">Whether or not to omit the XML declaration.</param>
        /// <param name="documentFactory">An optional non-default implementation of <see cref="ITemplateFileFactory"/> to use.</param>
        public RenderingSettings(IContextVisitor[] elementVisitors,
                             IRenderingContextFactory contextFactory,
                             bool addSourceFileAnnotation,
                             System.Text.Encoding outputEncoding,
                             bool omitXmlDeclaration,
                             ITemplateFileFactory documentFactory)
        {
            if(elementVisitors == null)
              {
            throw new ArgumentNullException(nameof(elementVisitors));
              }
              if(contextFactory == null)
              {
            throw new ArgumentNullException(nameof(contextFactory));
              }
              if(outputEncoding == null)
              {
            throw new ArgumentNullException(nameof(outputEncoding));
              }
              if(documentFactory == null)
              {
            throw new ArgumentNullException(nameof(documentFactory));
              }

              _contextVisitors = elementVisitors;
              this.ContextFactory = contextFactory;
              this.AddSourceFileAnnotation = addSourceFileAnnotation;
              this.OutputEncoding = outputEncoding;
              this.OmitXmlDeclaration = omitXmlDeclaration;
              this.TemplateFileFactory = documentFactory;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CSF.Zpt.Rendering.DefaultRenderingSettings"/> class.
 /// </summary>
 /// <param name="documentFactory">Document factory.</param>
 /// <param name="elementVisitors">Element visitors.</param>
 /// <param name="contextFactory">Context factory.</param>
 /// <param name="addSourceFileAnnotation">If set to <c>true</c> add source file annotation.</param>
 /// <param name="outputEncoding">Output encoding.</param>
 /// <param name="omitXmlDeclaration">If set to <c>true</c> omit XML declaration.</param>
 protected DefaultRenderingSettings(ITemplateFileFactory documentFactory = null,
                                IContextVisitor[] elementVisitors = null,
                                IRenderingContextFactory contextFactory = null,
                                bool addSourceFileAnnotation = DefaultAddAnnotation,
                                Encoding outputEncoding = null,
                                bool omitXmlDeclaration = DefaultOmitXmlDeclaration)
 {
     this.TemplateFileFactory = documentFactory?? new ZptDocumentFactory();
       this.AddSourceFileAnnotation = addSourceFileAnnotation;
       this.OmitXmlDeclaration = omitXmlDeclaration;
       this.ContextVisitors = elementVisitors?? DefaultVisitors;
       this.ContextFactory = contextFactory?? DefaultContextFactory;
       this.OutputEncoding = outputEncoding?? DefaultEncoding;
 }
 protected override IRenderingSettings GetRenderingSettings(IRenderingContextFactory contextFactory)
 {
     return SettingsFactory.CreateSettings(contextFactory: contextFactory,
                                     addSourceAnnotation: true);
 }
示例#4
0
 protected virtual IRenderingSettings GetRenderingSettings(IRenderingContextFactory contextFactory)
 {
     return SettingsFactory.CreateSettings(contextFactory: contextFactory);
 }