Beispiel #1
0
 /// <summary>
 /// Decompression using a run length encoding algorithm.
 /// See MS-OVBA Section 2.4
 /// </summary>
 /// <param name="part">Byte array to decompress</param>
 /// <param name="startPos"></param>
 /// <returns></returns>
 internal static byte[] DecompressPart(byte[] part, int startPos)
 {
     if (part[startPos] != 1)
     {
         return(null);
     }
     using (var ms = RecyclableMemory.GetStream(4096))
     {
         int compressPos = startPos + 1;
         while (compressPos < part.Length - 1)
         {
             DecompressChunk(ms, part, ref compressPos);
         }
         return(ms.ToArray());
     }
 }