public bool Equals(NarrationInformation other)
 {
     if (other == null)
     {
         return(false);
     }
     return(ViewIndex.Equals(other.ViewIndex) &&
            MessageIndex.Equals(other.MessageIndex) &&
            SubIndex.Equals(other.SubIndex));
 }
Ejemplo n.º 2
0
        public async Task ImportIndexesData(string filePath)
        {
            var lines = await File.ReadAllLinesAsync(filePath);

            var headerRowsCount = 2;

            lines = lines.Skip(headerRowsCount).ToArray();

            SubIndex  currentSubIndex  = null;
            Indicator currentIndicator = null;

            foreach (var line in lines)
            {
                var spl = line.Split(new char[] { '\t' });

                if (spl.Where(X => X.Length == 0).Count() > 5 && spl[0].Length > 0)
                {
                    Log.Debug("------------ Create subindex: {newIndexName}", spl[0]);
                    currentSubIndex = new SubIndex {
                        Name = spl[0]
                    };
                    await this._subIndexService.AddAndAssignId(currentSubIndex);

                    continue;
                }

                if (!string.IsNullOrEmpty(spl[1]))
                {
                    Log.Debug("----- Create indicator: {newIndicatorName}", spl[1]);
                    currentIndicator = new Indicator
                    {
                        Number = int.Parse(spl[0]),
                        Name   = spl[1],
                        CalculationDescription = spl[4],
                        SubIndexId             = currentSubIndex.SubIndexId
                    };
                    await this._indicatorService.AddAndAssignId(currentIndicator);
                }

                Log.Debug("Create indicator index: {indicatorIndexName}", spl[10]);
                var indicatorIndex = new IndicatorIndex
                {
                    IndicatorId = currentIndicator.IndicatorId,
                    Name        = spl[10],
                    Description = spl[14],
                    Number      = spl[9],
                    Type        = spl[11]
                };
                await this._indicatorIndexService.Add(indicatorIndex);
            }
        }
Ejemplo n.º 3
0
 public bool HasSubIndexOfType(MathListSubIndexType subIndexType)
 {
     if (SubIndexType == subIndexType)
     {
         return(true);
     }
     else if (SubIndex != null)
     {
         return(SubIndex.HasSubIndexOfType(subIndexType));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool EqualsToIndex(MathListIndex index)
 {
     if (index is null)
     {
         return(false);
     }
     if (AtomIndex != index.AtomIndex || SubIndexType != index.SubIndexType)
     {
         return(false);
     }
     if (SubIndex != null && index.SubIndex != null)
     {
         return(SubIndex.EqualsToIndex(index.SubIndex));
     }
     else
     {
         return(index.SubIndex == null);
     }
 }
Ejemplo n.º 5
0
 public bool AtSameLevel(MathListIndex other)
 {
     if (SubIndexType != other.SubIndexType)
     {
         return(false);
     }
     else if (SubIndexType == MathListSubIndexType.None)
     {
         // No subindexes, they are at the same level.
         return(true);
     }
     else if (AtomIndex != other.AtomIndex)
     {
         // the subindexes are used in different atoms
         return(false);
     }
     else if (SubIndex != null && other.SubIndex != null)
     {
         return(SubIndex.AtSameLevel(other.SubIndex));
     }
     // No subindexes, they are at the same level.
     return(true);
 }
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(donType.ToString());
            xmlDoc.AppendChild(rootNode);

            if (masterType == MasterTypes.IEC61850Client)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }

                XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType");
                attr1.Value = Iec61850DOResponseType.ToString();
                rootNode.Attributes.Append(attr1);

                XmlAttribute attr2 = xmlDoc.CreateAttribute("Index");
                attr2.Value = Iec61850DOIndex.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attrfc = xmlDoc.CreateAttribute("FC");
                attrfc.Value = FC.ToString();
                rootNode.Attributes.Append(attrfc);

                XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex");
                attr3.Value = SubIndex.ToString();
                rootNode.Attributes.Append(attr3);

                XmlAttribute attr4 = xmlDoc.CreateAttribute("ControlType");
                attr4.Value = ControlType.ToString();
                rootNode.Attributes.Append(attr4);

                XmlAttribute attr7 = xmlDoc.CreateAttribute("PulseDurationMS");
                attr7.Value = PulseDurationMS.ToString();
                rootNode.Attributes.Append(attr7);

                XmlAttribute attr9 = xmlDoc.CreateAttribute("EnableDI");
                attr9.Value = EnableDI.ToString();
                rootNode.Attributes.Append(attr9);

                XmlAttribute attr8 = xmlDoc.CreateAttribute("Description");
                attr8.Value = Description.ToString();
                rootNode.Attributes.Append(attr8);
            }
            else
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    if (attrName.Name == "EnableDI")
                    {
                        if (attrName.Value == "")
                        {
                            attrName.Value = "0";
                        }
                    }
                    rootNode.Attributes.Append(attrName);
                }
            }
            return(rootNode);
        }
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(ainType.ToString());

            #region MasterType IEC61850
            if (masterType == MasterTypes.IEC61850Client)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType");
                attr1.Value = Iec61850ResponseType.ToString();
                rootNode.Attributes.Append(attr1);

                XmlAttribute attr2 = xmlDoc.CreateAttribute("Index");
                attr2.Value = Iec61850Index.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attFC = xmlDoc.CreateAttribute("FC");
                attFC.Value = FC.ToString();
                rootNode.Attributes.Append(attFC);

                XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex");
                attr3.Value = SubIndex.ToString();
                rootNode.Attributes.Append(attr3);

                //XmlAttribute attr4 = xmlDoc.CreateAttribute("DataType");
                //attr4.Value = DataType.ToString();
                //rootNode.Attributes.Append(attr4);

                XmlAttribute attr5 = xmlDoc.CreateAttribute("Multiplier");
                attr5.Value = Multiplier.ToString();
                rootNode.Attributes.Append(attr5);

                XmlAttribute attr6 = xmlDoc.CreateAttribute("Constant");
                attr6.Value = Constant.ToString();
                rootNode.Attributes.Append(attr6);

                XmlAttribute attr7 = xmlDoc.CreateAttribute("Description");
                attr7.Value = Description.ToString();
                rootNode.Attributes.Append(attr7);
            }
            #endregion MasterType IEC61850

            #region MasterType IEC103,ADR,IEC101,MODBUS,Virtual
            if ((masterType == MasterTypes.IEC103) || (masterType == MasterTypes.ADR) || (masterType == MasterTypes.IEC101) || (masterType == MasterTypes.MODBUS) || (masterType == MasterTypes.Virtual))
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            #endregion MasterType IEC103,ADR,IEC101,MODBUS,Virtual

            return(rootNode);
        }
