Ejemplo n.º 1
0
        //============================================================
        // <T>压缩方法</T>
        //============================================================
        public void NotCompress(int size)
        {
            if (0 == size)
            {
                throw new FFatalException("Size is zero.");
            }
            // 构建缓冲数据
            byte[]    bytes = new byte[_length + RInt.SIZE_16K];
            FByteFile file  = new FByteFile();
            // 计算分割块数
            int splitCount = _length / size;

            if (0 != (_length % size))
            {
                splitCount++;
            }
            // 写入压缩前数据总长度
            file.WriteInt32(_length);
            // 写入分割块数
            file.WriteInt32(splitCount);
            // 分段压缩数据
            //int position = 0;
            int remain = _length;

            for (int n = 0; n < splitCount; n++)
            {
                //int compressLength = RCompressLzma.Compress(bytes,0,bytes.Length,_memory,position,Math.Min(size,remain));
                //if(0 == compressLength) {
                //   throw new FFatalException("Compress failure. (compress_length={0})",compressLength);
                //}
                //position += size;
                //remain -= size;
                //// 输出压缩后数据
                //file.WriteInt32(compressLength);
                //file.WriteBytes(bytes,0,compressLength);
            }
            Clear();
            WriteBytes(file.ToArray(), 0, file.Length);
        }