/// <summary>
        /// Initializes a new instance of the <see cref="MetadataRecord"/> class.
        /// </summary>
        /// <param name="historianID">Historian identifier of <see cref="MetadataRecord"/>.</param>
        /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
        public MetadataRecord(int historianID, MetadataFileLegacyMode legacyMode)
        {
            if (historianID < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(historianID));
            }

            HistorianID      = historianID;
            m_remarks        = string.Empty;
            m_hardwareInfo   = string.Empty;
            m_emailAddresses = string.Empty;
            m_description    = string.Empty;
            m_currentData    = string.Empty;
            m_name           = string.Empty;
            m_synonym1       = string.Empty;
            m_synonym2       = string.Empty;
            m_synonym3       = string.Empty;
            m_pagerNumbers   = string.Empty;
            m_phoneNumbers   = string.Empty;
            m_plantCode      = string.Empty;
            m_system         = string.Empty;
            m_emailTime      = string.Empty;
            m_securityFlags  = new MetadataRecordSecurityFlags();
            m_generalFlags   = new MetadataRecordGeneralFlags();
            m_alarmFlags     = new MetadataRecordAlarmFlags();
            m_analogFields   = new MetadataRecordAnalogFields(legacyMode);
            m_digitalFields  = new MetadataRecordDigitalFields(legacyMode);
            m_composedFields = new MetadataRecordComposedFields(legacyMode);
            m_constantFields = new MetadataRecordConstantFields();
            m_legacyMode     = legacyMode;
        }
        internal MetadataRecord(BinaryReader reader)
        {
            HistorianID      = reader.ReadInt32();
            m_remarks        = reader.ReadString();
            m_hardwareInfo   = reader.ReadString();
            m_emailAddresses = reader.ReadString();
            m_description    = reader.ReadString();
            m_currentData    = reader.ReadString();
            m_name           = reader.ReadString();
            m_synonym1       = reader.ReadString();
            m_synonym2       = reader.ReadString();
            m_synonym3       = reader.ReadString();
            m_pagerNumbers   = reader.ReadString();
            m_phoneNumbers   = reader.ReadString();
            m_plantCode      = reader.ReadString();
            m_system         = reader.ReadString();
            m_emailTime      = reader.ReadString();
            ScanRate         = reader.ReadSingle();
            UnitNumber       = reader.ReadInt32();

            m_securityFlags = new MetadataRecordSecurityFlags {
                Value = reader.ReadInt32()
            };
            m_generalFlags = new MetadataRecordGeneralFlags {
                Value = reader.ReadInt32()
            };
            m_alarmFlags = new MetadataRecordAlarmFlags {
                Value = reader.ReadInt32()
            };

            CompressionMinTime = reader.ReadInt32();
            CompressionMaxTime = reader.ReadInt32();
            m_sourceID         = reader.ReadInt32();

            switch (m_generalFlags.DataType)
            {
            case DataType.Analog:
                m_analogFields   = new MetadataRecordAnalogFields(reader);
                m_digitalFields  = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                m_constantFields = new MetadataRecordConstantFields();
                break;

            case DataType.Digital:
                m_digitalFields  = new MetadataRecordDigitalFields(reader);
                m_analogFields   = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                m_constantFields = new MetadataRecordConstantFields();
                break;

            case DataType.Composed:
                m_composedFields = new MetadataRecordComposedFields(reader);
                m_analogFields   = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                m_digitalFields  = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                m_constantFields = new MetadataRecordConstantFields();
                break;

            case DataType.Constant:
                m_constantFields = new MetadataRecordConstantFields(reader);
                m_analogFields   = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                m_digitalFields  = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 3
0
        internal MetadataRecord(BinaryReader reader)
        {
            m_historianID = reader.ReadInt32();
            m_remarks = reader.ReadString();
            m_hardwareInfo = reader.ReadString();
            m_emailAddresses = reader.ReadString();
            m_description = reader.ReadString();
            m_currentData = reader.ReadString();
            m_name = reader.ReadString();
            m_synonym1 = reader.ReadString();
            m_synonym2 = reader.ReadString();
            m_synonym3 = reader.ReadString();
            m_pagerNumbers = reader.ReadString();
            m_phoneNumbers = reader.ReadString();
            m_plantCode = reader.ReadString();
            m_system = reader.ReadString();
            m_emailTime = reader.ReadString();
            m_scanRate = reader.ReadSingle();
            m_unitNumber = reader.ReadInt32();

            m_securityFlags = new MetadataRecordSecurityFlags
            {
                Value = reader.ReadInt32()
            };

            m_generalFlags = new MetadataRecordGeneralFlags
            {
                Value = reader.ReadInt32()
            };

            m_alarmFlags = new MetadataRecordAlarmFlags
            {
                Value = reader.ReadInt32()
            };

            m_compressionMinTime = reader.ReadInt32();
            m_compressionMaxTime = reader.ReadInt32();
            m_sourceID = reader.ReadInt32();

            switch (m_generalFlags.DataType)
            {
                case DataType.Analog:
                    m_analogFields = new MetadataRecordAnalogFields(reader);
                    m_digitalFields = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                    m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                    m_constantFields = new MetadataRecordConstantFields();
                    break;
                case DataType.Digital:
                    m_digitalFields = new MetadataRecordDigitalFields(reader);
                    m_analogFields = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                    m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                    m_constantFields = new MetadataRecordConstantFields();
                    break;
                case DataType.Composed:
                    m_composedFields = new MetadataRecordComposedFields(reader);
                    m_analogFields = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                    m_digitalFields = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                    m_constantFields = new MetadataRecordConstantFields();
                    break;
                case DataType.Constant:
                    m_constantFields = new MetadataRecordConstantFields(reader);
                    m_analogFields = new MetadataRecordAnalogFields(MetadataFileLegacyMode.Disabled);
                    m_digitalFields = new MetadataRecordDigitalFields(MetadataFileLegacyMode.Disabled);
                    m_composedFields = new MetadataRecordComposedFields(MetadataFileLegacyMode.Disabled);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataRecord"/> class.
 /// </summary>
 /// <param name="historianID">Historian identifier of <see cref="MetadataRecord"/>.</param>
 /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
 public MetadataRecord(int historianID, MetadataFileLegacyMode legacyMode)
 {
     m_historianID = historianID;
     m_remarks = string.Empty;
     m_hardwareInfo = string.Empty;
     m_emailAddresses = string.Empty;
     m_description = string.Empty;
     m_currentData = string.Empty;
     m_name = string.Empty;
     m_synonym1 = string.Empty;
     m_synonym2 = string.Empty;
     m_synonym3 = string.Empty;
     m_pagerNumbers = string.Empty;
     m_phoneNumbers = string.Empty;
     m_plantCode = string.Empty;
     m_system = string.Empty;
     m_emailTime = string.Empty;
     m_securityFlags = new MetadataRecordSecurityFlags();
     m_generalFlags = new MetadataRecordGeneralFlags();
     m_alarmFlags = new MetadataRecordAlarmFlags();
     m_analogFields = new MetadataRecordAnalogFields(legacyMode);
     m_digitalFields = new MetadataRecordDigitalFields(legacyMode);
     m_composedFields = new MetadataRecordComposedFields(legacyMode);
     m_constantFields = new MetadataRecordConstantFields();
     m_legacyMode = legacyMode;
 }