コード例 #1
0
        /// <summary>
        /// Returns a value indicating whether the specified bit is enabled.
        /// </summary>
        /// <param name="value">Reference value.</param>
        /// <param name="bit">Bit to check.</param>
        /// <returns>
        /// <b>true</b> if specified <paramref name="bit" /> is enabled; otherwise, <b>false</b>.
        /// </returns>
        public static bool CheckBit(this ulong value, Bits bit)
        {
            SentinelHelper.IsEnumValid(bit);
            SentinelHelper.IsTrue((byte)bit > 63);

            return(value.CheckBit((byte)bit));
        }
コード例 #2
0
        /// <summary>
        /// Gets a collection of <b>TPM</b> characteristics.
        /// </summary>
        /// <param name="target">Value to analyze</param>
        /// <returns>
        /// Collection of <b>TPM</b> characteristics.
        /// </returns>
        private static ReadOnlyCollection <string> GetTpmCharacteristics(ulong target)
        {
            string[] value =
            {
                "TPM Device Characteristics are not supported",                          // 0x02
                "Family configurable via firmware update",
                "Family configurable via platform software support, such as BIOS Setup",
                "Family configurable via OEM proprietary mechanism"                      // 0x05
            };

            List <string> items = new List <string>();

            for (byte i = 2; i < 6; i++)
            {
                bool addCharacteristic = target.CheckBit(i);
                if (addCharacteristic)
                {
                    items.Add(value[i - 0x02]);
                }
            }

            return(items.AsReadOnly());
        }