Example #1
0
 internal void GetStorage(InternalBodyFormat format, Charset charset, out DataStorage outStorage, out long outStart, out long outEnd)
 {
     if (format == this.internalFormat && (format == InternalBodyFormat.RtfCompressed || charset == null || charset == this.charset))
     {
         this.storage.AddRef();
         outStorage = this.storage;
         outStart   = this.start;
         outEnd     = this.end;
         return;
     }
     outStorage = new BodyFormatConversionStorage(this.storage, this.start, this.end, this.internalFormat, this.charset, format, charset);
     outStart   = 0L;
     outEnd     = long.MaxValue;
 }
Example #2
0
 internal void SetFormat(BodyFormat format, InternalBodyFormat internalFormat, Charset charset)
 {
     this.format         = format;
     this.internalFormat = internalFormat;
     this.charset        = charset;
 }
 private static BodyFormatConversionStorage.BodyFormatConversion GetConversion(InternalBodyFormat sourceFormat, InternalBodyFormat targetFormat)
 {
     if (sourceFormat == InternalBodyFormat.Html && targetFormat == InternalBodyFormat.Text)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.HtmlToText);
     }
     if (sourceFormat == InternalBodyFormat.Html && targetFormat == InternalBodyFormat.Enriched)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.HtmlToEnriched);
     }
     if (sourceFormat == InternalBodyFormat.Enriched && targetFormat == InternalBodyFormat.Text)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.EnrichedToText);
     }
     if (sourceFormat == InternalBodyFormat.RtfCompressed && targetFormat == InternalBodyFormat.Text)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.RtfCompressedToText);
     }
     if (sourceFormat == InternalBodyFormat.Text && targetFormat == InternalBodyFormat.Text)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.TextToText);
     }
     if (sourceFormat == InternalBodyFormat.Html && targetFormat == InternalBodyFormat.Html)
     {
         return(BodyFormatConversionStorage.BodyFormatConversion.HtmlToHtml);
     }
     return(BodyFormatConversionStorage.BodyFormatConversion.None);
 }
 public BodyFormatConversionStorage(DataStorage originalStorage, long originalStart, long originalEnd, InternalBodyFormat originalFormat, Charset originalCharset, InternalBodyFormat targetFormat, Charset targetCharset)
 {
     originalStorage.AddRef();
     this.originalStorage = originalStorage;
     this.originalStart   = originalStart;
     this.originalEnd     = originalEnd;
     this.originalFormat  = originalFormat;
     this.originalCharset = originalCharset;
     this.targetFormat    = targetFormat;
     this.targetCharset   = targetCharset;
 }