Beispiel #1
0
 protected bool Equals(TextProps other)
 {
     return(MinorVersion == other.MinorVersion && MajorVersion == other.MajorVersion && Equals(PropMask, other.PropMask) &&
            FontEffects == other.FontEffects && FontHeight == other.FontHeight && FontCharSet == other.FontCharSet &&
            FontPitchAndFamily == other.FontPitchAndFamily && ParagraphAlign == other.ParagraphAlign && FontWeight == other.FontWeight &&
            string.Equals(FontName, other.FontName));
 }
        public CommandButtonControl(byte[] b)
        {
            using (var st = new MemoryStream(b))
                using (var r = new FrxReader(st)) {
                    MinorVersion = r.ReadByte();
                    MajorVersion = r.ReadByte();

                    var cbCommandButton = r.ReadUInt16();
                    PropMask = new CommandButtonPropMask(r.ReadUInt32());

                    // DataBlock
                    ForeColor           = PropMask.HasForeColor ? r.ReadOleColor() : null;
                    BackColor           = PropMask.HasBackColor ? r.ReadOleColor() : null;
                    VariousPropertyBits = PropMask.HasVariousPropertyBits ? r.ReadUInt32() : 0;
                    var captionCcb = PropMask.HasCaption ? r.ReadCcb() : Tuple.Create(0, false);
                    PicturePosition = PropMask.HasPicturePosition ? r.ReadPicturePosition() : PicturePosition.RightTop;
                    MousePointer    = PropMask.HasMousePointer ? r.ReadMousePointer() : MousePointer.Arrow;
                    if (PropMask.HasPicture)
                    {
                        r.Skip2Bytes();
                    }
                    Accelerator = PropMask.HasAccelerator ? r.ReadWChar() : "";
                    if (PropMask.HasMouseIcon)
                    {
                        r.Skip2Bytes();
                    }

                    // ExtraDataBlock
                    Caption = r.ReadStringFromCcb(captionCcb);
                    Size    = PropMask.HasSize ? r.ReadCoords() : Tuple.Create(0, 0);

                    r.AlignTo(4);
                    if (cbCommandButton != r.BaseStream.Position - 4)
                    {
                        throw new ApplicationException("Error reading 'o' stream in .frx data: expected cbCommandButton size "
                                                       + $"{r.BaseStream.Position - 4}, but actual size was {cbCommandButton}.");
                    }

                    // StreamData
                    Picture   = PropMask.HasPicture ? r.ReadGuidAndPicture() : new byte[0];
                    MouseIcon = PropMask.HasMouseIcon ? r.ReadGuidAndPicture() : new byte[0];

                    TextProps = r.ReadTextProps();
                }
        }
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = Picture?.Length.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (MouseIcon?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VariousPropertyBits;
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PicturePosition;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (Accelerator?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Size?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Beispiel #4
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (ForeColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (BackColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)VariousPropertyBits;
         hashCode = (hashCode * 397) ^ (Caption?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)PicturePosition;
         hashCode = (hashCode * 397) ^ (int)MousePointer;
         hashCode = (hashCode * 397) ^ (Accelerator?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Size?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Picture?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (MouseIcon?.Length.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (TextProps?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)MaxLength;
         hashCode = (hashCode * 397) ^ (int)BorderStyle;
         hashCode = (hashCode * 397) ^ (ScrollBars?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ DisplayStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ (PasswordChar?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ListWidth;
         hashCode = (hashCode * 397) ^ BoundColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ TextColumn.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnCount.GetHashCode();
         hashCode = (hashCode * 397) ^ ListRows.GetHashCode();
         hashCode = (hashCode * 397) ^ ColumnInfoCount.GetHashCode();
         hashCode = (hashCode * 397) ^ MatchEntry.GetHashCode();
         hashCode = (hashCode * 397) ^ ListStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ ShowDropButtonWhen.GetHashCode();
         hashCode = (hashCode * 397) ^ DropButtonStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ MultiSelect.GetHashCode();
         hashCode = (hashCode * 397) ^ (BorderColor?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)SpecialEffect;
         hashCode = (hashCode * 397) ^ (Value?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (GroupName?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Remainder?.Length.GetHashCode() ?? 0);
         return(hashCode);
     }
 }