Пример #1
0
 /// <summary>
 /// 解压缩数据;
 /// </summary>
 /// <param name="bytes">要解压缩的数据;</param>
 /// <returns>解压缩后的数据;</returns>
 public static byte[] Decompress(byte[] bytes)
 {
     if (_zipHelper == null)
     {
         throw new Exception("Zip helper is invalid.");
     }
     return(_zipHelper.Decompress(bytes));
 }
Пример #2
0
 public static byte[] Decompress(byte[] bytes)
 {
     if (s_ZipHelper == null)
     {
         throw;
     }
     return(s_ZipHelper.Decompress(bytes));
 }
Пример #3
0
            /// <summary>
            /// 解压缩数据。
            /// </summary>
            /// <param name="bytes">要解压缩的数据。</param>
            /// <returns>解压缩后的数据。</returns>
            public static byte[] Decompress(byte[] bytes)
            {
                if (s_ZipHelper == null)
                {
                    throw new GameFrameworkException("Zip helper is invalid.");
                }

                return(s_ZipHelper.Decompress(bytes));
            }
Пример #4
0
        /// <summary>
        /// 解压缩数据。
        /// </summary>
        /// <param name="bytes">要解压缩的数据的二进制流。</param>
        /// <param name="offset">要解压缩的数据的二进制流的偏移。</param>
        /// <param name="length">要解压缩的数据的二进制流的长度。</param>
        /// <param name="decompressedStream">解压缩后的数据的二进制流。</param>
        /// <returns>是否解压缩数据成功。</returns>
        public static bool Decompress(byte[] bytes, int offset, int length, Stream decompressedStream)
        {
            if (s_ZipHelper == null)
            {
                Debug.LogError("Zip helper is invalid.");
            }

            if (bytes == null)
            {
                Debug.LogError("Bytes is invalid.");
            }

            if (offset < 0 || length <= 0 || offset + length > bytes.Length)
            {
                Debug.LogError("Offset or length is invalid.");
            }

            if (decompressedStream == null)
            {
                Debug.LogError("Decompressed stream is invalid.");
            }

            try
            {
                return(s_ZipHelper.Decompress(bytes, offset, length, decompressedStream));
            }
            catch (Exception exception)
            {
                //if (exception is GameFrameworkException)
                //{
                //    throw;
                //}

                Debug.LogError(string.Format("Can not decompress with exception '{0}'.", exception.ToString()));
            }
            return(false);
        }
Пример #5
0
            /// <summary>
            /// 解压缩数据。
            /// </summary>
            /// <param name="bytes">要解压缩的数据的二进制流。</param>
            /// <param name="offset">要解压缩的数据的二进制流的偏移。</param>
            /// <param name="length">要解压缩的数据的二进制流的长度。</param>
            /// <param name="decompressedStream">解压缩后的数据的二进制流。</param>
            /// <returns>是否解压缩数据成功。</returns>
            public static bool Decompress(byte[] bytes, int offset, int length, Stream decompressedStream)
            {
                if (s_ZipHelper == null)
                {
                    throw new GameFrameworkException("Zip helper is invalid.");
                }

                if (bytes == null)
                {
                    throw new GameFrameworkException("Bytes is invalid.");
                }

                if (offset < 0 || length < 0 || offset + length > bytes.Length)
                {
                    throw new GameFrameworkException("Offset or length is invalid.");
                }

                if (decompressedStream == null)
                {
                    throw new GameFrameworkException("Decompressed stream is invalid.");
                }

                try
                {
                    return(s_ZipHelper.Decompress(bytes, offset, length, decompressedStream));
                }
                catch (Exception exception)
                {
                    if (exception is GameFrameworkException)
                    {
                        throw;
                    }

                    throw new GameFrameworkException(Text.Format("Can not decompress with exception '{0}'.", exception.ToString()), exception);
                }
            }
Пример #6
0
            /// <summary>
            /// 解压缩数据。
            /// </summary>
            /// <param name="bytes">要解压缩的数据。</param>
            /// <returns>解压缩后的数据。</returns>
            public static byte[] Decompress(byte[] bytes)
            {
                if (s_ZipHelper == null)
                {
                    throw new GameFrameworkException("Zip helper is invalid.");
                }

                try
                {
                    return(s_ZipHelper.Decompress(bytes));
                }
                catch (Exception exception)
                {
                    if (exception is GameFrameworkException)
                    {
                        throw;
                    }

                    throw new GameFrameworkException(Text.Format("Can not decompress bytes with exception '{0}'.", exception.ToString()), exception);
                }
            }