Ejemplo n.º 1
0
 private BodyReadStream(Stream bodyStream, Stream readStream, ConversionCallbackBase conversionCallbacks, long?length) : base(StreamBase.Capabilities.Readable)
 {
     this.bodyStream          = bodyStream;
     this.readStream          = readStream;
     this.conversionCallbacks = conversionCallbacks;
     this.length   = length;
     this.position = 0L;
 }
Ejemplo n.º 2
0
        private static ConversionCallbackBase CreateConversionDelegateProvider(ICoreItem coreItem, BodyWriteConfiguration configuration)
        {
            ConversionCallbackBase result = null;

            if (configuration.SourceFormat == BodyFormat.ApplicationRtf && configuration.TargetFormat == BodyFormat.TextHtml && configuration.HtmlCallback == null)
            {
                configuration.HtmlCallback = new DefaultHtmlCallbacks(coreItem, false)
                {
                    ClearInlineOnUnmarkedAttachments = false
                };
                result = configuration.HtmlCallback;
            }
            if (configuration.SourceFormat == BodyFormat.TextHtml && configuration.TargetFormat == BodyFormat.ApplicationRtf && configuration.ImageRenderingCallback == null)
            {
                configuration.RtfCallback = new DefaultRtfCallbacks(coreItem, false)
                {
                    ClearInlineOnUnmarkedAttachments = false
                };
                result = configuration.RtfCallback;
            }
            return(result);
        }
Ejemplo n.º 3
0
        internal static Stream CreateStream(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyWriteConfiguration writerConfiguration = new BodyWriteConfiguration(configuration);

            provider = BodyWriteDelegates.CreateConversionDelegateProvider(coreItem, writerConfiguration);
            return(ConvertUtils.CallCtsWithReturnValue <Stream>(ExTraceGlobals.CcBodyTracer, "BodyWriteDelegates::CreateStream", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyWriteDelegates.ConversionCreator conversionMethod = BodyWriteDelegates.GetConversionMethod(configuration);
                return (Stream)conversionMethod(coreItem, writerConfiguration, bodyStream, false);
            }));
        }
Ejemplo n.º 4
0
        internal static TextWriter CreateWriter(ICoreItem coreItem, BodyWriteConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyWriteConfiguration writerConfiguration = new BodyWriteConfiguration(configuration);

            writerConfiguration.SourceCharset = ConvertUtils.UnicodeCharset;
            provider = BodyWriteDelegates.CreateConversionDelegateProvider(coreItem, writerConfiguration);
            return(ConvertUtils.CallCtsWithReturnValue <TextWriter>(ExTraceGlobals.CcBodyTracer, "BodyWriteDelegates::CreateWriter", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyWriteDelegates.ConversionCreator conversionMethod = BodyWriteDelegates.GetConversionMethod(writerConfiguration);
                return (TextWriter)conversionMethod(coreItem, writerConfiguration, bodyStream, true);
            }));
        }
Ejemplo n.º 5
0
 private BodyReadStream(Stream bodyStream, Stream readStream, ConversionCallbackBase conversionCallbacks) : this(bodyStream, readStream, conversionCallbacks, null)
 {
 }
Ejemplo n.º 6
0
        internal static Stream CreateStream(ICoreItem coreItem, BodyReadConfiguration configuration, Stream bodyStream, out ConversionCallbackBase provider)
        {
            BodyReadConfiguration readConfiguration = new BodyReadConfiguration(configuration);

            provider = BodyReadDelegates.CreateConversionDelegateProvider(coreItem, readConfiguration);
            if (readConfiguration.Charset == null)
            {
                readConfiguration.Charset = ConvertUtils.GetItemMimeCharset(coreItem.PropertyBag);
            }
            if (!readConfiguration.IsBodyTransformationNeeded(coreItem.Body))
            {
                return(bodyStream);
            }
            return(ConvertUtils.CallCtsWithReturnValue <Stream>(ExTraceGlobals.CcBodyTracer, "BodyReadDelegates::CreateStream", ServerStrings.ConversionBodyConversionFailed, delegate
            {
                BodyReadDelegates.ConversionCreator conversionMethod = BodyReadDelegates.GetConversionMethod(coreItem, configuration);
                return (Stream)conversionMethod(coreItem, readConfiguration, bodyStream, false);
            }));
        }