Example #1
0
        protected override ImageData GetImageData()
        {
            var meta = (CgdMetaData)Info;

            m_input.Position = meta.DataOffset;
            var pixels = new byte[meta.UnpackedSize];

            KTool.Unpack(m_input, pixels, meta.Compression);
            PixelFormat format = 24 == meta.BPP ? PixelFormats.Rgb24 : PixelFormats.Bgra32;

            return(ImageData.Create(meta, format, null, pixels));
        }
Example #2
0
 Stream OpenAudio(ArcFile arc, Entry entry)
 {
     using (var input = arc.File.CreateStream(entry.Offset, entry.Size))
     {
         var header      = input.ReadHeader(0x20);
         int header_size = header.ToUInt16(10);
         var format      = new WaveFormat {
             FormatTag             = header.ToUInt16(0x10),
             Channels              = header.ToUInt16(0x12),
             SamplesPerSecond      = header.ToUInt32(0x14),
             AverageBytesPerSecond = header.ToUInt32(0x18),
             BlockAlign            = header.ToUInt16(0x1C),
             BitsPerSample         = header.ToUInt16(0x1E),
         };
         input.Position = header_size + 0x10;
         var data = new byte[header.ToInt32(0)];
         KTool.Unpack(input, data, header[8]);
         var output = new MemoryStream(data.Length);
         WaveAudio.WriteRiffHeader(output, format, (uint)data.Length);
         output.Write(data, 0, data.Length);
         output.Position = 0;
         return(output);
     }
 }