Example #1
0
        public int getRoll()
        {
            if (this.Multiplier == 0)
            {
                this.logger.writeLog("Constant Found, returning " + this.MaxRoll);
                return(this.MaxRoll);
            }

            Random die    = new Random();
            int    result = 0;
            int    roll   = 0;

            int[] rollresults = new int[Multiplier];

            for (int i = 0; i < Multiplier; i++)
            {
                roll           = die.Next(1, MaxRoll);
                rollresults[i] = roll;
                result        += roll;
            }

            this.logger.logBoth("Rolling " + Multiplier.ToString() + "d" + MaxRoll.ToString() + ": " + result.ToString());
            this.logger.logBoth("Rolls Obtained: [" + string.Join(", ", rollresults) + "] (1d" + MaxRoll.ToString() + ")");
            return(result);
        }
Example #2
0
        /// <summary>
        /// Converts <see cref="AnalogChannel"/> to its string format.
        /// </summary>
        public override string ToString()
        {
            // An,ch_id,ph,ccbm,uu,a,b,skew,min,max
            List <string> values = new List <string>
            {
                Index.ToString(),
                          Name,
                          PhaseID,
                          CircuitComponent,
                          Units,
                          Multiplier.ToString(CultureInfo.InvariantCulture),
                Adder.ToString(CultureInfo.InvariantCulture),
                Skew.ToString(CultureInfo.InvariantCulture),
                MinValue.ToString(CultureInfo.InvariantCulture),
                MaxValue.ToString(CultureInfo.InvariantCulture)
            };

            // ...,primary,secondary,PS
            if (m_version >= 1999)
            {
                values.Add(PrimaryRatio.ToString(CultureInfo.InvariantCulture));
                values.Add(SecondaryRatio.ToString(CultureInfo.InvariantCulture));
                values.Add(ScalingIdentifier.ToString());
            }

            return(string.Join(",", values));
        }
Example #3
0
        public string GetString()
        {
            var fieldTypeString = FieldType.ToString().ToLower() + ".";
            var fieldSizeString = FieldSize.ToString().ToLower();

            if (InnerFieldSize != null && InnerFieldSize != FieldSize.UNDEFINED)
            {
                fieldSizeString += "." + InnerFieldSize.ToString();
            }
            var offsetString = string.Empty;

            if (Offset < 0)
            {
                offsetString = " -0x" + Math.Abs(Offset).ToString("X");
            }
            else
            {
                offsetString = " 0x" + Offset.ToString("X");
            }
            var positionString = " " + Position.Item1.ToString() + ".";

            positionString += "--" + Position.Item2.ToString() + ".";
            var multiplierString   = " " + Multiplier.ToString() + ".";
            var abbreviationString = " \"" + Abbreviation;
            var descriptionString  = "," + Description + "\"";

            return(Indentation + fieldTypeString + fieldSizeString + offsetString + positionString +
                   multiplierString + abbreviationString + descriptionString);
        }
Example #4
0
        /// <summary>
        /// Saves properties
        /// </summary>
        /// <param name="writer">XmlWriter</param>
        public void Save(XmlWriter writer)
        {
            if (writer == null)
            {
                return;
            }

            bool writeheader = false;

            if (writer.WriteState != WriteState.Element)
            {
                writeheader = true;
            }

            if (writeheader)
            {
                writer.WriteStartElement("criticalhit");
            }
            writer.WriteAttributeString("minimum", Minimum.ToString());
            writer.WriteAttributeString("maximum", Maximum.ToString());
            writer.WriteAttributeString("multiplier", Multiplier.ToString());
            if (writeheader)
            {
                writer.WriteEndElement();
            }
        }
Example #5
0
        private void nudDiceResult_ValueChanged(object sender, EventArgs e)
        {
            string strSpace = LanguageManager.GetString("String_Space", GlobalOptions.Language);

            lblResult.Text = strSpace + '+' + strSpace + Extra.ToString("#,0", GlobalOptions.CultureInfo) + ')' + strSpace + '×'
                             + strSpace + Multiplier.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo)
                             + strSpace + '=' + strSpace + StartingNuyen.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo);
        }