Ejemplo n.º 8
0
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(dinType.ToString());
            xmlDoc.AppendChild(rootNode);
            if (masterType == MasterTypes.IEC61850Client)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType");
                attr1.Value = Iec61850DIResponseType.ToString();
                rootNode.Attributes.Append(attr1);

                XmlAttribute attr2 = xmlDoc.CreateAttribute("Index");
                attr2.Value = Iec61850DIIndex.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attrfc = xmlDoc.CreateAttribute("FC");
                attrfc.Value = FC.ToString();
                rootNode.Attributes.Append(attrfc);

                XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex");
                attr3.Value = SubIndex.ToString();
                rootNode.Attributes.Append(attr3);

                XmlAttribute attr7 = xmlDoc.CreateAttribute("Description");
                attr7.Value = Description.ToString();
                rootNode.Attributes.Append(attr7);
            }

            else
            {
                //Namrata: 17/7/2017
                //Create New Element in XML
                XmlNode Data = xmlDoc.CreateNode(XmlNodeType.Element, "Event", null);
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                //Namrata: 17/7/2017
                if (masterType == MasterTypes.ADR)
                {
                    foreach (string attr1 in arrAttributesEvents)
                    {
                        XmlAttribute attrName = xmlDoc.CreateAttribute(attr1);
                        Data.Attributes.Append(attrName);
                        attrName.Value = (string)this.GetType().GetProperty(attr1).GetValue(this);
                        rootNode.AppendChild(Data);
                    }
                }
            }
            return(rootNode);
        }
Ejemplo n.º 9
0
 public override int GetHashCode() =>
 unchecked ((AtomIndex * 31 + (int)SubIndexType) * 31 + SubIndex.GetHashCode());
 /// <summary>Get the hashcode of the Value.</summary>
 public override int GetHashCode()
 {
     return(ViewIndex.GetHashCode()
            ^ MessageIndex.GetHashCode()
            ^ SubIndex.GetHashCode());
 }
Ejemplo n.º 11
0
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(ainType.ToString());

            //Ajay: 01/11/2018 Commented - added attributes directly in arrAttributes Array
            #region MasterType IEC61850
            if (masterType == MasterTypes.IEC61850Client)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType");
                attr1.Value = Iec61850ResponseType.ToString();
                rootNode.Attributes.Append(attr1);

                XmlAttribute attr2 = xmlDoc.CreateAttribute("Index");
                attr2.Value = Iec61850Index.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attFC = xmlDoc.CreateAttribute("FC");
                attFC.Value = FC.ToString();
                rootNode.Attributes.Append(attFC);

                XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex");
                attr3.Value = SubIndex.ToString();
                rootNode.Attributes.Append(attr3);

                XmlAttribute attr5 = xmlDoc.CreateAttribute("Multiplier");
                attr5.Value = Multiplier.ToString();
                rootNode.Attributes.Append(attr5);

                XmlAttribute attr6 = xmlDoc.CreateAttribute("Constant");
                attr6.Value = Constant.ToString();
                rootNode.Attributes.Append(attr6);

                //Ajay: 01/11/2018 EventEnable added
                XmlAttribute attr7 = xmlDoc.CreateAttribute("EventEnable");
                attr7.Value = EventEnable.ToString();
                rootNode.Attributes.Append(attr7);

                XmlAttribute attr8 = xmlDoc.CreateAttribute("Description");
                attr8.Value = Description.ToString();
                rootNode.Attributes.Append(attr8);
            }
            #endregion MasterType IEC61850

            #region MasterType IEC103,ADR,IEC101,MODBUS,Virtual, LoadProfile
            if ((masterType == MasterTypes.IEC103) || (masterType == MasterTypes.ADR) || (masterType == MasterTypes.IEC104) ||
                (masterType == MasterTypes.IEC101) || (masterType == MasterTypes.MODBUS) || (masterType == MasterTypes.Virtual) ||
                (masterType == MasterTypes.SPORT) || (masterType == MasterTypes.LoadProfile)) //Ajay: 31/07/2018 LoadProfile Added
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            #endregion

            return(rootNode);
        }