Exemple #1
0
        private DataRecordFields ReadDataRecordFields(RecordLeader leader, RecordDirectory directory)
        {
            var fieldArea = new DataRecordFields();

            foreach (DirectoryEntry entry in directory)
            {
                if (DataDescriptiveRecord == null)
                {
                    throw new NotImplementedException(
                              "Processing a Data Record before the Data Descriptive Record is set");
                }

                DataDescriptiveRecordField dataDescriptiveField = null;

                foreach (DataDescriptiveRecordField item in DataDescriptiveRecord.Fields)
                {
                    if (item.Tag == entry.FieldTag)
                    {
                        dataDescriptiveField = item;
                        break;
                    }
                }

                if (dataDescriptiveField == null)
                {
                    throw new Exception("Unable to find data descriptive field");
                }

                var df = new DataField(entry.FieldTag, (DataDescriptiveField)dataDescriptiveField, bufferedReader.ReadBytes(entry.FieldLength));

                fieldArea.Add(df);
            }

            return(fieldArea);
        }
Exemple #2
0
        private DataRecordFields ReadDataRecordFields(RecordLeader leader, RecordDirectory directory)
        {
            var fieldArea = new DataRecordFields();

            foreach (DirectoryEntry entry in directory)
            {
                if (DataDescriptiveRecord == null)
                {
                    throw new NotImplementedException(
                              "Processing a Data Record before the Data Descriptive Record is set");
                }

                DataDescriptiveRecordField dataDescriptiveField = null;

                foreach (DataDescriptiveRecordField item in DataDescriptiveRecord.Fields)
                {
                    if (item.Tag == entry.FieldTag)
                    {
                        dataDescriptiveField = item;
                        break;
                    }
                }

                if (dataDescriptiveField == null)
                {
                    throw new Exception("Unable to find data descriptive field");
                }

                ArraySegment <byte> temp = new ArraySegment <byte>(m_fileByteArray, currentFileOffset, entry.FieldLength);
                currentFileOffset += entry.FieldLength;

                var df = new DataField(entry.FieldTag, (DataDescriptiveField)dataDescriptiveField, temp);

                fieldArea.Add(df);
            }

            return(fieldArea);
        }