예제 #1
0
 static Compressor()
 {
     CompressHelper.Initialize();
     // bit of a hack to avoid rebuilding this look up index
     autoCompRecList = new HashSet <string>(Properties.Settings.Default.AutoCompressRecords != null
                           ? Properties.Settings.Default.AutoCompressRecords.Trim().Split(new[] { ';', ',' },
                                                                                          StringSplitOptions.
                                                                                          RemoveEmptyEntries)
                           : new string[0], StringComparer.InvariantCultureIgnoreCase);
 }
예제 #2
0
        public static BinaryReader Decompress(BinaryReader br, int size, int outsize, out int level)
        {
            if (input.Length < size)
            {
                input = new byte[size];
            }
            if (output.Length < outsize)
            {
                output = new byte[outsize];
            }
            int n = br.Read(input, 0, size);

            ms.Position = 0;
            ms.Write(input, 0, n);
            ms.SetLength(n);
            ms.Position = 0;
            var data = CompressHelper.Decompress(ms.GetBuffer(), 0, n, outsize, out level);

            ms.Position = 0;
            ms.Write(data, 0, data.Length);
            ms.SetLength(data.Length);
            ms.Position = 0;
            return(compReader);
        }
예제 #3
0
 static Decompressor()
 {
     CompressHelper.Initialize();
 }
예제 #4
0
 public static byte[] Compress(byte[] data, int compressLevel)
 {
     return(CompressHelper.Compress(data, 0, data.Length, compressLevel));
 }