Exemplo n.º 1
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)
        {
            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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens the file.
        /// </summary>
        public override void Open()
        {
            // Handle special cases for readers
            if (!PersistSettings || FileAccessMode == FileAccess.Read)
            {
                // Need to fall back on using old file format if a new one doesn't exist for historical reads
                if (!File.Exists(FileName) && !string.IsNullOrEmpty(m_baseFileName) && File.Exists(m_baseFileName))
                {
                    base.FileName = m_baseFileName;
                }

                // Use new file format if a newer one exists
                if (m_legacyMode != MetadataFileLegacyMode.Enabled && !FileName.EndsWith("2") && File.Exists(FileName + "2"))
                {
                    FileName += "2";
                }

                // Fall back on legacy mode if needed
                if (!FileName.EndsWith("2") && File.Exists(FileName))
                {
                    m_legacyMode = MetadataFileLegacyMode.Enabled;
                }
            }

            base.Open();
        }
Exemplo n.º 3
0
 internal MetadataRecordDigitalFields(BinaryReader reader)
 {
     m_legacyMode       = MetadataFileLegacyMode.Disabled;
     m_setDescription   = reader.ReadString();
     m_clearDescription = reader.ReadString();
     m_alarmState       = reader.ReadInt32();
     m_alarmDelay       = reader.ReadSingle();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataRecordComposedFields"/> class.
        /// </summary>
        /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
        internal MetadataRecordComposedFields(MetadataFileLegacyMode legacyMode)
        {
            m_engineeringUnits = string.Empty;
            m_equation         = string.Empty;
            m_inputPointers    = new List <int>();

            for (int i = 0; i < 12; i++)
            {
                m_inputPointers.Add(default(int));
            }

            m_legacyMode = legacyMode;
        }
Exemplo n.º 5
0
 internal MetadataRecordAnalogFields(BinaryReader reader)
 {
     m_legacyMode       = MetadataFileLegacyMode.Disabled;
     m_engineeringUnits = reader.ReadString();
     m_highAlarm        = reader.ReadSingle();
     m_lowAlarm         = reader.ReadSingle();
     m_highRange        = reader.ReadSingle();
     m_lowRange         = reader.ReadSingle();
     m_highWarning      = reader.ReadSingle();
     m_lowWarning       = reader.ReadSingle();
     m_exceptionLimit   = reader.ReadSingle();
     m_compressionLimit = reader.ReadSingle();
     m_alarmDelay       = reader.ReadSingle();
     m_displayDigits    = reader.ReadInt32();
 }
Exemplo n.º 6
0
        internal MetadataRecordComposedFields(BinaryReader reader)
        {
            m_legacyMode    = MetadataFileLegacyMode.Disabled;
            m_highAlarm     = reader.ReadSingle();
            m_lowAlarm      = reader.ReadSingle();
            m_highRange     = reader.ReadSingle();
            m_lowRange      = reader.ReadSingle();
            m_lowWarning    = reader.ReadSingle();
            m_highWarning   = reader.ReadSingle();
            m_displayDigits = reader.ReadInt32();
            m_inputPointers = new List <int>();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                m_inputPointers.Add(reader.ReadInt32());
            }

            m_engineeringUnits = reader.ReadString();
            m_equation         = reader.ReadString();
            m_compressionLimit = reader.ReadSingle();
        }
Exemplo n.º 7
0
        internal MetadataRecordComposedFields(BinaryReader reader)
        {
            m_legacyMode = MetadataFileLegacyMode.Disabled;
            m_highAlarm = reader.ReadSingle();
            m_lowAlarm = reader.ReadSingle();
            m_highRange = reader.ReadSingle();
            m_lowRange = reader.ReadSingle();
            m_lowWarning = reader.ReadSingle();
            m_highWarning = reader.ReadSingle();
            m_displayDigits = reader.ReadInt32();
            m_inputPointers = new List<int>();

            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                m_inputPointers.Add(reader.ReadInt32());
            }

            m_engineeringUnits = reader.ReadString();
            m_equation = reader.ReadString();
            m_compressionLimit = reader.ReadSingle();
        }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataRecordAnalogFields"/> class.
 /// </summary>
 /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
 internal MetadataRecordAnalogFields(MetadataFileLegacyMode legacyMode)
 {
     m_engineeringUnits = string.Empty;
     m_legacyMode       = legacyMode;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataRecordAnalogFields"/> class.
 /// </summary>
 /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
 internal MetadataRecordAnalogFields(MetadataFileLegacyMode legacyMode)
 {
     m_engineeringUnits = string.Empty;
     m_legacyMode = legacyMode;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataFile"/> class.
 /// </summary>
 public MetadataFile()
 {
     SettingsCategory = this.GetType().Name;
     m_legacyMode     = MetadataFileLegacyMode.Disabled; // Default to only using new file format
     m_records        = new Dictionary <int, MetadataRecord>();
 }
Exemplo n.º 11
0
 internal MetadataRecordAnalogFields(BinaryReader reader)
 {
     m_legacyMode = MetadataFileLegacyMode.Disabled;
     m_engineeringUnits = reader.ReadString();
     m_highAlarm = reader.ReadSingle();
     m_lowAlarm = reader.ReadSingle();
     m_highRange = reader.ReadSingle();
     m_lowRange = reader.ReadSingle();
     m_highWarning = reader.ReadSingle();
     m_lowWarning = reader.ReadSingle();
     m_exceptionLimit = reader.ReadSingle();
     m_compressionLimit = reader.ReadSingle();
     m_alarmDelay = reader.ReadSingle();
     m_displayDigits = reader.ReadInt32();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MetadataRecordComposedFields"/> class.
        /// </summary>
        /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
        internal MetadataRecordComposedFields(MetadataFileLegacyMode legacyMode)
        {
            m_engineeringUnits = string.Empty;
            m_equation = string.Empty;
            m_inputPointers = new List<int>();

            for (int i = 0; i < 12; i++)
            {
                m_inputPointers.Add(default(int));
            }

            m_legacyMode = legacyMode;
        }
Exemplo n.º 13
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;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataRecordDigitalFields"/> class.
 /// </summary>
 /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
 internal MetadataRecordDigitalFields(MetadataFileLegacyMode legacyMode)
 {
     m_setDescription   = string.Empty;
     m_clearDescription = string.Empty;
     m_legacyMode       = legacyMode;
 }
Exemplo n.º 15
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>
 /// <param name="buffer">Binary image to be used for initializing <see cref="MetadataRecord"/>.</param>
 /// <param name="startIndex">0-based starting index of initialization data in the <paramref name="buffer"/>.</param>
 /// <param name="length">Valid number of bytes in <paramref name="buffer"/> from <paramref name="startIndex"/>.</param>
 public MetadataRecord(int historianID, MetadataFileLegacyMode legacyMode, byte[] buffer, int startIndex, int length)
     : this(historianID, legacyMode)
 {
     ParseBinaryImage(buffer, startIndex, length);
 }
Exemplo n.º 16
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>
 /// <param name="buffer">Binary image to be used for initializing <see cref="MetadataRecord"/>.</param>
 /// <param name="startIndex">0-based starting index of initialization data in the <paramref name="buffer"/>.</param>
 /// <param name="length">Valid number of bytes in <paramref name="buffer"/> from <paramref name="startIndex"/>.</param>
 public MetadataRecord(int historianID, MetadataFileLegacyMode legacyMode, byte[] buffer, int startIndex, int length)
     : this(historianID, legacyMode)
 {
     ParseBinaryImage(buffer, startIndex, length);
 }
 internal MetadataRecordDigitalFields(BinaryReader reader)
 {
     m_legacyMode = MetadataFileLegacyMode.Disabled;
     m_setDescription = reader.ReadString();
     m_clearDescription = reader.ReadString();
     m_alarmState = reader.ReadInt32();
     m_alarmDelay = reader.ReadSingle();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MetadataRecordDigitalFields"/> class.
 /// </summary>
 /// <param name="legacyMode">Legacy mode of <see cref="MetadataFile"/>.</param>
 internal MetadataRecordDigitalFields(MetadataFileLegacyMode legacyMode)
 {
     m_setDescription = string.Empty;
     m_clearDescription = string.Empty;
     m_legacyMode = legacyMode;
 }