public static ICONIMAGE FromStream(System.IO.Stream Source) { ICONIMAGE output = new ICONIMAGE(); BinaryReader Reader = new BinaryReader(Source); output.Read(Reader); return(output); }
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; } }