Пример #1
0
        /// <summary>
        /// Sets the bits of <paramref name="value"/> into the
        /// <paramref name="charger"/> at offset zero.
        /// </summary>
        /// <remarks>
        /// This method sets all bits of <paramref name="value"/>
        /// into the <paramref name="charger"/> at offset zero.
        /// </remarks>
        /// <param name="charger">
        /// An instance of <see cref="IBitCharger"/> to set the bits
        /// into.
        /// </param>
        /// <param name="value">
        /// The bits to set.
        /// </param>
        /// <param name="offset">
        /// The byte index to start with changing the bits.
        /// </param>
        public static void SetBytes(this IBitCharger charger, SByte value, Int32 offset)
        {
            charger.ValidateInstance();

            Byte[] array = new Byte[] { (Byte)value };

            charger.SetBytes(array, offset);
        }
Пример #2
0
        /// <summary>
        /// Gets all bytes from the charger and converts them into
        /// <see cref="UInt64"/>.
        /// </summary>
        /// <remarks>
        /// This method gets all bytes from the charger and converts
        /// them into <see cref="UInt64"/>.
        /// </remarks>
        /// <param name="charger">
        /// An instance of <see cref="IBitCharger"/> to set the bits
        /// </param>
        /// <param name="offset">
        /// The byte index to get all affected bits from.
        /// </param>
        /// <returns>
        /// A value of type <see cref="UInt64"/> representing all applied
        /// bits.
        /// </returns>
        public static UInt64 ToUInt64(this IBitCharger charger, Int32 offset)
        {
            charger.ValidateInstance();

            Byte[] array = charger.GetBytes(offset, sizeof(UInt64));

            return(BitConverter.ToUInt64(array, 0));
        }
Пример #3
0
        /// <summary>
        /// Gets all bytes from the charger and converts them into
        /// <see cref="Int16"/>.
        /// </summary>
        /// <remarks>
        /// This method gets all bytes from the charger and converts
        /// them into <see cref="Int16"/>.
        /// </remarks>
        /// <param name="charger">
        /// An instance of <see cref="IBitCharger"/> to set the bits
        /// </param>
        /// <param name="offset">
        /// The byte index to get all affected bits from.
        /// </param>
        /// <returns>
        /// A value of type <see cref="Int16"/> representing all applied
        /// bits.
        /// </returns>
        public static Int16 ToInt16(this IBitCharger charger, Int32 offset)
        {
            charger.ValidateInstance();

            Byte[] array = charger.GetBytes(offset, sizeof(Int16));

            return(BitConverter.ToInt16(array, 0));
        }
Пример #4
0
        /// <summary>
        /// Sets the bits of <paramref name="value"/> into the
        /// <paramref name="charger"/> at offset zero.
        /// </summary>
        /// <remarks>
        /// This method sets all bits of <paramref name="value"/>
        /// into the <paramref name="charger"/> at offset zero.
        /// </remarks>
        /// <param name="charger">
        /// An instance of <see cref="IBitCharger"/> to set the bits
        /// into.
        /// </param>
        /// <param name="value">
        /// The bits to set.
        /// </param>
        /// <param name="offset">
        /// The byte index to start with changing the bits.
        /// </param>
        public static void SetBytes(this IBitCharger charger, UInt64 value, Int32 offset)
        {
            charger.ValidateInstance();

            Byte[] array = BitConverter.GetBytes(value);

            charger.SetBytes(array, offset);
        }
Пример #5
0
        /// <summary>
        /// Gets all bytes from the charger and converts them into
        /// <see cref="Byte"/>.
        /// </summary>
        /// <remarks>
        /// This method gets all bytes from the charger and converts
        /// them into <see cref="Byte"/>.
        /// </remarks>
        /// <param name="charger">
        /// An instance of <see cref="IBitCharger"/> to set the bits
        /// </param>
        /// <param name="offset">
        /// The byte index to get all affected bits from.
        /// </param>
        /// <returns>
        /// A value of type <see cref="Byte"/> representing all applied
        /// bits.
        /// </returns>
        public static Byte ToByte(this IBitCharger charger, Int32 offset)
        {
            charger.ValidateInstance();

            Byte[] array = charger.GetBytes(offset, sizeof(Byte));

            return(array[0]);
        }