Exemple #1
0
        public TpsUnsignedLong(RandomAccess rx)
        {
            if (rx == null)
            {
                throw new ArgumentNullException(nameof(rx));
            }

            Value = rx.UnsignedLongLE();
        }
Exemple #2
0
        /// <summary>
        /// Instantiates a new DATE from the given binary reader.
        /// </summary>
        /// <remarks>
        /// The byte stream is read in the following order:
        /// <list type="bullet">
        /// <item>Day</item>
        /// <item>Month</item>
        /// <item>Year (low half)</item>
        /// <item>Year (high half)</item>
        /// </list>
        /// </remarks>
        /// <param name="rx"></param>
        public TpsDate(RandomAccess rx)
        {
            if (rx == null)
            {
                throw new ArgumentNullException(nameof(rx));
            }

            // Date, mask encoded

            long date = rx.UnsignedLongLE();

            if (date != 0)
            {
                long years  = (date & 0xFFFF0000) >> 16;
                long months = (date & 0x0000FF00) >> 8;
                long days   = date & 0x000000FF;
                Value = new DateTime((int)years, (int)months, (int)days);
            }
            else
            {
                Value = null;
            }
        }