Exemple #1
0
        /// <summary>
        /// Generate the serial number string based off the serial number
        /// values.
        /// </summary>
        /// <returns>String of the serial number.</returns>
        private string GetSerialNumberString()
        {
            StringBuilder result = new StringBuilder();

            // Base Electronics
            if (string.IsNullOrEmpty(BaseHardware))
            {
                result.Append("00");
            }
            else
            {
                result.Append(BaseHardware.PadLeft(BASE_HDWR_NUM_BYTES, '0'));
            }

            // Subsystems
            if (string.IsNullOrEmpty(SubSystems))
            {
                result.Append("000000000000000");
            }
            else
            {
                // Set the subsystems, padding the end with 0's
                result.Append(SubSystems.PadRight(SUBSYSTEM_NUM_BYTES, '0'));
            }

            // Spare
            if (string.IsNullOrEmpty(Spare))
            {
                result.Append("000000000");
            }
            else
            {
                result.Append(Spare.PadRight(SPARE_NUM_BYTES, '0'));
            }

            // Serial number
            if (SystemSerialNumber == EMPTY_SERIAL_NUM)
            {
                result.Append("000000");
            }
            else
            {
                string serial = SystemSerialNumber.ToString();
                result.Append(serial.PadLeft(SERIAL_NUM_BYTES, '0'));
            }


            return(result.ToString());
        }