Example #6
0
        private void nudDiceResult_ValueChanged(object sender, EventArgs e)
        {
            string strSpace = LanguageManager.GetString("String_Space");

            lblResult.Text = new StringBuilder(strSpace).Append('+')
                             .Append(strSpace).Append(Extra.ToString("#,0", GlobalOptions.CultureInfo)).Append(')')
                             .Append(strSpace).Append('×')
                             .Append(strSpace).Append(Multiplier.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo))
                             .Append(strSpace).Append('=')
                             .Append(strSpace).Append(StartingNuyen.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo)).ToString();
        }
Example #7
0
        public override Contract ToIbContract()
        {
            var contract = base.ToIbContract();

            if (OptionType != EOptionType.None)
            {
                contract.Right = OptionType == EOptionType.Call ? "C" : "P";
            }
            contract.Expiry     = Expiry < DateTime.Now ? null : Expiry.ToString("yyyyMMdd");
            contract.Strike     = Strike;
            contract.Multiplier = Multiplier.ToString();
            return(contract);
        }
Example #8
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print.</param>
        /// <param name="strLanguageToPrint">Language in which to print</param>
        public void Print(XmlTextWriter objWriter, CultureInfo objCulture, string strLanguageToPrint)
        {
            objWriter.WriteStartElement("lifestyle");
            objWriter.WriteElementString("name", CustomName);
            objWriter.WriteElementString("cost", Cost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalmonthlycost", TotalMonthlyCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("totalcost", TotalCost.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("dice", Dice.ToString(objCulture));
            objWriter.WriteElementString("multiplier", Multiplier.ToString(_objCharacter.Options.NuyenFormat, objCulture));
            objWriter.WriteElementString("months", Increments.ToString(objCulture));
            objWriter.WriteElementString("purchased", Purchased.ToString());
            objWriter.WriteElementString("type", StyleType.ToString());
            objWriter.WriteElementString("increment", IncrementType.ToString());
            objWriter.WriteElementString("sourceid", SourceID.ToString("D"));
            objWriter.WriteElementString("bonuslp", BonusLP.ToString(objCulture));
            string strBaseLifestyle = string.Empty;

            // Retrieve the Advanced Lifestyle information if applicable.
            if (!string.IsNullOrEmpty(BaseLifestyle))
            {
                XmlNode objXmlAspect = GetNode();
                if (objXmlAspect != null)
                {
                    strBaseLifestyle = objXmlAspect["translate"]?.InnerText ?? objXmlAspect["name"]?.InnerText ?? strBaseLifestyle;
                }
            }

            objWriter.WriteElementString("baselifestyle", strBaseLifestyle);
            objWriter.WriteElementString("trustfund", TrustFund.ToString());
            objWriter.WriteElementString("source", CommonFunctions.LanguageBookShort(Source, strLanguageToPrint));
            objWriter.WriteElementString("page", DisplayPage(strLanguageToPrint));
            objWriter.WriteStartElement("qualities");

            // Retrieve the Qualities for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in LifestyleQualities)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            // Retrieve the free Grids for the Advanced Lifestyle if applicable.
            foreach (LifestyleQuality objQuality in FreeGrids)
            {
                objQuality.Print(objWriter, objCulture, strLanguageToPrint);
            }
            objWriter.WriteEndElement();
            if (_objCharacter.Options.PrintNotes)
            {
                objWriter.WriteElementString("notes", Notes);
            }
            objWriter.WriteEndElement();
        }
Example #9
0
        /// <summary>
        /// Converts <see cref="AnalogChannel"/> to its string format.
        /// </summary>
        public override string ToString()
        {
            string[] values = new string[13];

            // An,ch_id,ph,ccbm,uu,a,b,skew,min,max,primary,secondary,PS
            values[0]  = Index.ToString();
            values[1]  = Name;
            values[2]  = PhaseID;
            values[3]  = CircuitComponent;
            values[4]  = Units;
            values[5]  = Multiplier.ToString(CultureInfo.InvariantCulture);
            values[6]  = Adder.ToString(CultureInfo.InvariantCulture);
            values[7]  = Skew.ToString(CultureInfo.InvariantCulture);
            values[8]  = MinValue.ToString();
            values[9]  = MaxValue.ToString();
            values[10] = PrimaryRatio.ToString(CultureInfo.InvariantCulture);
            values[11] = SecondaryRatio.ToString(CultureInfo.InvariantCulture);
            values[12] = ScalingIdentifier.ToString();

            return(values.ToDelimitedString(','));
        }
Example #10
0
        public override string ToString()
        {
            string res = "";

            if (MaxHP != 1)
            {
                res += "\n" + Core.SignValue(MaxHP - 1, "P0") + " max HP";
            }
            if (MaxHPBonus != 0)
            {
                res += "\n" + Core.SignValue(MaxHPBonus, "F0") + "x max HP";
            }
            if (ExhaustedStart != 1)
            {
                res += "\n" + ExhaustedStart.ToString("F2") + "x Exhausted condition start HP";
            }
            if (ExhaustedEnd != 1)
            {
                res += "\n" + ExhaustedEnd.ToString("F2") + "x Exhausted condition end HP";
            }
            if (Exposure != 1)
            {
                res += "\n" + Exposure.ToString("F2") + "x Radiation Exposure";
            }

            if (HPChangePerDay != 0)
            {
                res = "\n" + Core.SignValue(HPChangePerDay, "F1") + " HP/day";
            }
            if (Recuperation != 0)
            {
                res += "\n" + Recuperation.ToString("F1") + "%/day Recuperation";
            }
            if (Decay != 0)
            {
                res += "\n" + Decay.ToString("F1") + "%/day Health Decay";
            }
            if (Multiplier != 1)
            {
                res += "\n" + Multiplier.ToString("F2") + "x " + MultiplyFactor + " factor";
            }
            if (Space != 0)
            {
                res += "\n" + Core.SignValue(Space, "F1") + " Living Space";
            }
            if (Shielding != 0)
            {
                res += "\n" + Core.SignValue(Shielding, "F1") + " Shielding";
            }
            if (Radioactivity != 0)
            {
                res += "\n" + Core.SignValue(Radioactivity, "N0") + " banana/day radioactive emission";
            }

            if (AccidentChance != 1)
            {
                res += "\n" + AccidentChance.ToString("F2") + "x Accident chance";
            }
            if (PanicAttackChance != 1)
            {
                res += "\n" + PanicAttackChance.ToString("F2") + "x Panic attack chance";
            }
            if (SicknessChance != 1)
            {
                res += "\n" + SicknessChance.ToString("F2") + "x Sickness chance";
            }
            if (CureChance != 1)
            {
                res += "\n" + CureChance.ToString("F2") + "x Cure chance";
            }
            if (LoseImmunityChance != 1)
            {
                res += "\n" + LoseImmunityChance.ToString("F2") + "x Lose immunity chance";
            }

            string l = Logic.ToString();

            if (l != "")
            {
                res += "\nLogic:\n" + l;
            }

            return(res.Trim());
        }
Example #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(aimnType.ToString());
            xmlDoc.AppendChild(rootNode);

            #region IEC61850Server
            if (slaveType == SlaveTypes.IEC61850Server)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr2 = xmlDoc.CreateAttribute("ReportingIndex");
                attr2.Value = iec61850reportingindex.ToString();
                rootNode.Attributes.Append(attr2);

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

                XmlAttribute attrCommandType = xmlDoc.CreateAttribute("CommandType");
                attrCommandType.Value = CommandType.ToString();
                rootNode.Attributes.Append(attrCommandType);

                XmlAttribute attrDeadband = xmlDoc.CreateAttribute("Deadband");
                attrDeadband.Value = Deadband.ToString();
                rootNode.Attributes.Append(attrDeadband);

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

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

                XmlAttribute attrDescription = xmlDoc.CreateAttribute("Description");
                attrDescription.Value = Description.ToString();
                rootNode.Attributes.Append(attrDescription);
            }
            #endregion IEC61850Server

            #region GDisplaySlave
            if (slaveType == SlaveTypes.GRAPHICALDISPLAYSLAVE)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attrCellNo = xmlDoc.CreateAttribute("CellNo");
                attrCellNo.Value = CellNo.ToString();
                rootNode.Attributes.Append(attrCellNo);

                XmlAttribute attrWidget = xmlDoc.CreateAttribute("Widget");
                attrWidget.Value = Widget.ToString();
                rootNode.Attributes.Append(attrWidget);

                XmlAttribute attrUnit = xmlDoc.CreateAttribute("Unit");
                attrUnit.Value = UnitID.ToString();
                rootNode.Attributes.Append(attrUnit);

                XmlAttribute attrDescription = xmlDoc.CreateAttribute("Description");
                attrDescription.Value = Description.ToString();
                rootNode.Attributes.Append(attrDescription);
            }
            #endregion GDisplaySlave

            #region OtherSlave
            if ((slaveType == SlaveTypes.DNP3SLAVE) || (slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN) || (slaveType == SlaveTypes.SPORTSLAVE) || (slaveType == SlaveTypes.MQTTSLAVE) || (slaveType == SlaveTypes.SMSSLAVE))
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            #endregion OtherSlave

            return(rootNode);
        }
