//****************************************************************************************************** // SerializableMetadata.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 08/07/2009 - Pinal C. Patel // Generated original version of source code. // 09/15/2009 - Stephen C. Wills // Added new header and license agreement. // 11/26/2009 - Pinal C. Patel // Removed Namespace from DataContract serialization. // 12/17/2009 - Pinal C. Patel // Updated the serialization definition for XmlSerializer. // 10/11/2010 - Mihir Brahmbhatt // Updated header and license agreement. // 12/14/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Xml.Serialization; using GSF.Historian.Files; namespace GSF.Historian.DataServices { /// /// Represents a container for s that can be serialized using or . /// /// /// This is the output for serialized using : /// /// /// /// /// /// /// /// ]]> /// /// This is the output for serialized using : /// /// /// /// /// 1 /// 0 /// TVA_CORD-BUS2:ABBV /// 4-PM1 /// VPHM /// /// Cordova ABB-521 500 kV Bus 2 Positive Sequence Voltage Magnitude /// ABB RES521 /// /// P1 /// 1 /// CORD /// 3 /// true /// 0.0333333351 /// 0 /// 0 /// Volts /// 475000 /// 525000 /// 450000 /// 550000 /// 475000 /// 525000 /// 0 /// 0 /// 7 /// /// /// 0 /// 5 /// 0 /// false /// false /// 0 /// 0 /// false /// false /// false /// false /// /// /// /// /// /// /// ]]> /// /// This is the output for serialized using : /// /// { /// "MetadataRecords": /// [{"HistorianID":1, /// "DataType":0, /// "Name":"TVA_CORD-BUS2:ABBV", /// "Synonym1":"4-PM1", /// "Synonym2":"VPHM", /// "Synonym3":"", /// "Description":"Cordova ABB-521 500 kV Bus 2 Positive Sequence Voltage Magnitude", /// "HardwareInfo":"ABB RES521", /// "Remarks":"", /// "PlantCode":"P1", /// "UnitNumber":1, /// "SystemName":"CORD", /// "SourceID":3, /// "Enabled":true, /// "ScanRate":0.0333333351, /// "CompressionMinTime":0, /// "CompressionMaxTime":0, /// "EngineeringUnits":"Volts", /// "LowWarning":475000, /// "HighWarning":525000, /// "LowAlarm":450000, /// "HighAlarm":550000, /// "LowRange":475000, /// "HighRange":525000, /// "CompressionLimit":0, /// "ExceptionLimit":0, /// "DisplayDigits":7, /// "SetDescription":"", /// "ClearDescription":"", /// "AlarmState":0, /// "ChangeSecurity":5, /// "AccessSecurity":0, /// "StepCheck":false, /// "AlarmEnabled":false, /// "AlarmFlags":0, /// "AlarmDelay":0, /// "AlarmToFile":false, /// "AlarmByEmail":false, /// "AlarmByPager":false, /// "AlarmByPhone":false, /// "AlarmEmails":"", /// "AlarmPagers":"", /// "AlarmPhones":""}] /// } /// /// /// /// /// /// /// [XmlType("Metadata"), DataContract(Name = "Metadata", Namespace = "")] public class SerializableMetadata { #region [ Constructors ] /// /// Initializes a new instance of the class. /// public SerializableMetadata() { } /// /// Initializes a new instance of the class. /// /// object from which is to be initialized. /// is null. /// is closed. public SerializableMetadata(MetadataFile metadataFile) : this() { if (metadataFile == null) throw new ArgumentNullException(nameof(metadataFile)); if (!metadataFile.IsOpen) throw new ArgumentException("metadataFile is closed"); // Process all records in the metadata file. List serializableMetadataRecords = new List(); foreach (MetadataRecord metadataRecord in metadataFile.Read()) { serializableMetadataRecords.Add(new SerializableMetadataRecord(metadataRecord)); } MetadataRecords = serializableMetadataRecords.ToArray(); } #endregion #region [ Properties ] /// /// Gets or sets the s contained in the . /// [XmlArray, DataMember] public SerializableMetadataRecord[] MetadataRecords { get; set; } #endregion } }