Пример #1
0
        public override ImageData Read(IBinaryStream file, ImageMetaData info)
        {
            var meta = (IkeMetaData)info;

            using (var bmp = IkeReader.CreateStream(file, meta.UnpackedSize))
                return(Bmp.Read(bmp, info));
        }
Пример #2
0
        public override ImageMetaData ReadMetaData(IBinaryStream file)
        {
            var header = file.ReadHeader(0x11);

            if (!header.AsciiEqual(2, "ike") || !header.AsciiEqual(0xF, "BM"))
            {
                return(null);
            }
            int unpacked_size = IkeReader.DecodeSize(header[10], header[11], header[12]);

            using (var bmp = IkeReader.CreateStream(file, 0x36))
            {
                var info = Bmp.ReadMetaData(bmp);
                if (null == info)
                {
                    return(null);
                }
                return(new IkeMetaData {
                    Width = info.Width,
                    Height = info.Height,
                    BPP = info.BPP,
                    UnpackedSize = unpacked_size,
                });
            }
        }
Пример #3
0
        public static IBinaryStream CreateStream(IBinaryStream input, int unpacked_size)
        {
            input.Position = 0xD;
            var ike  = new IkeReader(input, unpacked_size);
            var data = ike.Unpack();

            return(new BinMemoryStream(data));
        }
Пример #4
0
        public override ArcFile TryOpen(ArcView file)
        {
            int count = file.View.ReadInt32(0);

            if ((count & 0xFFFF) != 0)
            {
                return(null);
            }
            count = (count >> 16) - 1;
            if (!IsSaneCount(count))
            {
                return(null);
            }

            uint index_offset = 0xC;
            var  dir          = new List <Entry> (count);

            for (int i = 0; i < count; ++i)
            {
                var name  = file.View.ReadUInt32(index_offset).ToString("D5");
                var entry = new PackedEntry {
                    Name     = name,
                    Offset   = file.View.ReadUInt32(index_offset + 4) << 11,
                        Size = file.View.ReadUInt32(index_offset + 8),
                };
                if (!entry.CheckPlacement(file.MaxOffset))
                {
                    return(null);
                }
                dir.Add(entry);
                index_offset += 12;
            }
            foreach (PackedEntry entry in dir)
            {
                uint signature;
                if (entry.Size > 13 && file.View.AsciiEqual(entry.Offset + 2, "ike"))
                {
                    int unpacked_size = IkeReader.DecodeSize(file.View.ReadByte(entry.Offset + 10),
                                                             file.View.ReadByte(entry.Offset + 11),
                                                             file.View.ReadByte(entry.Offset + 12));
                    entry.IsPacked     = true;
                    entry.UnpackedSize = (uint)unpacked_size;
                    signature          = file.View.ReadUInt32(entry.Offset + 0xF);
                    entry.Offset      += 13;
                    entry.Size        -= 13;
                }
                else
                {
                    signature = file.View.ReadUInt32(entry.Offset);
                }
                entry.ChangeType(AutoEntry.DetectFileType(signature));
            }
            return(new ArcFile(file, this, dir));
        }
Пример #5
0
        public override Stream OpenEntry(ArcFile arc, Entry entry)
        {
            var pent = entry as PackedEntry;

            if (null == pent || !pent.IsPacked)
            {
                return(base.OpenEntry(arc, entry));
            }
            using (var input = arc.File.CreateStream(entry.Offset, entry.Size))
            {
                var reader = new IkeReader(input, (int)pent.UnpackedSize);
                var data   = reader.Unpack();
                return(new BinMemoryStream(data, entry.Name));
            }
        }
Пример #6
0
        public override SoundInput TryOpen(IBinaryStream file)
        {
            var header = file.ReadHeader(0x13);

            if (!header.AsciiEqual(2, "ike") || !header.AsciiEqual(0xF, "RIFF"))
            {
                return(null);
            }
            int unpacked_size = IkeReader.DecodeSize(header[10], header[11], header[12]);
            var wav           = IkeReader.CreateStream(file, unpacked_size);
            var sound         = Wav.TryOpen(wav);

            if (sound != null)
            {
                file.Dispose();
            }
            else
            {
                wav.Dispose();
            }
            return(sound);
        }