示例#1
0
        public static ICONIMAGE FromStream(System.IO.Stream Source)
        {
            ICONIMAGE    output = new ICONIMAGE();
            BinaryReader Reader = new BinaryReader(Source);

            output.Read(Reader);
            return(output);
        }
示例#2
0
        private void ReadBMPBuffer(MemoryStream buffer)
        {
            type            = FrameType.BITMAP;
            buffer.Position = 0;
            BinaryReader reader     = new BinaryReader(buffer);
            byte         firstByte  = reader.ReadByte();
            byte         secondByte = reader.ReadByte();

            if ((firstByte == 0x42) && (secondByte == 0x4D)) //In BMP file header, the first two bytes represents, in ASCII code, BM
            {
                buffer.Position = 0;
                buffer.Seek(14, SeekOrigin.Begin);
                iconImage = new ICONIMAGE();
                iconImage.Read(reader);
            }
            else
            {
                buffer.Position = 0;
                var i = new ICONIMAGE();
                i.Read(reader);
                iconImage = i;
            }
        }