Exemplo n.º 1
0
        private byte[] InternalDecompress(byte[] bytes, bool useHeader, CompressionImplementation compressionImplementation)
        {
            switch (compressionImplementation)
            {
            case CompressionImplementation.ManagedZLib:
                return(ManagedZLib.Decompress(bytes, useHeader));

            default:
                throw new ApplicationException(string.Format("Unknown compression implementation {0}", compressionImplementation));
            }
        }
        public static string Decompress(byte[] compressedUnicodeString)
        {
            byte[] messagebytes = new byte[0];
            if (ConfigurationManager.AppSettings["UseManagedZLibForDecompress"] == "true")
            {
                messagebytes = ManagedZLib.Decompress(compressedUnicodeString, true);
            }
            else
            {
                messagebytes = MySpace.Common.IO.Compressor.GetInstance().Decompress(compressedUnicodeString, true);
            }

            return(Encoding.Unicode.GetString(messagebytes));
        }