/// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="leader">The leader.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="size">The size.</param>
        /// <param name="record">The record.</param>
        /// <param name="offset">The offset.</param>
        /// <returns>The <see cref="bool" />.</returns>
        /// <exception cref="System.ArgumentNullException">leader</exception>
        /// <exception cref="System.ApplicationException">
        /// Unrecognised data_struct_code value  + record[offset] +  Field  + tag
        ///                         +  initialization incorrect.
        /// or
        /// Unrecognised data_type_code value  + record[offset + 1] +  Field  + tag
        ///                         + initialization incorrect.
        /// </exception>
        public bool Initialize(DdfLeader leader, string tag, int size, char[] record, int offset)
        {
            if (leader == null)
            {
                throw new ArgumentNullException("leader");
            }

            this.Tag = tag;

            int charsConsumed;

            /* -------------------------------------------------------------------- */
            /*      Set the data struct and type codes.                             */
            /* -------------------------------------------------------------------- */
            switch (record[offset])
            {
                case ' ': /* for ADRG, DIGEST USRP, DIGEST ASRP files */
                case '0':
                    this._dataStructureCode = DdfDataStructCode.DscElementary;
                    break;
                case '1':
                    this._dataStructureCode = DdfDataStructCode.DscVector;
                    break;
                case '2':
                    this._dataStructureCode = DdfDataStructCode.DscArray;
                    break;
                case '3':
                    this._dataStructureCode = DdfDataStructCode.DscConcatenated;
                    break;
                default:
                    throw new ApplicationException(
                        "Unrecognised data_struct_code value " + record[offset] + " Field " + tag
                        + " initialization incorrect.");

                    // dataStructureCode = DDF_data_struct_code.dsc_elementary;
            }

            switch (record[offset + 1])
            {
                case ' ': /* for ADRG, DIGEST USRP, DIGEST ASRP files */
                case '0':
                    break;

                case '1':
                    break;

                case '2':
                    break;

                case '3':
                    break;

                case '4':
                    break;

                case '5':
                    break;

                case '6':
                    break;

                default:
                    throw new ApplicationException(
                        "Unrecognised data_type_code value " + record[offset + 1] + " Field " + tag
                        + "initialization incorrect.");

                    // dataTypeCode = dtc_char_string;
            }

            /* -------------------------------------------------------------------- */
            /*      Capture the field name, description (sub field names), and      */
            /*      format statements.                                              */
            /* -------------------------------------------------------------------- */
            int fieldDataOffset = leader.FieldControlLength;

            this.FieldName = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            fieldDataOffset += charsConsumed;

            this._arrayDescription = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            fieldDataOffset += charsConsumed;

            this._formatControls = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            if (this._dataStructureCode != DdfDataStructCode.DscElementary)
            {
                if (!this.BuildSubfields())
                {
                    return false;
                }

                if (!this.ApplyFormats())
                {
                    return false;
                }
            }

            return true;
        }
        /// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="leader">The leader.</param>
        /// <param name="tag">The tag.</param>
        /// <param name="size">The size.</param>
        /// <param name="record">The record.</param>
        /// <param name="offset">The offset.</param>
        /// <returns>The <see cref="bool" />.</returns>
        /// <exception cref="System.ArgumentNullException">leader</exception>
        /// <exception cref="System.ApplicationException">
        /// Unrecognised data_struct_code value  + record[offset] +  Field  + tag
        ///                         +  initialization incorrect.
        /// or
        /// Unrecognised data_type_code value  + record[offset + 1] +  Field  + tag
        ///                         + initialization incorrect.
        /// </exception>
        public bool Initialize(DdfLeader leader, string tag, int size, char[] record, int offset)
        {
            if (leader == null)
            {
                throw new ArgumentNullException("leader");
            }

            this.Tag = tag;

            int charsConsumed;

            /* -------------------------------------------------------------------- */
            /*      Set the data struct and type codes.                             */
            /* -------------------------------------------------------------------- */
            switch (record[offset])
            {
            case ' ':     /* for ADRG, DIGEST USRP, DIGEST ASRP files */
            case '0':
                this._dataStructureCode = DdfDataStructCode.DscElementary;
                break;

            case '1':
                this._dataStructureCode = DdfDataStructCode.DscVector;
                break;

            case '2':
                this._dataStructureCode = DdfDataStructCode.DscArray;
                break;

            case '3':
                this._dataStructureCode = DdfDataStructCode.DscConcatenated;
                break;

            default:
                throw new ApplicationException(
                          "Unrecognised data_struct_code value " + record[offset] + " Field " + tag
                          + " initialization incorrect.");

                // dataStructureCode = DDF_data_struct_code.dsc_elementary;
            }

            switch (record[offset + 1])
            {
            case ' ':     /* for ADRG, DIGEST USRP, DIGEST ASRP files */
            case '0':
                break;

            case '1':
                break;

            case '2':
                break;

            case '3':
                break;

            case '4':
                break;

            case '5':
                break;

            case '6':
                break;

            default:
                throw new ApplicationException(
                          "Unrecognised data_type_code value " + record[offset + 1] + " Field " + tag
                          + "initialization incorrect.");

                // dataTypeCode = dtc_char_string;
            }

            /* -------------------------------------------------------------------- */
            /*      Capture the field name, description (sub field names), and      */
            /*      format statements.                                              */
            /* -------------------------------------------------------------------- */
            int fieldDataOffset = leader.FieldControlLength;

            this.FieldName = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            fieldDataOffset += charsConsumed;

            this._arrayDescription = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            fieldDataOffset += charsConsumed;

            this._formatControls = DdfUtils.ReadStringFromBufffer(
                record,
                offset + fieldDataOffset,
                size - fieldDataOffset,
                Constants.DdfUnitTerminator,
                Constants.DdfFieldTerminator,
                out charsConsumed);

            if (this._dataStructureCode != DdfDataStructCode.DscElementary)
            {
                if (!this.BuildSubfields())
                {
                    return(false);
                }

                if (!this.ApplyFormats())
                {
                    return(false);
                }
            }

            return(true);
        }