Beispiel #1
0
 // Token: 0x06000FB3 RID: 4019 RVA: 0x000754C8 File Offset: 0x000736C8
 internal RtfToRtfCompressed SetCompressionMode(RtfCompressionMode value)
 {
     this.CompressionMode = value;
     return(this);
 }
Beispiel #2
0
 // Token: 0x060019A9 RID: 6569 RVA: 0x000CA78C File Offset: 0x000C898C
 public RtfCompressConverter(Stream input, bool push, Stream output, RtfCompressionMode mode, int inputBufferSize, int outputBufferSize) : base(input, push, output, inputBufferSize, outputBufferSize)
 {
     if (mode == RtfCompressionMode.Compressed)
     {
         this.uncompressed = false;
         this.window       = new byte[4113];
         this.nodes        = new RtfCompressConverter.Node[4097];
         int num = this.nodes.Length - 1;
         for (int i = 0; i <= num; i++)
         {
             this.nodes[i].Parent = -1;
         }
         this.nodes[num].LeftChild  = -1;
         this.nodes[num].RightChild = -1;
         this.codes = new byte[32];
         Array.Copy(RtfCompressCommon.PreloadData, 0, this.window, 0, RtfCompressCommon.PreloadData.Length);
         this.windowCurrent = RtfCompressCommon.PreloadData.Length - 17;
         Buffer.BlockCopy(this.window, 0, this.window, 4096, 17);
         for (int j = 0; j <= this.windowCurrent; j++)
         {
             this.AddNode(j, out this.match, out this.matchLength);
         }
         this.readLength   = 17;
         this.lookAhead    = 17;
         this.bufferStream = null;
         if (this.pushSink != null && this.pushSink.CanSeek)
         {
             this.initialStreamPosition = this.pushSink.Position;
             this.pushSink.Position    += 16L;
             this.directOutput          = true;
             return;
         }
         this.bufferStream = ApplicationServices.Provider.CreateTemporaryStorage();
         this.directOutput = false;
         if (this.writeBuffer == null)
         {
             this.writeBuffer  = new byte[4096];
             this.writeEnd     = this.writeBuffer.Length;
             this.writeCurrent = this.writeStart;
             return;
         }
         return;
     }
     else
     {
         if (mode != RtfCompressionMode.Uncompressed)
         {
             throw new ArgumentOutOfRangeException("CompressionMode");
         }
         this.uncompressed = true;
         if (this.pushSink != null && this.pushSink.CanSeek)
         {
             this.initialStreamPosition = this.pushSink.Position;
             this.pushSink.Position    += 16L;
             this.directOutput          = true;
             return;
         }
         if (this.pullSource != null && this.pullSource.CanSeek)
         {
             this.initialStreamPosition = this.pullSource.Position;
             return;
         }
         this.bufferStream = ApplicationServices.Provider.CreateTemporaryStorage();
         return;
     }
 }