Пример #1
0
        public override IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            const int header_size = 32;
            var       ement       = (EmEntry)entry;

            if (ement.SubType != 4)
            {
                return(base.OpenImage(arc, entry));
            }
            var emarc  = (EmeArchive)arc;
            var header = arc.File.View.ReadBytes(entry.Offset, header_size);

            Decrypt(header, 0, header_size, emarc.Key);
            var info = new EmMetaData {
                LzssFrameSize = ement.LzssFrameSize,
                LzssInitPos   = ement.LzssInitPos,
                BPP           = header.ToUInt16(0) & 0xFF,
                Width         = header.ToUInt16(2),
                Height        = header.ToUInt16(4),
                Colors        = header.ToUInt16(6),
                Stride        = header.ToInt32(8),
                OffsetX       = header.ToInt32(0xC),
                OffsetY       = header.ToInt32(0x10),
                DataOffset    = header_size,
            };
            uint entry_size = entry.Size + header_size;

            if (0 != info.Colors && header[0] != 7)
            {
                entry_size += (uint)Math.Max(info.Colors, 3) * 4;
            }
            var input = arc.File.CreateStream(entry.Offset, entry_size);

            return(new EmeImageDecoder(input, info));
        }
Пример #2
0
        public override ImageMetaData ReadMetaData(IBinaryStream stream)
        {
            stream.ReadInt32();
            var info = new EmMetaData();

            info.LzssFrameSize = stream.ReadUInt16();
            info.LzssInitPos   = stream.ReadUInt16();
            info.BPP           = stream.ReadUInt16() & 0xFF;
            info.Width         = stream.ReadUInt16();
            info.Height        = stream.ReadUInt16();
            info.Colors        = stream.ReadUInt16();
            info.Stride        = stream.ReadInt32();
            info.OffsetX       = stream.ReadInt32();
            info.OffsetY       = stream.ReadInt32();
            info.DataOffset    = 40;
            return(info);
        }
Пример #3
0
 public override ImageMetaData ReadMetaData(Stream stream)
 {
     using (var reader = new ArcView.Reader(stream))
     {
         reader.ReadInt32();
         var info = new EmMetaData();
         info.LzssFrameSize = reader.ReadUInt16();
         info.LzssInitPos   = reader.ReadUInt16();
         info.BPP           = reader.ReadUInt16() & 0xFF;
         info.Width         = reader.ReadUInt16();
         info.Height        = reader.ReadUInt16();
         info.Colors        = reader.ReadUInt16();
         info.Stride        = reader.ReadInt32();
         info.OffsetX       = reader.ReadInt32();
         info.OffsetY       = reader.ReadInt32();
         info.DataOffset    = 40;
         return(info);
     }
 }
Пример #4
0
 public EmeImageDecoder(IBinaryStream input, EmMetaData info) : base(input, info)
 {
 }