Esempio n. 1
0
        protected static MotionPack LoadMotionPackFromDMpkg(MotionPackUserInfo ui, Stream streamHeader, Stream streamContent)
        {
            MotionPack motionPack = new MotionPack(ui);
            bool       flag       = false;

            Balthasar.IO.PackageLang pl = null;
            using (BinaryReader binaryReader = new BinaryReader(streamHeader))
            {
                flag = MotionPackReader.LoadHeader(ref motionPack, binaryReader, ref pl);
            }
            if (flag)
            {
                using (BinaryReader binaryReader2 = new BinaryReader(streamContent))
                {
                    long num = (long)((ulong)binaryReader2.ReadUInt32());
                    if (motionPack.CompressMode == 1)
                    {
                        binaryReader2.ReadUInt32();
                        byte[]       array        = binaryReader2.ReadBytes((int)(num - 4L));
                        MemoryStream memoryStream = MotionPackReader.decompress(array);
                        array = memoryStream.ToArray();
                        using (MemoryStream memoryStream2 = new MemoryStream(array))
                        {
                            using (BinaryReader binaryReader3 = new BinaryReader(memoryStream2))
                            {
                                MotionPackReader.LoadBody(ref motionPack, binaryReader3, ref pl);
                            }
                        }
                    }
                }
            }
            return(motionPack);
        }
Esempio n. 2
0
        public static MotionPack LoadMotionPackFromMoPkg(Stream stream)
        {
            MotionPack motionPack = new MotionPack();

            using (BinaryReader binaryReader = new BinaryReader(stream))
            {
                Balthasar.IO.PackageLang pl = null;
                if (MotionPackReader.LoadHeader(ref motionPack, binaryReader, ref pl))
                {
                    long num = (long)((ulong)binaryReader.ReadUInt32());
                    if (motionPack.CompressMode == 1)
                    {
                        binaryReader.ReadUInt32();
                        byte[]       array        = binaryReader.ReadBytes((int)(num - 4L));
                        MemoryStream memoryStream = MotionPackReader.decompress(array);
                        array = memoryStream.ToArray();
                        using (MemoryStream memoryStream2 = new MemoryStream(array))
                        {
                            using (BinaryReader binaryReader2 = new BinaryReader(memoryStream2))
                            {
                                MotionPackReader.LoadBody(ref motionPack, binaryReader2, ref pl);
                            }
                        }
                    }
                }
            }
            return(motionPack);
        }