Esempio n. 1
0
        private void ParseChapterImages()
        {
            int count = 0;

            for (int i = 0; i < this._Book.Chapters.Count; i++)
            {
                if (i < (this._Book.Chapters.Count - 1))
                {
                    count = this._ChaptersOff[i + 1];
                }
                else
                {
                    count = this._TotalImageList.Count;
                }
                int num1 = this._ChaptersOff[i];
                for (int j = this._ChaptersOff[i]; j < count; j++)
                {
                    this._Book.Chapters[i].AppendImage((Image)this._TotalImageList[j]);
                }
            }
            if (count < this._TotalImageList.Count)
            {
                CChapter chapter = new CChapter("未知", string.Empty);
                for (int k = count; k < this._TotalImageList.Count; k++)
                {
                    chapter.AppendImage((Image)this._TotalImageList[k]);
                }
                this._Book.AppendChapter(chapter);
            }
            this._TotalImageList.Clear();
        }
Esempio n. 2
0
        private string Prepare()
        {
            string str = string.Empty;

            int[]    numArray = new int[this._Book.Chapters.Count];
            int      num      = 0;
            CChapter chapter  = null;
            string   str2     = null;

            for (int i = 0; i < this._Book.Chapters.Count; i++)
            {
                chapter     = this._Book.Chapters[i];
                numArray[i] = num;/*http://www.joymo.cn,角摩手机乐园*/
                if (this._Book.BookType[1] == 2)
                {
                    this._TotalImageList.AddRange(chapter.ImageList);
                    num += chapter.ImageList.Count;
                }
                else if (this._Book.BookType[1] == 1)
                {
                    str2 = chapter.Content.Replace("\r\n", "\u2029") + "\u2029";
                    str  = str + str2;
                    num += str2.Length * 2;
                }
            }
            this._TotalContent    = str;
            this._TotalContentLen = num;
            this._ChaptersOff     = numArray;
            return(null);
        }
Esempio n. 3
0
        private void Prepare()
        {
            this.year  = this.publishDate.Year.ToString();
            this.month = this.publishDate.Month.ToString();
            this.day   = this.publishDate.Day.ToString();
            Random random = new Random();

            this.pgkSeed = (short)(random.Next(0x401, 0x7fff) % 0xffff);
            this.cid     = random.Next(0x5f5e101, 0x3b9aca00);
            int           byteIndex = 0;
            StringBuilder builder   = new StringBuilder();

            for (int i = 0; i < this.chapters.Count; i++)
            {
                CChapter chapter = this.chapters[i];
                chapter.Content = chapter.Content.Replace("\r\n", "\u2029");
                builder.Append(chapter.Content);
                this.chapOff[i] = byteIndex;
                byteIndex      += chapter.Content.Length * 2;
            }
            this.contentLength = byteIndex;
            this.text          = builder.ToString();
            byte[] bytes = new byte[this.contentLength];
            byteIndex = 0;
            for (int j = 0; j < this.chapters.Count; j++)
            {
                CChapter chapter2 = this.chapters[j];
                this.encoding.GetBytes(chapter2.Content, 0, chapter2.Content.Length, bytes, byteIndex);
                byteIndex += chapter2.Content.Length * 2;
            }
            int num4 = 0;

            if ((bytes.Length % 0x8000) == 0)
            {
                num4 = bytes.Length / 0x8000;
            }
            else
            {
                num4 = (bytes.Length / 0x8000) + 1;
            }
            byteIndex = 0;
            byte[] output = new byte[0x8000];
            for (int k = 0; k < num4; k++)
            {
                Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION, false);
                deflater.SetInput(bytes, byteIndex, Math.Min(0x8000, bytes.Length - byteIndex));
                deflater.Finish();
                deflater.Deflate(output);
                byte[] destinationArray = new byte[deflater.TotalOut];
                Array.Copy(output, 0, destinationArray, 0, destinationArray.Length);
                this.zippedSeg.Add(destinationArray);
                byteIndex += output.Length;
            }
        }
Esempio n. 4
0
        public void AppendChapter()
        {
            CChapter chapter = new CChapter("第 " + (this.chapters.Count + 1) + "章", "");

            this.Chapters.Add(chapter);
        }
Esempio n. 5
0
 public int Add(CChapter chapter)
 {
     return(base.List.Add(chapter));
 }
Esempio n. 6
0
 public void Insert(int index, CChapter chapter)
 {
     base.List.Insert(index, chapter);
 }
Esempio n. 7
0
 public void AppendChapter(CChapter chapter)
 {
     this._Book_Chapters.Add(chapter);
 }