コード例 #1
0
        /// <summary>
        /// Produce <see cref="DeviceStatusFlags"/> containing updated <see cref="IntellivisionIIStatusFlags"/> for a given <see cref="Device"/>.
        /// </summary>
        /// <param name="device">The <see cref="Device"/> whose updated flags are desired.</param>
        /// <param name="newIntellivisionIIFlags">New <see cref="IntellivisionIIStatusFlags"/> to apply to <paramref name="device"/>.</param>
        /// <returns>A new set of <see cref="DeviceStatusFlags"/> with updated IntellivisionIIStatusFlags for <paramref name="device"/>.</returns>
        internal static DeviceStatusFlags UpdateStatusFlags(this Device device, IntellivisionIIStatusFlags newIntellivisionIIFlags)
        {
            var deviceStatusFlags = device.DeviceStatusFlags & ~DeviceStatusFlags.IntellivisionIIStatusMask;

            deviceStatusFlags |= newIntellivisionIIFlags.ToDeviceStatusFlagsLo();
            return(deviceStatusFlags);
        }
コード例 #2
0
        public void DeviceStatusFlagsLo_MultipleFlagsSetToIntellivisionIICompatibiltyFlags_ReturnsExpectedFlags(DeviceStatusFlagsLo statusFlagsLo, IntellivisionIIStatusFlags expectedIntellivisionIIStatusFlags)
        {
            var actualIntellivisionIIStatusFlags = statusFlagsLo.ToIntellivisionIICompatibilityFlags();

            Assert.Equal(expectedIntellivisionIIStatusFlags, actualIntellivisionIIStatusFlags);
        }
コード例 #3
0
        public void DeviceStatusFlagsLo_ToIntellivisionIICompatibilityFlags_ReturnsExpectedFlags(DeviceStatusFlagsLo statusFlagsLo, IntellivisionIIStatusFlags expectedIntellivisionIIStatusFlags)
        {
            var actualIntellivisionIIStatusFlags = statusFlagsLo.ToIntellivisionIICompatibilityFlags();

            // NOTE: Implementation currently suppresses the reserved bits. Replicate this here.
            expectedIntellivisionIIStatusFlags &= ~IntellivisionIIStatusFlags.ReservedMask;
            Assert.Equal(expectedIntellivisionIIStatusFlags, actualIntellivisionIIStatusFlags);
        }
コード例 #4
0
        /// <summary>
        /// Places Intellivision II status flags into the more generic <see cref="DeviceStatusFlagsLo"/> bit array.
        /// </summary>
        /// <param name="intellivisionIIStatus">The Intellivision II status flags to convert.</param>
        /// <returns>The flags placed in a <see cref="DeviceStatusFlagsLo"/> bit array.</returns>
        internal static DeviceStatusFlagsLo ToDeviceStatusFlagsLo(this IntellivisionIIStatusFlags intellivisionIIStatus)
        {
            var deviceStatusFlags = (DeviceStatusFlagsLo)((ulong)intellivisionIIStatus << DeviceStatusFlagsLoHelpers.IntellivisionIIStatusBitsOffset);

            return(deviceStatusFlags);
        }
コード例 #5
0
 /// <summary>
 /// Converts status flags into a display string.
 /// </summary>
 /// <param name="intellivisionIIStatus">The Intellivision II status flags to convert.</param>
 /// <returns>A display string for the flags.</returns>
 internal static string ToDisplayString(this IntellivisionIIStatusFlags intellivisionIIStatus)
 {
     return(ModeToStringsTable[intellivisionIIStatus]);
 }