示例#1
0
 public CUMDBook()
 {
     if (_Book_Chapters == null)
     {
         _Book_Chapters = new CChapterList();
     }
 }
示例#2
0
        private byte[][] CompressTxtContent(Encoding encoding, CChapterList chapters)
        {
            string    s    = string.Empty;
            int       num  = 0;
            ArrayList list = new ArrayList(chapters.Count);

            int[] numArray = new int[chapters.Count];
            for (int i = 0; i < chapters.Count; i++)
            {
                string str2 = chapters[i].Content.Replace("\r\n", "\u2029") + "\u2029";
                list.Add(str2);
                s           = s + str2;
                numArray[i] = num;
                num        += str2.Length * 2;
            }
            byte[] bytes = new byte[num];
            bytes = Encoding.Unicode.GetBytes(s);
            int num3 = 0;

            if ((num % 0x8000) == 0)
            {
                num3 = num / 0x8000;
            }
            else
            {
                num3 = (num / 0x8000) + 1;
            }
            byte[][] bufferArray = new byte[num3][];
            int      index       = 0;

            byte[] input = new byte[0x8000];
            int    num5  = 0;

            for (int j = 0; j < bytes.Length; j++)
            {
                input[num5] = bytes[j];
                num5++;
                if ((num5 == 0x8000) || (j == (bytes.Length - 1)))
                {
                    byte[]   output   = new byte[0x8000];
                    Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION, false);
                    if (deflater.IsNeedingInput)
                    {
                        deflater.SetInput(input, 0, input.Length);
                    }
                    deflater.Finish();
                    deflater.Deflate(output);
                    bufferArray[index] = new byte[deflater.TotalOut];
                    Deflater deflater2 = new Deflater(Deflater.BEST_COMPRESSION, false);
                    if (deflater2.IsNeedingInput)
                    {
                        deflater2.SetInput(input, 0, input.Length);
                    }
                    deflater2.Finish();
                    deflater2.Deflate(bufferArray[index]);
                    index++;
                    input = null;
                    input = new byte[0x8000];
                    num5  = 0;
                }
            }
            return(bufferArray);
        }