public DOMap(string domName, List <KeyValuePair <string, string> > domData, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); //First set the root element value... try { domnType = (domType)Enum.Parse(typeof(domType), domName); } catch (System.ArgumentException) { } //Parse n store values... if (domData != null && domData.Count > 0) { foreach (KeyValuePair <string, string> domkp in domData) { try { if (this.GetType().GetProperty(domkp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(domkp.Key).SetValue(this, domkp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", domkp.Key, domkp.Value); } } } }
public DNPSA(string aiName, List <KeyValuePair <string, string> > aiData, TreeNode tn, SlaveTypes sType, int sNo) { string strRoutineName = "DNPSA"; try { User.btnAddClick += new System.EventHandler(this.btnAdd_Click); User.btnDeleteClick += new System.EventHandler(this.btnDelete_Click); User.btnDoneClick += new System.EventHandler(this.btnDone_Click); User.btnCancelClick += new System.EventHandler(this.btnCancel_Click); User.lvUserListItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvUserList_ItemCheck); User.lvUserListDoubleClick += new System.EventHandler(this.lvUserList_DoubleClick); User.btnFirstClick += new System.EventHandler(this.btnFirst_Click); User.btnPrevClick += new System.EventHandler(this.btnPrev_Click); User.btnNextClick += new System.EventHandler(this.btnNext_Click); User.btnLastClick += new System.EventHandler(this.btnLast_Click); addListHeaders(); SetSupportedHMCAlgo(); SetAuthErrorEvent(); slaveType = sType; slaveNo = sNo; try { // ainType = (DNP3SA)Enum.Parse(typeof(DNP3SA), aiName); } catch (System.ArgumentException) { } if (aiData != null && aiData.Count > 0) //Parse n store values... { foreach (KeyValuePair <string, string> aikp in aiData) { try { if (this.GetType().GetProperty(aikp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(aikp.Key).SetValue(this, aikp.Value); } } catch (System.NullReferenceException) { } } } if (tn != null) { tn.Nodes.Clear(); } UserConfigSlaveTreeNode = tn; if (tn != null) { tn.Text = "UserConf " + "User"; } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DNPSA(XmlNode aiNode, SlaveTypes sType, int sNo, bool imported, TreeNode tn) { string strRoutineName = "DNPSA"; try { User.btnAddClick += new System.EventHandler(this.btnAdd_Click); User.btnDeleteClick += new System.EventHandler(this.btnDelete_Click); User.btnDoneClick += new System.EventHandler(this.btnDone_Click); User.btnCancelClick += new System.EventHandler(this.btnCancel_Click); User.lvUserListItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvUserList_ItemCheck); User.lvUserListDoubleClick += new System.EventHandler(this.lvUserList_DoubleClick); User.btnFirstClick += new System.EventHandler(this.btnFirst_Click); User.btnPrevClick += new System.EventHandler(this.btnPrev_Click); User.btnNextClick += new System.EventHandler(this.btnNext_Click); User.btnLastClick += new System.EventHandler(this.btnLast_Click); addListHeaders(); SetSupportedHMCAlgo(); SetAuthErrorEvent(); slaveType = sType; slaveNo = sNo; if (aiNode.Attributes != null) { try { ainType = (DNP3SA)Enum.Parse(typeof(DNP3SA), aiNode.Name); } catch (System.ArgumentException) { } foreach (XmlAttribute item in aiNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } if (tn != null) { tn.Nodes.Clear(); } UserConfigSlaveTreeNode = tn; if (tn != null) { tn.Text = "UserConf " + "User"; } parseIECGNode(aiNode, tn); } } catch (Exception Ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + Ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getHMACAlgo(SlaveTypes masterType) { if (masterType == SlaveTypes.DNP3SLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("HMAC_Algorithm")); } else { return(new List <string>()); } }
public static List <string> getEventsClasses(SlaveTypes slaveType) { if (slaveType == SlaveTypes.DNP3SLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("EventsClasses")); } else { return(new List <string>()); } }
public AOMap(XmlNode aimNode, SlaveTypes sType) { string strRoutineName = "AOMap"; try { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "aimNode name: '{0}'", aimNode.Name); if (aimNode.Attributes != null) { //First set the root element value... try { aimnType = (aomType)Enum.Parse(typeof(aomType), aimNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aimNode.Name); } foreach (XmlAttribute item in aimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (aimNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aimNode.Value; } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getCommandTypes(SlaveTypes slaveType) { //Only MODBUSlave supports this... if (slaveType == SlaveTypes.MODBUSSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUSSlave_AO_CommandType")); } else { return(new List <string>()); } }
public AOMap(string aimName, List <KeyValuePair <string, string> > aimData, SlaveTypes sType) { string strRoutineName = "AOMap"; try { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); //First set the root element value... try { aimnType = (aomType)Enum.Parse(typeof(aomType), aimName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aimName); } //Parse n store values... if (aimData != null && aimData.Count > 0) { foreach (KeyValuePair <string, string> aimkp in aimData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", aimkp.Key, aimkp.Value); try { if (this.GetType().GetProperty(aimkp.Key) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(aimkp.Key).SetValue(this, aimkp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", aimkp.Key, aimkp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ENMap(XmlNode enmNode, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "enmNode name: '{0}'", enmNode.Name); if (enmNode.Attributes != null) { //First set the root element value... try { enmnType = (enmType)Enum.Parse(typeof(enmType), enmNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", enmNode.Name); } foreach (XmlAttribute item in enmNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (enmNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = enmNode.Value; } }
public AOMap(XmlNode aimNode, SlaveTypes sType) { string strRoutineName = "AOMap"; try { slaveType = sType; SetSupportedAttributes(); //IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); if (aimNode.Attributes != null) { //First set the root element value... try { aimnType = (aomType)Enum.Parse(typeof(aomType), aimNode.Name); } catch (System.ArgumentException) { } foreach (XmlAttribute item in aimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } else if (aimNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aimNode.Value; } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DNP3UnsolResponse(SlaveTypes slType, int sNo) { string strRoutineName = "DNP3UnsolResponse"; try { sType = slType; slaveno = sNo; ucUR.btnAddClick += new System.EventHandler(this.btnAdd_Click); ucUR.btnDeleteClick += new System.EventHandler(this.btnDelete_Click); ucUR.btnDoneClick += new System.EventHandler(this.btnDone_Click); ucUR.btnCancelClick += new System.EventHandler(this.btnCancel_Click); ucUR.lvUnsolicitedListItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvUnsolicitedList_ItemCheck); ucUR.lvUnsolicitedListDoubleClick += new System.EventHandler(this.lvUnsolicitedList_DoubleClick); addListHeaders(); //fillOptions(); } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getDataTypes(SlaveTypes slaveType) { if (slaveType == SlaveTypes.IEC104) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC104_DI_DataType")); } else if (slaveType == SlaveTypes.MODBUSSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUSSlave_DI_DataType")); } else if (slaveType == SlaveTypes.IEC61850Server) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850Slave_DI_DataType")); } //Namrata:7/7/2017 else if (slaveType == SlaveTypes.IEC101SLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101Slave_DI_DataType")); } else if (slaveType == SlaveTypes.SPORTSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("SportSlave_DI_DataType")); } //Namrata:02/04/2019 else if (slaveType == SlaveTypes.MQTTSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MQTTSlave_DI_DataType")); } //Namrata: 30/05/2019 else if (slaveType == SlaveTypes.SMSSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("SMSSlave_DI_DataType")); } else { return(new List <string>()); } }
public AIMap(string aimName, List <KeyValuePair <string, string> > aimData, SlaveTypes sType) { string strRoutineName = "AIMap"; try { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); try { aimnType = (aimType)Enum.Parse(typeof(aimType), aimName); } catch (System.ArgumentException) { } if (aimData != null && aimData.Count > 0) //Parse n store values... { foreach (KeyValuePair <string, string> aimkp in aimData) { try { if (this.GetType().GetProperty(aimkp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(aimkp.Key).SetValue(this, aimkp.Value); } } catch (System.NullReferenceException) { } } } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public UnsolResponse(string aiName, List <KeyValuePair <string, string> > aiData, TreeNode tn, SlaveTypes sType, int sNo) { string strRoutineName = "UnsolResponse"; try { slaveType = sType; slaveNo = sNo; try { ainType = (UR)Enum.Parse(typeof(UR), aiName); } catch (System.ArgumentException) { } if (aiData != null && aiData.Count > 0) //Parse n store values... { foreach (KeyValuePair <string, string> aikp in aiData) { try { if (this.GetType().GetProperty(aikp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(aikp.Key).SetValue(this, aikp.Value); } } catch (System.NullReferenceException) { } } } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public UnsolResponse(XmlNode aiNode, SlaveTypes sType, int sNo, bool imported) { string strRoutineName = "UnsolResponse"; try { slaveType = sType; slaveNo = sNo; if (aiNode.Attributes != null) { try { ainType = (UR)Enum.Parse(typeof(UR), aiNode.Name); } catch (System.ArgumentException) { } foreach (XmlAttribute item in aiNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } } catch (Exception Ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + Ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DNP3DNPSA(SlaveTypes slType, int sNo) { string strRoutineName = "DNP3DNPSA"; try { DNP3SlaveTreeNode1.Text = "DNPSA"; DNP3SlaveTreeNode = DNP3SlaveTreeNode1; sType = slType; slaveno = sNo; ucDNPSA.btnAddClick += new System.EventHandler(this.btnAdd_Click); ucDNPSA.btnDeleteClick += new System.EventHandler(this.btnDelete_Click); ucDNPSA.btnDoneClick += new System.EventHandler(this.btnDone_Click); ucDNPSA.btnCancelClick += new System.EventHandler(this.btnCancel_Click); ucDNPSA.lvDNPSAListItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvDNPSAList_ItemCheck); ucDNPSA.lvDNPSAListDoubleClick += new System.EventHandler(this.lvDNPSAList_DoubleClick); addListHeaders(); fillOptions(); } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ENMap(string enmName, List <KeyValuePair <string, string> > enmData, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); //First set the root element value... try { enmnType = (enmType)Enum.Parse(typeof(enmType), enmName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", enmName); } //Parse n store values... if (enmData != null && enmData.Count > 0) { foreach (KeyValuePair <string, string> enmkp in enmData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", enmkp.Key, enmkp.Value); try { if (this.GetType().GetProperty(enmkp.Key) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(enmkp.Key).SetValue(this, enmkp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", enmkp.Key, enmkp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } }
public DNP3DNPSA(TreeNode tn, SlaveTypes slType, int sNo) { string strRoutineName = "DNP3DNPSA:DNP3DNPSA"; try { tn.Nodes.Clear(); DNP3SlaveTreeNode = tn;//Save local copy so we can use it to manually add nodes in above constructor... sType = slType; slaveno = sNo; ucDNPSA.btnAddClick += new System.EventHandler(this.btnAdd_Click); ucDNPSA.btnDeleteClick += new System.EventHandler(this.btnDelete_Click); ucDNPSA.btnDoneClick += new System.EventHandler(this.btnDone_Click); ucDNPSA.btnCancelClick += new System.EventHandler(this.btnCancel_Click); ucDNPSA.lvDNPSAListItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvDNPSAList_ItemCheck); ucDNPSA.lvDNPSAListDoubleClick += new System.EventHandler(this.lvDNPSAList_DoubleClick); addListHeaders(); fillOptions(); } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static List <string> getDataTypes(SlaveTypes slaveType) { if (slaveType == SlaveTypes.IEC104) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC104_EN_DataType")); } else if (slaveType == SlaveTypes.MODBUSSLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("MODBUSSlave_EN_DataType")); } else if (slaveType == SlaveTypes.IEC61850Server) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC61850Slave_EN_DataType")); } //Namrata:7/7/2017 else if (slaveType == SlaveTypes.IEC101SLAVE) { return(Utils.getOpenProPlusHandle().getDataTypeValues("IEC101Slave_EN_DataType")); } else { return(new List <string>()); } }
public DOMap(XmlNode domNode, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); if (domNode.Attributes != null) { //First set the root element value... try { domnType = (domType)Enum.Parse(typeof(domType), domNode.Name); } catch (System.ArgumentException) { } if ((slaveType == SlaveTypes.GRAPHICALDISPLAYSLAVE) || (slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN) || (slaveType == SlaveTypes.SPORTSLAVE) || (slaveType == SlaveTypes.MQTTSLAVE) || (slaveType == SlaveTypes.SMSSLAVE) || (slaveType == SlaveTypes.DNP3SLAVE)) { foreach (XmlAttribute item in domNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } //Namrata: 07/11/2017 // If slaveType Type is IEC61850Server if (slaveType == SlaveTypes.IEC61850Server) { if (domNode.Name == "DO") { foreach (XmlAttribute xmlattribute in domNode.Attributes) { try { if (xmlattribute.Name == "ReportingIndex") { iec61850reportingindex = domNode.Attributes[1].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { } } } } } else if (domNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = domNode.Value; } }
public DIMap(XmlNode dimNode, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "dimNode name: '{0}'", dimNode.Name); if (dimNode.Attributes != null) { //First set the root element value... try { dimnType = (dimType)Enum.Parse(typeof(dimType), dimNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", dimNode.Name); } if ((slaveType == SlaveTypes.DNP3SLAVE) || (slaveType == SlaveTypes.GRAPHICALDISPLAYSLAVE) || (slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.SPORTSLAVE) || (slaveType == SlaveTypes.MQTTSLAVE) || (slaveType == SlaveTypes.SMSSLAVE)) //Ajay: 10/08/2018 SPORTSLAVE added to condition. SPORT mapping not showing by Aditya K mail dtd. 09/08/2018 { foreach (XmlAttribute item in dimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DIMap: Field doesn't exist. XML and class fields mismatch!!! Key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 07/11/2017 // If slaveType Type is IEC61850Server if (slaveType == SlaveTypes.IEC61850Server) { if (dimNode.Name == "DI") { foreach (XmlAttribute xmlattribute in dimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ReportingIndex") { iec61850reportingindex = dimNode.Attributes[1].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (dimNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = dimNode.Value; } }
public DNP3Settings(string iedName, List <KeyValuePair <string, string> > iedData, TreeNode tn, SlaveTypes sType, int sNo) { string strRoutineName = "DNP3Settings"; try { slaveType = sType; slaveNum = sNo; SetSupportedAttributes(); if (tn != null) { DNP3TreeNode = tn; } addListHeaders(); fillOptions(); try { DType = (DNPType)Enum.Parse(typeof(DNPType), iedName); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", iedName); } if (iedData != null && iedData.Count > 0) { foreach (KeyValuePair <string, string> iedkp in iedData) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", iedkp.Key, iedkp.Value); try { if (this.GetType().GetProperty(iedkp.Key) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(iedkp.Key).SetValue(this, iedkp.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", iedkp.Key, iedkp.Value); } } Utils.Write(VerboseLevel.DEBUG, "\n"); } if (tn != null) { tn.Text = "DNP3Settings " + "DNP3Settings_" + slaveNum; } UnsolResNode = new DNP3UnsolResponse(sType, slaveNum); ObjectVarNode = new DNP3ObjectVariation(sType, slaveNum); EncryptionVarNode = new DNP3Encryption(sType, slaveNum); DNPSAVarNode = new DNP3DNPSA(sType, slaveNum); DNPSAVarNode = new DNP3DNPSA(tn, sType, slaveNum); //DNPSAUserNode = new DNP3User(); if (tn != null) { tn.Nodes.Add("UnsolicitedResponse", "Unsolicited Response", "UnsolicitedResponse", "UnsolicitedResponse"); } UnsolResNode.parseURNode(null, false); if (tn != null) { tn.Nodes.Add("ObjectVariation", "Object Variation", "ObjectVariation", "ObjectVariation"); } ObjectVarNode.parseOVNode(null, false); if (tn != null) { tn.Nodes.Add("Encryption", "Encryption", "Encryption", "Encryption"); } EncryptionVarNode.parseOVNode(null, false); if (tn != null) { tn.Nodes.Add("DNPSA", "DNPSA", "DNPSA", "DNPSA"); } //tn.Nodes[3].Nodes.Add("USERCONFUser", "USERCONF User", "USERCONFUser", "USERCONFUser"); DNPSAVarNode.parseOVNode(null, tn); refreshList(); //ucied.lblIED.Text = "IED Details (Unit: " + unitID.ToString() + ")"; } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DOMap(XmlNode domNode, SlaveTypes sType) { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); //Parse n store values... Utils.WriteLine(VerboseLevel.DEBUG, "domNode name: '{0}'", domNode.Name); if (domNode.Attributes != null) { //First set the root element value... try { domnType = (domType)Enum.Parse(typeof(domType), domNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", domNode.Name); } if ((slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN)) { foreach (XmlAttribute item in domNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 07/11/2017 // If slaveType Type is IEC61850Server if (slaveType == SlaveTypes.IEC61850Server) { if (domNode.Name == "DO") { foreach (XmlAttribute xmlattribute in domNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ReportingIndex") { iec61850reportingindex = domNode.Attributes[1].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (domNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = domNode.Value; } }
public AIMap(XmlNode aimNode, SlaveTypes sType) { string strRoutineName = "AIMap"; try { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); SetSupportedEventClass(); SetSupportedEventVariation(); SetSupportedVariation(); if (aimNode.Attributes != null) { //First set the root element value... try { aimnType = (aimType)Enum.Parse(typeof(aimType), aimNode.Name); } catch (System.ArgumentException) { } //Namrata: 07/11/2017 if ((slaveType == SlaveTypes.DNP3SLAVE) || (slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN) || (slaveType == SlaveTypes.SPORTSLAVE) || (slaveType == SlaveTypes.SMSSLAVE) || (slaveType == SlaveTypes.MQTTSLAVE)) { foreach (XmlAttribute item in aimNode.Attributes) { try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { } } } if (slaveType == SlaveTypes.GRAPHICALDISPLAYSLAVE) { if (aimNode.Name == "AI") { foreach (XmlAttribute xmlattribute in aimNode.Attributes) { try { if (xmlattribute.Name == "Unit") { unitID = aimNode.Attributes[3].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { } } } } //Namrata: 07/11/2017 #region If slaveType Type is IEC61850Server if (slaveType == SlaveTypes.IEC61850Server) { if (aimNode.Name == "AI") { foreach (XmlAttribute xmlattribute in aimNode.Attributes) { try { if (xmlattribute.Name == "ReportingIndex") { iec61850reportingindex = aimNode.Attributes[1].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { } } } } #endregion If slaveType Type is IEC61850Server } else if (aimNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aimNode.Value; } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public DNP3Settings(XmlNode iNode, TreeNode tn, SlaveTypes sType, int sNo, bool imported) { string strRoutineName = "DNP3Settings"; try { slaveType = sType; slaveNum = sNo; SetSupportedAttributes(); if (tn != null) { DNP3TreeNode = tn; } addListHeaders(); fillOptions(); try { DType = (DNPType)Enum.Parse(typeof(DNPType), iNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", iNode.Name); } foreach (XmlAttribute item in iNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 03/07/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } // if (tn != null) tn.Text = "DNPSettings " + this.Description; if (tn != null) { tn.Text = "DNP3Settings " + "DNP3Settings_" + slaveNum; } UnsolResNode = new DNP3UnsolResponse(sType, slaveNum); ObjectVarNode = new DNP3ObjectVariation(sType, slaveNum); EncryptionVarNode = new DNP3Encryption(sType, slaveNum); DNPSAVarNode = new DNP3DNPSA(sType, slaveNum); if (tn != null) { tn.Nodes.Add("UnsolicitedResponse", "Unsolicited Response", "UnsolicitedResponse", "UnsolicitedResponse"); } //UnsolResNode.parseURNode(iNode.ChildNodes[0], false); UnsolResNode.parseURNode(iNode, false); if (tn != null) { tn.Nodes.Add("ObjectVariation", "Object Variation", "ObjectVariation", "ObjectVariation"); } //ObjectVarNode.parseOVNode(iNode.ChildNodes[0], false); ObjectVarNode.parseOVNode(iNode, false); if (tn != null) { tn.Nodes.Add("Encryption", "Encryption", "Encryption", "Encryption"); } //EncryptionVarNode.parseOVNode(iNode.ChildNodes[0], false); EncryptionVarNode.parseOVNode(iNode, false); if (tn != null) { tn.Nodes.Add("DNPSA", "DNPSA", "DNPSA", "DNPSA"); } //tn.Nodes[3].Nodes.Add("USERCONFUser", "USERCONF User", "USERCONFUser", "USERCONFUser"); DNPSAVarNode.parseOVNode(iNode, tn); //DNPSAVarNode.parseOVNode(iNode, tn); refreshList(); //ucied.lblIED.Text = "IED Details (Unit: " + unitID.ToString() + ")"; } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public AIMap(XmlNode aimNode, SlaveTypes sType) { string strRoutineName = "AIMap"; try { slaveType = sType; SetSupportedAttributes();//IMP: Call only after slave types are set... SetSupportedDataTypes(); SetSupportedCommandTypes(); Utils.WriteLine(VerboseLevel.DEBUG, "aimNode name: '{0}'", aimNode.Name); //Parse n store values... if (aimNode.Attributes != null) { //First set the root element value... try { aimnType = (aimType)Enum.Parse(typeof(aimType), aimNode.Name); } catch (System.ArgumentException) { Utils.WriteLine(VerboseLevel.WARNING, "Enum argument {0} not supported!!!", aimNode.Name); } //Namrata: 07/11/2017 if ((slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN)) { foreach (XmlAttribute item in aimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", item.Name, item.Value); try { if (this.GetType().GetProperty(item.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(item.Name).SetValue(this, item.Value); } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", item.Name, item.Value); } } } //Namrata: 07/11/2017 // If slaveType Type is IEC61850Server if (slaveType == SlaveTypes.IEC61850Server) { if (aimNode.Name == "AI") { foreach (XmlAttribute xmlattribute in aimNode.Attributes) { Utils.Write(VerboseLevel.DEBUG, "{0} {1} ", xmlattribute.Name, xmlattribute.Value); try { if (xmlattribute.Name == "ReportingIndex") { iec61850reportingindex = aimNode.Attributes[1].Value; } else { if (this.GetType().GetProperty(xmlattribute.Name) != null) //Ajay: 10/08/2018 { this.GetType().GetProperty(xmlattribute.Name).SetValue(this, xmlattribute.Value); } } } catch (System.NullReferenceException) { Utils.WriteLine(VerboseLevel.WARNING, "DI: Field doesn't exist. XML and class fields mismatch!!! key: {0} value: {1}", xmlattribute.Name, xmlattribute.Value); } } } } Utils.Write(VerboseLevel.DEBUG, "\n"); } else if (aimNode.NodeType == XmlNodeType.Comment) { isNodeComment = true; comment = aimNode.Value; } } catch (Exception ex) { MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }