Exemple #1
0
        public override void Decode()
        {
            MemoryStream stream = new MemoryStream(Data);
            BinaryReader reader = new BinaryReader(stream);

            BlipTypeWin32 = reader.ReadByte();
            BlipTypeMacOS = reader.ReadByte();
            UID           = new Guid(reader.ReadBytes(16));
            Tag           = reader.ReadUInt16();
            BlipSize      = reader.ReadUInt32();
            Ref           = reader.ReadInt32();
            Offset        = reader.ReadInt32();
            Usage         = reader.ReadByte();
            NameLength    = reader.ReadByte();
            Unused2       = reader.ReadByte();
            Unused3       = reader.ReadByte();

            if (NameLength > 0)
            {
                BlipName = Encoding.Unicode.GetString(reader.ReadBytes(NameLength));
            }

            if (stream.Position < stream.Length)
            {
                BlipRecord = EscherRecord.Read(stream) as MsofbtBlip;
                if (BlipRecord != null)
                {
                    BlipRecord.Decode();
                    this.ImageData = BlipRecord.ImageData;
                }
                else
                {
                    throw new Exception("Image Type Not supported.");
                }
            }

            if (stream.Position < stream.Length)
            {
                ExtraData = StreamHelper.ReadToEnd(stream);
            }
        }
        public override void Decode()
        {
            MemoryStream stream = new MemoryStream(Data);
            BinaryReader reader = new BinaryReader(stream);
            BlipTypeWin32 = reader.ReadByte();
            BlipTypeMacOS = reader.ReadByte();
            UID = new Guid(reader.ReadBytes(16));
            Tag = reader.ReadUInt16();
            BlipSize = reader.ReadUInt32();
            Ref = reader.ReadInt32();
            Offset = reader.ReadInt32();
            Usage = reader.ReadByte();
            NameLength = reader.ReadByte();
            Unused2 = reader.ReadByte();
            Unused3 = reader.ReadByte();

            if (NameLength > 0)
            {
                BlipName = Encoding.Unicode.GetString(reader.ReadBytes(NameLength));
            }

            if (stream.Position < stream.Length)
            {
                BlipRecord = EscherRecord.Read(stream) as MsofbtBlip;
                if (BlipRecord != null)
                {
                    BlipRecord.Decode();
                    this.ImageData = BlipRecord.ImageData;
                }
                else
                {
                    throw new Exception("Image Type Not supported.");
                }
            }

            if (stream.Position < stream.Length)
            {
                ExtraData = StreamHelper.ReadToEnd(stream);
            }
        }