Example #12
0
 /// <summary>
 /// Вернуть знчение делителя
 /// </summary>
 /// <returns></returns>
 protected string GetMultiplier(Multiplier mp)
 {
     return(GetMeasurementResource(mp.ToString()));
 }
Example #13
0
 public override string  ToString()
 {
     return(myMultiplier.ToString() + myDimension.ToString());
 }
Example #14
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(aimnType.ToString());
            xmlDoc.AppendChild(rootNode);
            if (slaveType == SlaveTypes.IEC61850Server)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
                XmlAttribute attr2 = xmlDoc.CreateAttribute("ReportingIndex");
                attr2.Value = iec61850reportingindex.ToString();
                rootNode.Attributes.Append(attr2);

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

                XmlAttribute attrCommandType = xmlDoc.CreateAttribute("CommandType");
                attrCommandType.Value = CommandType.ToString();
                rootNode.Attributes.Append(attrCommandType);

                XmlAttribute attrDeadband = xmlDoc.CreateAttribute("Deadband");
                attrDeadband.Value = Deadband.ToString();
                rootNode.Attributes.Append(attrDeadband);

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

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

                XmlAttribute attrDescription = xmlDoc.CreateAttribute("Description");
                attrDescription.Value = Description.ToString();
                rootNode.Attributes.Append(attrDescription);
            }
            if ((slaveType == SlaveTypes.IEC101SLAVE) || (slaveType == SlaveTypes.IEC104) || (slaveType == SlaveTypes.MODBUSSLAVE) || (slaveType == SlaveTypes.UNKNOWN))
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }
            }
            return(rootNode);
        }
        public async Task WhenUpdatingSettingThenPersistImmediately()
        {
            // Arrange
            const double Multiplier = 1.234;

            var settings           = new List <Setting>();
            var settingsRepository = Substitute.For <ISettingsRepository>();

            settingsRepository.GetAllAsync().Returns(settings);
            var builder = new MainViewModelBuilder().WithSettingsRepository(settingsRepository);
            var vm      = builder.Build();

            // HACK: Wait here to allow the viewmodel's background task to load the settings initially
            await Task.Delay(100);

            // Act
            vm.RiskMultiplier = Multiplier;

            // Assert
            Assert.Equal(Multiplier, builder.SettingsViewModel.LastRiskMultiplier);
            settingsRepository
            .Received()
            .Update(Arg.Is <Setting>(x => x.Key == SettingsViewModel.SettingsKeys.RiskMultiplier && x.Value == Multiplier.ToString()));
            await settingsRepository.Received().SaveAsync();
        }
        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);
        }
Example #17
0
 private void nudDiceResult_ValueChanged(object sender, EventArgs e)
 {
     lblResult.Text = " + " + Extra.ToString("#,0", GlobalOptions.CultureInfo) + ") x " + Multiplier.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo)
                      + " = " + StartingNuyen.ToString(_objCharacter.Options.NuyenFormat + '¥', GlobalOptions.CultureInfo);
 }
Example #18
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);
        }