public OleSiteConcreteControl(byte[] b) { using (var st = new MemoryStream(b)) using (var r = new FrxReader(st)) { PropMask = new SitePropMask(r.ReadUInt32()); // DataBlock var nameCcb = PropMask.HasName ? r.ReadCcb() : Tuple.Create(0, false); var tagCcb = PropMask.HasTag ? r.ReadCcb() : Tuple.Create(0, false); Id = PropMask.HasId ? r.ReadInt32() : 0; HelpContextId = PropMask.HasHelpContextId ? r.ReadInt32() : 0; BitFlags = PropMask.HasBitFlags ? r.ReadUInt32() : 0; ObjectStreamSize = PropMask.HasObjectStreamSize ? r.ReadUInt32() : 0; TabIndex = PropMask.HasTabIndex ? r.ReadInt16() : (short)0; ClsidCacheIndex = PropMask.HasClsidCacheIndex ? r.ReadInt16() : (short)0; GroupId = PropMask.HasGroupId ? r.ReadUInt16() : (ushort)0; var controlTipTextCcb = PropMask.HasControlTipText ? r.ReadCcb() : Tuple.Create(0, false); var runtimeLicKeyCcb = PropMask.HasRuntimeLicKey ? r.ReadCcb() : Tuple.Create(0, false); var controlSourceCcb = PropMask.HasControlSource ? r.ReadCcb() : Tuple.Create(0, false); var rowSourceCcb = PropMask.HasRowSource ? r.ReadCcb() : Tuple.Create(0, false); // ExtraDataBlock Name = r.ReadStringFromCcb(nameCcb); Tag = r.ReadStringFromCcb(tagCcb); SitePosition = PropMask.HasPosition ? r.ReadCoords() : Tuple.Create(0, 0); ControlTipText = r.ReadStringFromCcb(controlTipTextCcb); RuntimeLicKey = r.ReadStringFromCcb(runtimeLicKeyCcb); ControlSource = r.ReadStringFromCcb(controlSourceCcb); RowSource = r.ReadStringFromCcb(rowSourceCcb); if (st.Position < st.Length) { throw new ApplicationException(VBASyncResources.ErrorFrxExpectedEndOfOleSiteConcreteControl); } } }
public MorphDataControl(byte[] b) { using (var st = new MemoryStream(b)) using (var r = new FrxReader(st)) { MinorVersion = r.ReadByte(); MajorVersion = r.ReadByte(); var cbMorphData = r.ReadUInt16(); PropMask = new MorphDataPropMask(r.ReadUInt64()); // DataBlock VariousPropertyBits = PropMask.HasVariousPropertyBits ? r.ReadUInt32() : 0; BackColor = PropMask.HasBackColor ? r.ReadOleColor() : null; ForeColor = PropMask.HasForeColor ? r.ReadOleColor() : null; MaxLength = PropMask.HasMaxLength ? r.ReadUInt32() : 0; BorderStyle = PropMask.HasBorderStyle ? r.ReadBorderStyle() : BorderStyle.None; ScrollBars = new FormScrollBarFlags(PropMask.HasScrollBars ? r.ReadByte() : (byte)0); DisplayStyle = PropMask.HasDisplayStyle ? r.ReadByte() : (byte)0; MousePointer = PropMask.HasMousePointer ? r.ReadMousePointer() : MousePointer.Default; PasswordChar = PropMask.HasPasswordChar ? r.ReadWChar() : ""; ListWidth = PropMask.HasListWidth ? r.ReadUInt32() : 0; BoundColumn = PropMask.HasBoundColumn ? r.ReadUInt16() : (ushort)0; TextColumn = PropMask.HasTextColumn ? r.ReadInt16() : (short)0; ColumnCount = PropMask.HasColumnCount ? r.ReadInt16() : (short)0; ListRows = PropMask.HasListRows ? r.ReadUInt16() : (ushort)0; ColumnInfoCount = PropMask.HasColumnInfoCount ? r.ReadUInt16() : (ushort)0; MatchEntry = PropMask.HasMatchEntry ? r.ReadByte() : (byte)0; ListStyle = PropMask.HasListStyle ? r.ReadByte() : (byte)0; ShowDropButtonWhen = PropMask.HasShowDropDownWhen ? r.ReadByte() : (byte)0; DropButtonStyle = PropMask.HasDropButtonStyle ? r.ReadByte() : (byte)0; MultiSelect = PropMask.HasMultiSelect ? r.ReadByte() : (byte)0; var valueCcb = PropMask.HasValue ? r.ReadCcb() : Tuple.Create(0, false); var captionCcb = PropMask.HasCaption ? r.ReadCcb() : Tuple.Create(0, false); PicturePosition = PropMask.HasPicturePosition ? r.ReadPicturePosition() : PicturePosition.RightTop; BorderColor = PropMask.HasBorderColor ? r.ReadOleColor() : null; SpecialEffect = PropMask.HasSpecialEffect ? r.ReadSpecialEffect4() : SpecialEffect.Flat; if (PropMask.HasMouseIcon) { r.Skip2Bytes(); } if (PropMask.HasPicture) { r.Skip2Bytes(); } Accelerator = PropMask.HasAccelerator ? r.ReadWChar() : ""; var groupNameCcb = PropMask.HasGroupName ? r.ReadCcb() : Tuple.Create(0, false); // ExtraDataBlock Size = PropMask.HasSize ? r.ReadCoords() : Tuple.Create(0, 0); Value = r.ReadStringFromCcb(valueCcb); Caption = r.ReadStringFromCcb(captionCcb); GroupName = r.ReadStringFromCcb(groupNameCcb); r.AlignTo(4); if (cbMorphData != r.BaseStream.Position - 4) { throw new ApplicationException(string.Format(VBASyncResources.ErrorFrxStreamSizeMismatch, "o", "cbMorphData", r.BaseStream.Position - 4, cbMorphData)); } // StreamData MouseIcon = PropMask.HasMouseIcon ? r.ReadGuidAndPicture() : new byte[0]; Picture = PropMask.HasPicture ? r.ReadGuidAndPicture() : new byte[0]; TextProps = r.ReadTextProps(); Remainder = st.Position < st.Length ? r.Unaligned.ReadBytes((int)(st.Length - st.Position)) : new byte[0]; } }