コード例 #1
0
ファイル: PaintScheme.cs プロジェクト: sab193/open-dis-csharp
        /// <summary>
        /// Determines whether the specified <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> instance is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> instance to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(PaintScheme other)
        {
            // If parameter is null return false (cast to object to prevent recursive loop!)
            if ((object)other == null)
            {
                return(false);
            }

            return
                (this.Algae == other.Algae &&
                 this.Value == other.Value);
        }
コード例 #2
0
ファイル: PaintScheme.cs プロジェクト: sab193/open-dis-csharp
        /// <summary>
        /// Creates the <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> instance from the byte value.
        /// </summary>
        /// <param name="value">The byte value which represents the <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> instance.</param>
        /// <returns>The <see cref="OpenDis.Enumerations.Entity.Information.Minefield.PaintScheme"/> instance, represented by the byte value.</returns>
        public static PaintScheme FromByte(byte value)
        {
            PaintScheme ps = new PaintScheme();

            uint mask0     = 0x0003;
            byte shift0    = 0;
            uint newValue0 = value & mask0 >> shift0;

            ps.Algae = (PaintScheme.AlgaeValue)newValue0;

            uint mask1     = 0x00fc;
            byte shift1    = 2;
            uint newValue1 = value & mask1 >> shift1;

            ps.Value = (PaintScheme.PaintSchemeValue)newValue1;

            return(ps);
        }