Example #1
0
        /* ---------------------------------------------------------------------------------------------------------------------------------- */
        public static PackContents CreateFromWdtFile(WdtFile wdtFile)
        {
            Chapter contentsChapter = wdtFile.ChapterList[0];

            byte[] contentDecompressed = new byte [wdtFile.PageSize];
            var    memStream           = new MemoryStream(contentDecompressed);

            WdtDecompressor.DecompressChapter(wdtFile, contentsChapter, memStream);

            PackContents packContents;

            using (var decompressedStream = new MemoryStream(contentDecompressed))
            {
                packContents = new PackContents(decompressedStream);
            }

            return(packContents);
        }
Example #2
0
        /* ---------------------------------------------------------------------------------------------------------------------------------- */
        public static PackFile CreateFromWdtFile(WdtFile wdtFile)
        {
            var packFileStream = new MemoryStream(wdtFile.SizeDecompressed);

            for (int i = 0; i < wdtFile.ChapterList.Count; i++)
            {
                var chapter = wdtFile.ChapterList[i];

                byte[] decompressedChapter = new byte[wdtFile.PageSize];
                var    chapterMemoryStream = new MemoryStream(decompressedChapter);
                int    decompressedSize    = WdtDecompressor.DecompressChapter(wdtFile, chapter, chapterMemoryStream);

                decompressedSize = Math.Min(wdtFile.PageSize, decompressedSize);

                packFileStream.Write(decompressedChapter, 0, decompressedSize);
            }

            return(new PackFile(packFileStream));
        }