コード例 #1
0
        public override ImageData Read(IBinaryStream file, ImageMetaData info)
        {
            var meta = (RpgmvpMetaData)info;

            using (var png = RpgmvDecryptor.DecryptStream(file, meta.Key, true))
                return(Png.Read(png, info));
        }
コード例 #2
0
        public override SoundInput TryOpen(IBinaryStream file)
        {
            var header = file.ReadHeader(0x14);

            if (header[4] != 'V')
            {
                return(null);
            }
            var key = RpgmvDecryptor.LastKey ?? RpgmvDecryptor.FindKeyFor(file.Name);

            if (null == key)
            {
                return(null);
            }
            for (int i = 0; i < 4; ++i)
            {
                header[0x10 + i] ^= key[i];
            }
            if (!header.AsciiEqual(0x10, "OggS"))
            {
                RpgmvDecryptor.LastKey = null;
                return(null);
            }
            RpgmvDecryptor.LastKey = key;
            var ogg = RpgmvDecryptor.DecryptStream(file, key);

            return(OggAudio.Instance.TryOpen(ogg));
        }
コード例 #3
0
        }                                                                 // 'RPGMV'

        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(0x14);

            if (header[4] != 'V')
            {
                return(null);
            }
            var key = RpgmvDecryptor.LastKey ?? RpgmvDecryptor.FindKeyFor(file.Name);

            if (null == key)
            {
                return(null);
            }
            for (int i = 0; i < 4; ++i)
            {
                header[0x10 + i] ^= key[i];
            }
            if (!header.AsciiEqual(0x10, "\x89PNG"))
            {
                RpgmvDecryptor.LastKey = null;
                return(null);
            }
            RpgmvDecryptor.LastKey = key;
            using (var png = RpgmvDecryptor.DecryptStream(file, key, true))
            {
                var info = Png.ReadMetaData(png);
                if (null == info)
                {
                    return(null);
                }
                return(new RpgmvpMetaData {
                    Width = info.Width,
                    Height = info.Height,
                    OffsetX = info.OffsetX,
                    OffsetY = info.OffsetY,
                    BPP = info.BPP,
                    Key = key,
                });
            }
        }