Esempio n. 1
0
        /// <summary>
        /// Determines whether the specified <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> instance is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> instance to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(Fusing other)
        {
            // If parameter is null return false (cast to object to prevent recursive loop!)
            if ((object)other == null)
            {
                return(false);
            }

            return
                (this.Primary == other.Primary &&
                 this.Secondary == other.Secondary &&
                 this.AHD == other.AHD);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> instance from the ushort value.
        /// </summary>
        /// <param name="value">The ushort value which represents the <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> instance.</param>
        /// <returns>The <see cref="DIS.OpenDIS.Enumerations.Entity.Information.Minefield.Fusing"/> instance, represented by the ushort value.</returns>
        public static Fusing FromUInt16(ushort value)
        {
            Fusing ps = new Fusing();

            uint mask0     = 0x007f;
            byte shift0    = 0;
            uint newValue0 = (value & mask0) >> shift0;

            ps.Primary = (Fusing.PrimaryValue)newValue0;

            uint mask1     = 0x3f80;
            byte shift1    = 7;
            uint newValue1 = (value & mask1) >> shift1;

            ps.Secondary = (Fusing.SecondaryValue)newValue1;

            uint mask2     = 0x0010;
            byte shift2    = 4;
            uint newValue2 = (value & mask2) >> shift2;

            ps.AHD = (Fusing.AHDValue)newValue2;

            return(ps);
        }