public CreditDefaultSwapOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList strikeNodeList = xmlNode.SelectNodes("strike");
     if (strikeNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in strikeNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 strikeIDRef = item.Attributes["id"].Name;
                 CreditOptionStrike ob = CreditOptionStrike();
                 IDManager.SetID(strikeIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 strikeIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 strike = new CreditOptionStrike(item);
             }
         }
     }
     
 
     XmlNodeList creditDefaultSwapNodeList = xmlNode.SelectNodes("creditDefaultSwap");
     if (creditDefaultSwapNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in creditDefaultSwapNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 creditDefaultSwapIDRef = item.Attributes["id"].Name;
                 CreditDefaultSwap ob = CreditDefaultSwap();
                 IDManager.SetID(creditDefaultSwapIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 creditDefaultSwapIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 creditDefaultSwap = new CreditDefaultSwap(item);
             }
         }
     }
     
 
 }
 public IndexChange(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList indexFactorNodeList = xmlNode.SelectNodes("indexFactor");
     if (indexFactorNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in indexFactorNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 indexFactorIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(indexFactorIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 indexFactorIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 indexFactor = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList factoredCalculationAmountNodeList = xmlNode.SelectNodes("factoredCalculationAmount");
     if (factoredCalculationAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in factoredCalculationAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 factoredCalculationAmountIDRef = item.Attributes["id"].Name;
                 Money ob = Money();
                 IDManager.SetID(factoredCalculationAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 factoredCalculationAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 factoredCalculationAmount = new Money(item);
             }
         }
     }
     
 
 }
		public object Create (object parent, object configContext, XmlNode section)
		{
			Hashtable engines = new Hashtable ();

			foreach (XmlNode engineNode in section.SelectNodes ("engines/engine")) {
				EngineConfig engine = EngineConfig.FromXml (engineNode);
				if (engines.Contains (engine.Name)) {
					string msg = string.Format (CultureInfo.InvariantCulture,
						"A engine with name '{0}' already exists.",
						engine.Name);
					throw new ConfigurationErrorsException (msg, engineNode);
				}
				engines.Add (engine.Name, engine);
			}

			Hashtable connections = new Hashtable ();

			foreach (XmlNode connNode in section.SelectNodes ("connections/connection")) {
				ConnectionConfig conn = ConnectionConfig.FromXml (connNode, engines);
				if (connections.Contains (conn.Name)) {
					string msg = string.Format (CultureInfo.InvariantCulture,
						"A connection with name '{0}' already exists.",
						conn.Name);
					throw new ConfigurationErrorsException (msg, connNode);
				}
				connections.Add (conn.Name, conn);
			}

			ConnectionConfig [] c = new ConnectionConfig [connections.Count];
			connections.Values.CopyTo (c, 0);
			return c;
		}
Exemple #4
0
		public void Read (XmlNode node)
		{
			if (node == null)
				return;
			
			XmlAttributeCollection attrs = node.Attributes;
			ID = attrs.GetRequired<string> ("id");
			SendAsCommitter = attrs.GetOptional ("sendAsCommitter", false);
			UseCommitterAsSenderName = attrs.GetOptional ("useCommitterAsSenderName", false);
			
			Author addr = ReadEmail (node.SelectSingleNode ("//from"));
			if (!SendAsCommitter && addr == null)
				throw new InvalidOperationException (String.Format ("Required <from> element is missing from commit source with id '{0}'", ID));
			From = addr;

			addr = ReadEmail (node.SelectSingleNode ("//replyTo"));
			if (addr == null)
				ReplyTo = From;
			else
				ReplyTo = addr;
			
			ReadEmails (node.SelectNodes ("//to/email"), TORecipients);
			if (TORecipients.Count == 0)
				throw new InvalidOperationException ("List of TO addresses must have at least one element");
			ReadEmails (node.SelectNodes ("//cc/email"), CCRecipients);
			ReadEmails (node.SelectNodes ("//bcc/email"), BCCRecipients);
		}
        private static Folder DeserialiseFolder(XmlNode folderNode)
        {
            Folder folder = new Folder();
            folder.ID = FolderIdCounter++;
            folder.Name = folderNode.Attributes["name"].Value;
            folder.Iterator = (IteratorTypes)Enum.Parse(typeof(IteratorTypes), folderNode.Attributes["iterator"].Value, true);

            foreach (XmlNode fileNode in folderNode.SelectNodes("file"))
            {
                File file = DeserialiseFile(fileNode);
                file.ParentFolder = folder;
                folder.Files.Add(file);
            }
            foreach (XmlNode fileNode in folderNode.SelectNodes("static-file"))
            {
                StaticFile file = DeserialiseStaticFile(fileNode);
                file.ParentFolder = folder;
                folder.StaticFiles.Add(file);
            }
            foreach (XmlNode subFolderNode in folderNode.SelectNodes("folder"))
            {
                Folder subFolder = DeserialiseFolder(subFolderNode);
                subFolder.ParentFolder = folder;
                folder.Folders.Add(subFolder);
            }
            return folder;
        }
 public FxOptionPremium(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList settlementInformationNodeList = xmlNode.SelectNodes("settlementInformation");
     if (settlementInformationNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in settlementInformationNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 settlementInformationIDRef = item.Attributes["id"].Name;
                 SettlementInformation ob = SettlementInformation();
                 IDManager.SetID(settlementInformationIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 settlementInformationIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 settlementInformation = new SettlementInformation(item);
             }
         }
     }
     
 
     XmlNodeList quoteNodeList = xmlNode.SelectNodes("quote");
     if (quoteNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in quoteNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 quoteIDRef = item.Attributes["id"].Name;
                 PremiumQuote ob = PremiumQuote();
                 IDManager.SetID(quoteIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 quoteIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 quote = new PremiumQuote(item);
             }
         }
     }
     
 
 }
 public DefaultProbabilityCurve(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList baseYieldCurveNodeList = xmlNode.SelectNodes("baseYieldCurve");
     if (baseYieldCurveNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in baseYieldCurveNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 baseYieldCurveIDRef = item.Attributes["id"].Name;
                 PricingStructureReference ob = PricingStructureReference();
                 IDManager.SetID(baseYieldCurveIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 baseYieldCurveIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 baseYieldCurve = new PricingStructureReference(item);
             }
         }
     }
     
 
     XmlNodeList defaultProbabilitiesNodeList = xmlNode.SelectNodes("defaultProbabilities");
     if (defaultProbabilitiesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in defaultProbabilitiesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 defaultProbabilitiesIDRef = item.Attributes["id"].Name;
                 TermCurve ob = TermCurve();
                 IDManager.SetID(defaultProbabilitiesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 defaultProbabilitiesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 defaultProbabilities = new TermCurve(item);
             }
         }
     }
     
 
 }
 public ReturnSwapLegUnderlyer(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList strikeDateNodeList = xmlNode.SelectNodes("strikeDate");
     if (strikeDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in strikeDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 strikeDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(strikeDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 strikeDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 strikeDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList underlyerNodeList = xmlNode.SelectNodes("underlyer");
     if (underlyerNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in underlyerNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 underlyerIDRef = item.Attributes["id"].Name;
                 Underlyer ob = Underlyer();
                 IDManager.SetID(underlyerIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 underlyerIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 underlyer = new Underlyer(item);
             }
         }
     }
     
 
 }
 public RelativeDates(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList periodSkipNodeList = xmlNode.SelectNodes("periodSkip");
     if (periodSkipNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in periodSkipNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 periodSkipIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(periodSkipIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 periodSkipIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 periodSkip = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
     XmlNodeList scheduleBoundsNodeList = xmlNode.SelectNodes("scheduleBounds");
     if (scheduleBoundsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in scheduleBoundsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 scheduleBoundsIDRef = item.Attributes["id"].Name;
                 DateRange ob = DateRange();
                 IDManager.SetID(scheduleBoundsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 scheduleBoundsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 scheduleBounds = new DateRange(item);
             }
         }
     }
     
 
 }
 public MultipleValuationDates(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList businessDaysThereafterNodeList = xmlNode.SelectNodes("businessDaysThereafter");
     if (businessDaysThereafterNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in businessDaysThereafterNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 businessDaysThereafterIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(businessDaysThereafterIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 businessDaysThereafterIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 businessDaysThereafter = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
     XmlNodeList numberValuationDatesNodeList = xmlNode.SelectNodes("numberValuationDates");
     if (numberValuationDatesNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in numberValuationDatesNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 numberValuationDatesIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(numberValuationDatesIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 numberValuationDatesIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 numberValuationDates = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
 }
        private static Node LoadNode(XmlNode xnode)
        {
            Node node = new Node();

            XmlNodeList xnodeNodeList = xnode.SelectNodes("node");

            foreach (XmlNode nodeXnode in xnodeNodeList)
            {
                node.Nodes.Add(LoadNode(nodeXnode));
            }

            XmlNodeList xnodeValueList = xnode.SelectNodes("value");

            foreach (XmlNode valueXnode in xnodeValueList)
            {
                node.Values.Add(LoadValue(valueXnode));
            }

            XmlNodeList xnodeNodeListList = xnode.SelectNodes("nodelist");

            foreach (XmlNode nodeListXnode in xnodeNodeListList)
            {
                node.NodeLists.Add(LoadNodeList(nodeListXnode));
            }

            return node;
        }
 public FutureValueAmount(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList calculationPeriodNumberOfDaysNodeList = xmlNode.SelectNodes("calculationPeriodNumberOfDays");
     if (calculationPeriodNumberOfDaysNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in calculationPeriodNumberOfDaysNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 calculationPeriodNumberOfDaysIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(calculationPeriodNumberOfDaysIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 calculationPeriodNumberOfDaysIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 calculationPeriodNumberOfDays = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
     XmlNodeList valueDateNodeList = xmlNode.SelectNodes("valueDate");
     if (valueDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in valueDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 valueDateIDRef = item.Attributes["id"].Name;
                 XsdTypeDate ob = XsdTypeDate();
                 IDManager.SetID(valueDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 valueDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 valueDate = new XsdTypeDate(item);
             }
         }
     }
     
 
 }
        public GlobalClass(Global parent, XmlNode xml, XmlNamespaceManager nsm)
            : this(parent)
        {
            if (xml == null)
                throw new ArgumentNullException();
            if (nsm == null)
                throw new ArgumentNullException();

            XmlAttribute attr = xml.SelectSingleNode("@superclass", nsm) as XmlAttribute;
            if (attr != null)
                this.Superclass = attr.Value;
            attr = xml.SelectSingleNode("@instaneState", nsm) as XmlAttribute;
            if (attr != null)
            {
                if (attr.Value == "byte")
                    this.InstanceState = InstanceStateEnum.Byte;
                else if (attr.Value == "object")
                    this.InstanceState = InstanceStateEnum.Object;
                else
                    this.InstanceState = InstanceStateEnum.None;
            }

            foreach (XmlAttribute node in xml.SelectNodes("sd:InstanceVariable/@name", nsm))
                this.InstanceVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ClassVariable/@name", nsm))
                this.ClassVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ClassInstanceVariable/@name", nsm))
                this.ClassInstanceVariables.Add(node.Value);
            foreach (XmlAttribute node in xml.SelectNodes("sd:ImportedPool/@name", nsm))
                this.ImportedPools.Add(node.Value);
        }
Exemple #14
0
        public Protocol(SystemDescription parent, XmlNode xml, XmlNamespaceManager nsm)
            : this(parent)
        {
            if (xml == null)
                throw new ArgumentNullException();
            if (nsm == null)
                throw new ArgumentNullException();

            XmlAttribute attr = xml.SelectSingleNode("@name", nsm) as XmlAttribute;
            if (attr != null)
                this.Name = attr.Value;
            attr = xml.SelectSingleNode("@docId", nsm) as XmlAttribute;
            if (attr != null)
                this.DocumentationId = attr.Value;
            attr = xml.SelectSingleNode("@abstract", nsm) as XmlAttribute;
            if (attr != null)
                this.IsAbstract = Boolean.Parse(attr.Value);

            foreach (XmlAttribute node in xml.SelectNodes("sd:ConformsTo/@protocol", nsm))
                this.ConformsTo.Add(node.Value);
            foreach (XmlElement node in xml.SelectNodes("sd:Description", nsm))
                this.Description = new HtmlString(node);
            foreach (XmlElement node in xml.SelectNodes("sd:StandardGlobal", nsm))
                this.StandardGlobals.Add(new Global(this, node, nsm));
            foreach (XmlElement node in xml.SelectNodes("sd:Message", nsm))
                this.Messages.Add(new Message(this, node, nsm));
        }
 public FxRateAsset(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList quotedCurrencyPairNodeList = xmlNode.SelectNodes("quotedCurrencyPair");
     if (quotedCurrencyPairNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in quotedCurrencyPairNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 quotedCurrencyPairIDRef = item.Attributes["id"].Name;
                 QuotedCurrencyPair ob = QuotedCurrencyPair();
                 IDManager.SetID(quotedCurrencyPairIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 quotedCurrencyPairIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 quotedCurrencyPair = new QuotedCurrencyPair(item);
             }
         }
     }
     
 
     XmlNodeList rateSourceNodeList = xmlNode.SelectNodes("rateSource");
     if (rateSourceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in rateSourceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 rateSourceIDRef = item.Attributes["id"].Name;
                 FxSpotRateSource ob = FxSpotRateSource();
                 IDManager.SetID(rateSourceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 rateSourceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 rateSource = new FxSpotRateSource(item);
             }
         }
     }
     
 
 }
 public ConvertibleBond(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList underlyingEquityNodeList = xmlNode.SelectNodes("underlyingEquity");
     if (underlyingEquityNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in underlyingEquityNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 underlyingEquityIDRef = item.Attributes["id"].Name;
                 EquityAsset ob = EquityAsset();
                 IDManager.SetID(underlyingEquityIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 underlyingEquityIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 underlyingEquity = new EquityAsset(item);
             }
         }
     }
     
 
     XmlNodeList redemptionDateNodeList = xmlNode.SelectNodes("redemptionDate");
     if (redemptionDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in redemptionDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 redemptionDateIDRef = item.Attributes["id"].Name;
                 XsdTypeDate ob = XsdTypeDate();
                 IDManager.SetID(redemptionDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 redemptionDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 redemptionDate = new XsdTypeDate(item);
             }
         }
     }
     
 
 }
 public FixedPaymentAmount(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList paymentAmountNodeList = xmlNode.SelectNodes("paymentAmount");
     if (paymentAmountNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in paymentAmountNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 paymentAmountIDRef = item.Attributes["id"].Name;
                 NonNegativeMoney ob = NonNegativeMoney();
                 IDManager.SetID(paymentAmountIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 paymentAmountIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 paymentAmount = new NonNegativeMoney(item);
             }
         }
     }
     
 
     XmlNodeList paymentDateNodeList = xmlNode.SelectNodes("paymentDate");
     if (paymentDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in paymentDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 paymentDateIDRef = item.Attributes["id"].Name;
                 RelativeDateOffset ob = RelativeDateOffset();
                 IDManager.SetID(paymentDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 paymentDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 paymentDate = new RelativeDateOffset(item);
             }
         }
     }
     
 
 }
 public PortfolioReference(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList sequenceNumberNodeList = xmlNode.SelectNodes("sequenceNumber");
     if (sequenceNumberNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in sequenceNumberNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 sequenceNumberIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(sequenceNumberIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 sequenceNumberIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 sequenceNumber = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
     XmlNodeList submissionsCompleteNodeList = xmlNode.SelectNodes("submissionsComplete");
     if (submissionsCompleteNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in submissionsCompleteNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 submissionsCompleteIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(submissionsCompleteIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 submissionsCompleteIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 submissionsComplete = new XsdTypeBoolean(item);
             }
         }
     }
     
 
 }
 public ValuationDocument(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList marketNodeList = xmlNode.SelectNodes("market");
     if (marketNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in marketNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 marketIDRef = item.Attributes["id"].Name;
                 Market ob = Market();
                 IDManager.SetID(marketIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 marketIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 market = new Market(item);
             }
         }
     }
     
 
     XmlNodeList valuationSetNodeList = xmlNode.SelectNodes("valuationSet");
     if (valuationSetNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in valuationSetNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 valuationSetIDRef = item.Attributes["id"].Name;
                 ValuationSet ob = ValuationSet();
                 IDManager.SetID(valuationSetIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 valuationSetIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 valuationSet = new ValuationSet(item);
             }
         }
     }
     
 
 }
 public YieldCurve(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList algorithmNodeList = xmlNode.SelectNodes("algorithm");
     if (algorithmNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in algorithmNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 algorithmIDRef = item.Attributes["id"].Name;
                 XsdTypeString ob = XsdTypeString();
                 IDManager.SetID(algorithmIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 algorithmIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 algorithm = new XsdTypeString(item);
             }
         }
     }
     
 
     XmlNodeList forecastRateIndexNodeList = xmlNode.SelectNodes("forecastRateIndex");
     if (forecastRateIndexNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in forecastRateIndexNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 forecastRateIndexIDRef = item.Attributes["id"].Name;
                 ForecastRateIndex ob = ForecastRateIndex();
                 IDManager.SetID(forecastRateIndexIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 forecastRateIndexIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 forecastRateIndex = new ForecastRateIndex(item);
             }
         }
     }
     
 
 }
Exemple #21
0
        public Spell(XmlNode xml, Lua lua)
            : base()
        {
            Name = xml.SelectSingleNode("name").InnerText;
            Desc = xml.SelectSingleNode("desc").InnerText;

            Type = (AttackType)Enum.Parse(typeof(AttackType), xml.SelectSingleNode("type").InnerText);
            Target = (BattleTarget)Enum.Parse(typeof(BattleTarget), xml.SelectSingleNode("target").InnerText);

            XmlNode targetsFirstNode = xml.SelectSingleNode("targetEnemiesFirst");
            TargetEnemiesFirst = targetsFirstNode == null ? true : Boolean.Parse(targetsFirstNode.InnerText);

            XmlNode costNode = xml.SelectSingleNode("cost");
            MPCost = costNode == null ? 0 : Int32.Parse(costNode.InnerText);

            XmlNode orderNode = xml.SelectSingleNode("order");
            Order = orderNode == null ? 0 : Int32.Parse(orderNode.InnerText);

            Elements = GetElements(xml.SelectNodes("elements/element")).ToArray();
            Statuses = GetStatusChanges(xml.SelectNodes("statusChange")).ToArray();

            Power = Int32.Parse(xml.SelectSingleNode("power").InnerText);
            Hitp = Int32.Parse(xml.SelectSingleNode("hitp").InnerText);

            XmlNode hitsNode = xml.SelectSingleNode("hits");
            Hits = hitsNode == null ? 1 : Int32.Parse(hitsNode.InnerText);

            DamageFormula = GetFormula(xml.SelectSingleNode("formula"), lua);
            HitFormula = GetHitFormula(xml.SelectSingleNode("hitFormula"), lua);
        }
		public object Create(object parent, object configContext, XmlNode section)
		{
			var options = new BooViewEngineOptions();
			if (section.Attributes["batch"] != null)
				options.BatchCompile = bool.Parse(section.Attributes["batch"].Value);
			if (section.Attributes["saveToDisk"] != null)
				options.SaveToDisk = bool.Parse(section.Attributes["saveToDisk"].Value);
			if (section.Attributes["debug"] != null)
				options.Debug = bool.Parse(section.Attributes["debug"].Value);
			if (section.Attributes["saveDirectory"] != null)
				options.SaveDirectory = section.Attributes["saveDirectory"].Value;
			if (section.Attributes["commonScriptsDirectory"] != null)
				options.CommonScriptsDirectory = section.Attributes["commonScriptsDirectory"].Value;
			foreach(XmlNode refence in section.SelectNodes("reference"))
			{
				var attribute = refence.Attributes["assembly"];
				if (attribute == null)
					throw GetConfigurationException("Attribute 'assembly' is mandatory for <reference/> tags");
				var asm = Assembly.Load(attribute.Value);
				options.AssembliesToReference.Add(asm);
			}

			foreach(XmlNode import in section.SelectNodes("import"))
			{
				var attribute = import.Attributes["namespace"];
				if (attribute == null)
					throw GetConfigurationException("Attribute 'namespace' is mandatory for <import/> tags");
				var name = attribute.Value;
				options.NamespacesToImport.Add(name);
			}
			return options;
		}
 public Stub(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList stubStartDateNodeList = xmlNode.SelectNodes("stubStartDate");
     if (stubStartDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in stubStartDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 stubStartDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(stubStartDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 stubStartDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 stubStartDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
     XmlNodeList stubEndDateNodeList = xmlNode.SelectNodes("stubEndDate");
     if (stubEndDateNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in stubEndDateNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 stubEndDateIDRef = item.Attributes["id"].Name;
                 AdjustableOrRelativeDate ob = AdjustableOrRelativeDate();
                 IDManager.SetID(stubEndDateIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 stubEndDateIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 stubEndDate = new AdjustableOrRelativeDate(item);
             }
         }
     }
     
 
 }
 public PercentageRule(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList paymentPercentNodeList = xmlNode.SelectNodes("paymentPercent");
     if (paymentPercentNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in paymentPercentNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 paymentPercentIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(paymentPercentIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 paymentPercentIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 paymentPercent = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList notionalAmountReferenceNodeList = xmlNode.SelectNodes("notionalAmountReference");
     if (notionalAmountReferenceNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in notionalAmountReferenceNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 notionalAmountReferenceIDRef = item.Attributes["id"].Name;
                 NotionalAmountReference ob = NotionalAmountReference();
                 IDManager.SetID(notionalAmountReferenceIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 notionalAmountReferenceIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 notionalAmountReference = new NotionalAmountReference(item);
             }
         }
     }
     
 
 }
 public CommoditySpread(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList spreadConversionFactorNodeList = xmlNode.SelectNodes("spreadConversionFactor");
     if (spreadConversionFactorNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in spreadConversionFactorNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spreadConversionFactorIDRef = item.Attributes["id"].Name;
                 XsdTypeDecimal ob = XsdTypeDecimal();
                 IDManager.SetID(spreadConversionFactorIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spreadConversionFactorIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 spreadConversionFactor = new XsdTypeDecimal(item);
             }
         }
     }
     
 
     XmlNodeList spreadUnitNodeList = xmlNode.SelectNodes("spreadUnit");
     if (spreadUnitNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in spreadUnitNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 spreadUnitIDRef = item.Attributes["id"].Name;
                 QuantityUnit ob = QuantityUnit();
                 IDManager.SetID(spreadUnitIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 spreadUnitIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 spreadUnit = new QuantityUnit(item);
             }
         }
     }
     
 
 }
Exemple #26
0
        /// <summary>
        /// 从xml文件中初始化对象
        /// </summary>
        public override void FromXML(XmlNode node)
        {
            this.DataState = DataState.UnChanged;
            this.Namespace = node.Attributes["namespace"].Value;
            this._guid = node.Attributes["Guid"].Value;
            this.ProjName = node.Attributes["Name"].Value;
            this.DataState = DataState.Update;

            this.EntityList.Clear();
            this.FloderList.Clear();
            this.DTOList.Clear();
            this.EnumList.Clear();
            this.RefrenceList.Clear();

            XmlNodeList nodeList = node.SelectNodes("RefrenceList/Refrence");
            if (nodeList != null)
            {
                foreach (XmlNode n in nodeList)
                {
                    ProjectRefrence projRef = new ProjectRefrence(this, string.Empty, string.Empty);
                    projRef.FromXML(n);
                    this.RefrenceList.Add(projRef);
                }
            }

            nodeList = node.SelectNodes("EntityList/Entity");
            //查找当前工程文件下所有的实体
            if (nodeList != null)
            {
                foreach (XmlNode n in nodeList)
                {
                    BEEntity entity = new BEEntity(this, string.Empty, string.Empty);
                    entity.FromXML(n);
                    this.EntityList.Add(entity);
                }
            }
            this.FloderList.AddRange(this.LoadFloderList(node));
            nodeList = node.SelectNodes("DTOList/DTO");
            if (nodeList != null)
            {
                foreach (XmlNode n in nodeList)
                {
                    DTOEntity dtoEntity = new DTOEntity(this, string.Empty, string.Empty);
                    dtoEntity.FromXML(n);
                    this.DTOList.Add(dtoEntity);
                }
            }
            nodeList = node.SelectNodes("EnumList/Enum");
            if (nodeList != null)
            {
                foreach (XmlNode n in nodeList)
                {
                    EnumEntity enumEntity = new EnumEntity(this, string.Empty, string.Empty);
                    enumEntity.FromXML(n);
                    this.EnumList.Add(enumEntity);
                }
            }

            this.IsChanged = false;
        }
        public XmlValidationRuleset(IXmlDocumentProvider docProvider, XmlNode node, XmlNamespaceManager nsmgr)
        {
            if (node.Attributes["name"] != null)
                this.Name = node.Attributes["name"].Value;
            if (node.Attributes["nameString"] != null)
                this.NameString = node.Attributes["nameString"].Value;
            if (node.Attributes["descriptionString"] != null)
                this.DescriptionString = node.Attributes["descriptionString"].Value;

            List<IValidationRule> rules = new List<IValidationRule>();
            string prefix = nsmgr.LookupPrefix("http://icalvalid.wikidot.com/validation");

            if (node.Attributes["basedOn"] != null)
            {
                // Inherit rules from the ruleset this one is based on.
                string name = node.Attributes["basedOn"].Value;
                foreach (XmlNode rule in node.SelectNodes("parent::" + prefix + ":rulesets/" + prefix + ":ruleset[@name='" + name + "']/" + prefix + ":rule", nsmgr))
                    rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));
            }

            foreach (XmlNode rule in node.SelectNodes(prefix + ":rule", nsmgr))
                rules.Add(new XmlValidationRule(docProvider, rule, nsmgr));

            Rules = rules.ToArray();
        }
 public ReportIdentification(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList numberOfSectionsNodeList = xmlNode.SelectNodes("numberOfSections");
     if (numberOfSectionsNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in numberOfSectionsNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 numberOfSectionsIDRef = item.Attributes["id"].Name;
                 XsdTypePositiveInteger ob = XsdTypePositiveInteger();
                 IDManager.SetID(numberOfSectionsIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 numberOfSectionsIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 numberOfSections = new XsdTypePositiveInteger(item);
             }
         }
     }
     
 
     XmlNodeList submissionsCompleteNodeList = xmlNode.SelectNodes("submissionsComplete");
     if (submissionsCompleteNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in submissionsCompleteNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 submissionsCompleteIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(submissionsCompleteIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 submissionsCompleteIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 submissionsComplete = new XsdTypeBoolean(item);
             }
         }
     }
     
 
 }
 public MutualFund(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList openEndedFundNodeList = xmlNode.SelectNodes("openEndedFund");
     if (openEndedFundNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in openEndedFundNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 openEndedFundIDRef = item.Attributes["id"].Name;
                 XsdTypeBoolean ob = XsdTypeBoolean();
                 IDManager.SetID(openEndedFundIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 openEndedFundIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 openEndedFund = new XsdTypeBoolean(item);
             }
         }
     }
     
 
     XmlNodeList fundManagerNodeList = xmlNode.SelectNodes("fundManager");
     if (fundManagerNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in fundManagerNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 fundManagerIDRef = item.Attributes["id"].Name;
                 XsdTypeString ob = XsdTypeString();
                 IDManager.SetID(fundManagerIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 fundManagerIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 fundManager = new XsdTypeString(item);
             }
         }
     }
     
 
 }
 public FxSwap(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNodeList nearLegNodeList = xmlNode.SelectNodes("nearLeg");
     if (nearLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in nearLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 nearLegIDRef = item.Attributes["id"].Name;
                 FxSwapLeg ob = FxSwapLeg();
                 IDManager.SetID(nearLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 nearLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 nearLeg = new FxSwapLeg(item);
             }
         }
     }
     
 
     XmlNodeList farLegNodeList = xmlNode.SelectNodes("farLeg");
     if (farLegNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in farLegNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 farLegIDRef = item.Attributes["id"].Name;
                 FxSwapLeg ob = FxSwapLeg();
                 IDManager.SetID(farLegIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 farLegIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 farLeg = new FxSwapLeg(item);
             }
         }
     }
     
 
 }
Exemple #31
0
        protected override ReportTask CreateItemFromXmlNode(System.Xml.XmlNode xmlNode)
        {
            ReportTask task = new ReportTask();

            task.Name                   = xmlNode.GetAttributeValueIf("Name");
            task.Description            = xmlNode.GetAttributeValueIf("Description");
            task.OutputFolder           = xmlNode.GetNodeValueIf("OutputFolder");
            task.IsSendMailInSingleMail = bool.Parse(xmlNode.GetNodeValueIf("SendInSingleMail"));
            task.IsMergeInSingleExcel   = bool.Parse(xmlNode.GetNodeValueIf("MergeInSingleExcel"));

            XmlNodeList reportNodeList = xmlNode.SelectNodes("Reports/Report");

            for (int i = 0; i < reportNodeList.Count; i++)
            {
                string report = reportNodeList[i].GetNodeValueIf();
                if (ReportConfig.QvReportManager.ItemCollection.ContainsKey(report))
                {
                    var qvReport = ReportConfig.QvReportManager.ItemCollection[report];
                    task.Reports.Add(report, qvReport);
                }
            }

            XmlNodeList recipientNodeList = xmlNode.SelectNodes("Recipients/Recipient");

            for (int i = 0; i < recipientNodeList.Count; i++)
            {
                string recipient = recipientNodeList[i].GetNodeValueIf();
                if (ReportConfig.RecipientManager.ItemCollection.ContainsKey(recipient))
                {
                    task.Recipients.Add(recipient, ReportConfig.RecipientManager.ItemCollection[recipient]);
                }
            }

            string recipientGroup = xmlNode.GetNodeValueIf("RecipientGroup");

            if (ReportConfig.RecipientGroupManager.ItemCollection.ContainsKey(recipientGroup))
            {
                task.Group = ReportConfig.RecipientGroupManager.ItemCollection[recipientGroup];
            }

            task.MessageDefinition         = new Message();
            task.MessageDefinition.From    = xmlNode.GetNodeValueIf("Message/From");
            task.MessageDefinition.CC      = xmlNode.GetNodeValueIf("Message/CC");
            task.MessageDefinition.BCC     = xmlNode.GetNodeValueIf("Message/BCC");
            task.MessageDefinition.Subject = xmlNode.GetNodeValueIf("Message/Subject");
            task.MessageDefinition.Body    = xmlNode.GetNodeValueIf("Message/Body");

            if (xmlNode.ChildNodeExists("FtpServer"))
            {
                task.FtpServer          = new FtpServer();
                task.FtpServer.Host     = xmlNode.GetNodeValueIf("FtpServer/Host");
                task.FtpServer.Username = xmlNode.GetNodeValueIf("FtpServer/Username");
                task.FtpServer.Password = EncryptionDecryption.Decode(xmlNode.GetNodeValueIf("FtpServer/Password"));
                task.FtpServer.Folder   = xmlNode.GetNodeValueIf("FtpServer/Folder");
                task.FtpServer.Port     = xmlNode.GetNodeValueIf("FtpServer/Port");
            }
            return(task);
        }
Exemple #32
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            XmlNodeList    cssFileNodes;
            String         aName, aVersion, DefaultServerComponents, aPath;
            List <CssFile> list = new List <CssFile>();

            DefaultServerComponents = section.Attributes.GetNamedItem("defaultServerComponents").Value;
            cssFileNodes            = section.SelectNodes("CssFile");

            foreach (XmlNode cssFileNode in cssFileNodes)
            {
                aName    = cssFileNode.Attributes.GetNamedItem("name").Value;
                aVersion = cssFileNode.Attributes.GetNamedItem("version").Value;
                aPath    = cssFileNode.Attributes.GetNamedItem("relativepath").Value;

                list.Add(new CssFile()
                {
                    FileName         = aName,
                    ServerComponents = DefaultServerComponents,
                    Version          = aVersion,
                    RelativePath     = aPath
                });
            }
            return(list);
        }
Exemple #33
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List <SyncConfigurationSection> items = new List <SyncConfigurationSection>();

            System.Xml.XmlNodeList processesNodes = section.SelectNodes("SyncSection");
            foreach (XmlNode processNode in processesNodes)
            {
                // only keep section that has the correct mode
                if (processNode.Attributes["Mode"].InnerText != SyncProvisionMode.ToString())
                {
                    continue;
                }

                var syncScopeNodes = processNode.SelectNodes("SyncScope");
                foreach (XmlNode syncScopeNode in syncScopeNodes)
                {
                    SyncConfigurationSection item = new SyncConfigurationSection();
                    item.ScopeName = syncScopeNode.Attributes["ScopeName"].InnerText;
                    var tableNames = syncScopeNode.Attributes["Tables"].InnerText;
                    if (String.IsNullOrEmpty(tableNames))
                    {
                        throw new InvalidOperationException("Tables Attribute Missing");
                    }
                    item.Tables = tableNames.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    items.Add(item);
                }
                break;  // we are done
            }
            return(items);
        }
        /// <summary>
        /// Creates the name value collection of entries decrypting the values
        /// as it reads them from the file.
        /// </summary>
        /// <param name="parent">The parent section from a higher directory</param>
        /// <param name="configContext">For the web, the context of the request</param>
        /// <param name="section">The xml representing the config section</param>
        /// <returns>A NameValueCollection of entries from the file.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            NameValueCollection settings;
            NameValueCollection parentSettings;
            string      key;
            string      encryptedValue;
            string      decryptedValue;
            XmlNodeList entries;

            //if there is not parent, we need a new empty collection
            //but if there is, we need a new collection which includes the
            //parent information
            if (parent == null)
            {
                settings = new NameValueCollection();
            }
            else
            {
                parentSettings = (NameValueCollection)parent;
                settings       = new NameValueCollection(parentSettings);
            }


            try
            {
                //get all of the items to be added
                entries = section.SelectNodes("//add");
                if (entries == null)
                {
                    throw new ConfigurationException(String.Format("The {0} section must have at least one \"add\" element in it.", section.Name), section);
                }

                //walk through the items and add each one to the collection,
                //decrypting as we go
                for (int entryIndex = 0; entryIndex < entries.Count; entryIndex++)
                {
                    //get the key and value from the element
                    key            = entries[entryIndex].Attributes.RemoveNamedItem("key").Value;
                    encryptedValue = entries[entryIndex].Attributes.RemoveNamedItem("value").Value;

                    //just set this without worrying about the decryption
                    //if there is no value
                    if (encryptedValue == "")
                    {
                        settings[key] = encryptedValue;
                    }
                    else
                    {
                        decryptedValue = APress.ASPNetBestPractices.ConfigurationSecurity.Decrypt(encryptedValue, true);
                        settings[key]  = decryptedValue;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ConfigurationException("Error trying to process configuration section", ex, section);
            }

            return(settings);
        }
Exemple #35
0
        // book 에 있는 position들을 load함.
        public void loadPosition()
        {
            this.bookXml_ = new XmlDocument();

            this.childBookList_ = new ObservableCollection <BookViewModel>();
            this.childBookList_.Add(this.ancestorBookViewModel_);

            //string bookPath = @"D:\Project File\OTCDerivativesCalculatorModule\Excel_Interface2\OutLook\";
            bookXml_.Load(bookPath_ + "\\" + "XMLFile1.xml");

            System.Xml.XmlNode positionFolderNode
                = bookXml_["positionFolder"];

            this.ancestorBookViewModel_.Node_ = positionFolderNode;

            System.Xml.XmlNode bookInfoNode
                = positionFolderNode["bookInfo"];

            this.ancestorBookViewModel_.IsTreeExpand_ = Convert.ToBoolean(bookInfoNode["isTreeExpand"].InnerText);
            this.ancestorBookViewModel_.BookName_     = bookInfoNode["bookName"].InnerText;
            this.ancestorBookViewModel_.BookCode_     = bookInfoNode["bookCode"].InnerText;

            foreach (System.Xml.XmlNode item in positionFolderNode.SelectNodes("book"))
            {
                BookViewModel childBook = new BookViewModel(this.ancestorBookViewModel_);

                childBook.setFromXml(item);

                this.ancestorBookViewModel_.ChildBookList_.Add(childBook);
            }
        }
Exemple #36
0
        /// <summary>
        /// This method parses the "Colors" section of the app.config value.
        /// It creates ColorSchemeInfo objects and populates these objects
        /// with the values mentioned in app.config.
        /// </summary>
        /// <param name="parent">Parent object.</param>
        /// <param name="configContext"> Configuration context object.</param>
        /// <param name="section">Colors Section XML node.</param>
        /// <returns>list of all the color schemes mentioned in the app.config file.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            XmlNodeList colorSchemeNodes = section.SelectNodes(COLORSCHEME);

            foreach (XmlNode colorSchemeNode in colorSchemeNodes)
            {
                ColorSchemeInfo info = new ColorSchemeInfo();
                info.Name = ReadAttribute(colorSchemeNode, NAME);

                string defaultColor = ReadAttribute(colorSchemeNode.SelectSingleNode(DEFAULT), COLOR);
                info.ColorMapping.Add(DEFAULT, defaultColor);

                XmlNodeList symbolNodes = colorSchemeNode.SelectNodes(SYMBOL);

                foreach (XmlNode symbolNode in symbolNodes)
                {
                    string alphabet = ReadAttribute(symbolNode, CHAR);
                    string color    = ReadAttribute(symbolNode, COLOR);

                    if (!info.ColorMapping.ContainsKey(alphabet))
                    {
                        info.ColorMapping.Add(alphabet, color);
                    }
                }

                this.colorschemes.Add(info);
            }

            return(this.colorschemes);
        }
Exemple #37
0
        public Profile LoadXML(string file)
        {
            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            xml.Load(file);
            System.Xml.XmlNode profile = xml.SelectSingleNode("services");
            this.Name = profile.Attributes["profile"].Value;
            bool _default = false;

            bool.TryParse(profile.Attributes["default"].Value, out _default);
            this.Default = _default;
            System.Xml.XmlNodeList nodes = profile.SelectNodes("service");
            foreach (System.Xml.XmlNode node in nodes)
            {
                if (node.Attributes["value"] != null)
                {
                    Items.Add(new Service
                    {
                        Description = node.Attributes["name"] != null ? node.Attributes["name"].Value : node.Attributes["value"].Value,
                        Value       = node.Attributes["value"].Value,
                        TimeOut     = node.Attributes["timeout"] != null ? int.Parse(node.Attributes["timeout"].Value) : 0,
                        StartDelay  = node.Attributes["start"] != null ? int.Parse(node.Attributes["start"].Value) : 0,
                        StopDelay   = node.Attributes["shutdown"] != null ? int.Parse(node.Attributes["shutdown"].Value) : 0
                    });
                }
                else
                {
                    // node has no value....
                }
            }
            return(this);
        }
Exemple #38
0
        /// <summary>
        /// Creates a configuration section handler.
        /// </summary>
        /// <param name="parent">Parent object.</param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section">Section XML node.</param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            if (section.Attributes["interval"] != null)
            {
                MonitorSectionHandler.interval = Double.Parse(section.Attributes["interval"].Value, CultureInfo.InvariantCulture);
            }

            List <WindowsService> monitoredServices = new List <WindowsService>();

            foreach (XmlNode serviceNode in section.SelectNodes("service"))
            {
                if (serviceNode.Attributes["name"] == null)
                {
                    throw new ConfigurationErrorsException("name argument must be set.");
                }
                if (serviceNode.Attributes["interval"] == null)
                {
                    throw new ConfigurationErrorsException("interval argument must be set.");
                }
                WindowsService service = new WindowsService(serviceNode.Attributes["name"].Value, Double.Parse(serviceNode.Attributes["interval"].Value, CultureInfo.InvariantCulture));
                monitoredServices.Add(service);
            }

            return(monitoredServices);
        }
Exemple #39
0
        private System.Xml.XmlNodeList GetWizardNodesFromSiteConfigXML()
        {
            try
            {
                String strSiteConfigXMLFilePath     = String.Empty;
                System.Xml.XmlDocument objConfigDoc = new System.Xml.XmlDocument();
                strSiteConfigXMLFilePath = Server.MapPath("~") + "/" + ConfigurationSettings.AppSettings["SiteXMLConfigFilePath"];

                if (System.IO.File.Exists(strSiteConfigXMLFilePath))
                {
                    objConfigDoc.Load(strSiteConfigXMLFilePath);

                    System.Xml.XmlNode rootConfig = objConfigDoc.DocumentElement;
                    return(rootConfig.SelectNodes("wizard"));
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 实现IConfigurationSectionHandler接口Create方法
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(Object parent, Object configContext, System.Xml.XmlNode section)
        {
            Permission P_Mission = new Permission();
            XmlNode    AppNode   = section.SelectSingleNode("ApplicationID");

            P_Mission.ApplicationID   = Convert.ToInt32(AppNode.InnerText);
            P_Mission.ApplicationName = AppNode.Attributes["name"].Value;
            AppNode                = section.SelectSingleNode("PageCode");
            P_Mission.PageCode     = AppNode.InnerText;
            P_Mission.PageCodeName = AppNode.Attributes["name"].Value;

            List <string> Files     = Common.GetDirFileList("aspx");
            XmlNodeList   ItemNodes = section.SelectNodes("Item");

            foreach (XmlNode Node in ItemNodes)
            {
                PermissionItem Item = new PermissionItem();
                Item.Item_Name     = Node.Attributes["name"].Value;
                Item.Item_Value    = Convert.ToInt32(Node.Attributes["value"].Value);
                Item.Item_FileList = Node.InnerText.ToLower();
                P_Mission.ItemList.Add(Item);
                if (Item.Item_FileList.Trim() != "")
                {
                    RemoveFile(Files, Item.Item_FileList.Trim());
                }
            }
            UpdatePermissionConfig(P_Mission, Files);

            return(P_Mission);
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ArrayList addInDirectories = new ArrayList();
            XmlNode   attr             = section.Attributes.GetNamedItem("ignoreDefaultPath");

            if (attr != null)
            {
                try
                {
                    addInDirectories.Add(Convert.ToBoolean(attr.Value));
                }
                catch (InvalidCastException)
                {
                    addInDirectories.Add(false);
                }
            }
            else
            {
                addInDirectories.Add(false);
            }

            XmlNodeList addInDirList = section.SelectNodes("AddInDirectory");

            foreach (XmlNode addInDir in addInDirList)
            {
                XmlNode path = addInDir.Attributes.GetNamedItem("path");
                if (path != null)
                {
                    addInDirectories.Add(path.Value);
                }
            }
            return(addInDirectories);
        }
        private void ReadTraceLogConfig()
        {
            System.Xml.XmlNode udp = this.xmlNode.SelectSingleNode("//Trace");
            if (udp != null)
            {
                System.Xml.XmlNodeList configs = udp.SelectNodes("Config");
                foreach (System.Xml.XmlNode config in configs)
                {
                    //id="capture" category="" level="DEBUG" module="capture"
                    System.Xml.XmlAttribute id       = config.Attributes["id"];
                    System.Xml.XmlAttribute category = config.Attributes["category"];
                    System.Xml.XmlAttribute level    = config.Attributes["level"];
                    System.Xml.XmlAttribute module   = config.Attributes["module"];
                    if (id == null)
                    {
                        throw new StackException("config error: console config should have id.");
                    }

                    // create a config instance
                    TraceLogConfig traceLogConfig = new TraceLogConfig();
                    traceLogConfig.Category = category.Value;
                    traceLogConfig.Level    = (LogLevel)Enum.Parse(typeof(LogLevel), level.Value);
                    traceLogConfig.Module   = module.Value;

                    if (this.logConfigs.ContainsKey(id.Value))
                    {
                        throw new StackException("the id of config must be unique.");
                    }
                    this.logConfigs.Add(id.Value, traceLogConfig);
                }
            }
        }
Exemple #43
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            XmlNodeList           nodes;
            string                index, name, username, password;
            List <SmsSettingInfo> list = new List <SmsSettingInfo>();

            nodes = section.SelectNodes("add");

            foreach (XmlNode node in nodes)
            {
                index    = node.Attributes.GetNamedItem("Index").Value;
                name     = node.Attributes.GetNamedItem("Name").Value;
                username = node.Attributes.GetNamedItem("Username").Value;
                password = node.Attributes.GetNamedItem("Password").Value;

                list.Add(new SmsSettingInfo()
                {
                    Index    = int.Parse(index),
                    Name     = name,
                    Username = username,
                    Password = password
                });
            }
            return(list);
        }
        private void ReadFileLogConfig()
        {
            System.Xml.XmlNode file = this.xmlNode.SelectSingleNode("//File");
            if (file != null)
            {
                System.Xml.XmlNodeList configs = file.SelectNodes("Config");
                foreach (System.Xml.XmlNode config in configs)
                {
                    //id="stack" category="" level="DEBUG" module="stack" fileName="stack.log"
                    System.Xml.XmlAttribute id       = config.Attributes["id"];
                    System.Xml.XmlAttribute category = config.Attributes["category"];
                    System.Xml.XmlAttribute level    = config.Attributes["level"];
                    System.Xml.XmlAttribute module   = config.Attributes["module"];
                    System.Xml.XmlAttribute fileName = config.Attributes["fileName"];
                    if (id == null || fileName == null)
                    {
                        throw new StackException("config error: file config should have id and fileName.");
                    }

                    // create a config instance
                    FileLogConfig fileLogConfig = new FileLogConfig();
                    fileLogConfig.Category = category.Value;
                    fileLogConfig.Level    = (LogLevel)Enum.Parse(typeof(LogLevel), level.Value);
                    fileLogConfig.Module   = module.Value;
                    fileLogConfig.FileName = fileName.Value;
                    if (this.logConfigs.ContainsKey(id.Value))
                    {
                        throw new StackException("the id of config must be unique.");
                    }
                    this.logConfigs.Add(id.Value, fileLogConfig);
                }
            }
        }
        /// <summary>
        /// Parses a section of the configuration file for information about the persistent stores.
        /// </summary>
        /// <param name="parent">The configuration settings in a corresponding parent configuration section.</param>
        /// <param name="configContext">An HttpConfigurationContext when Create is called from the ASP.NET configuration system.
        /// Otherwise, this parameter is reserved and is a null reference.</param>
        /// <param name="section">The XmlNode that contains the configuration information from the configuration file. Provides direct access to the XML contents of the configuration section.</param>
        /// <returns>A ViewerSection object created from the data in the configuration file.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            // Create an object to hold the data from the 'viewer' section of the application configuration file.
            ViewerSection viewerSection = new ViewerSection();

            try
            {
                // Read each of the nodes that contain information about the persistent stores and place them in the table.
                foreach (XmlNode xmlNode in section.SelectNodes("add"))
                {
                    // The 'type' section of the configuration file is modeled after other places in the OS where the type and
                    // assembly information are combined in the same string.  A simpler method might have been to break aprart the
                    // type string from the assembly string, but it's also a good idea to use standards where you find them.  In
                    // any event, when the 'type' specification is done this way, the padded spaces need to be removed from the
                    // values onced they're broken out from the original string.
                    string typeSpecification = xmlNode.Attributes["type"].Value;
                    if (typeSpecification == null)
                    {
                        throw new Exception("Syntax error in configuration file section 'viewers'.");
                    }

                    string[] typeParts = typeSpecification.Split(new char[] { ',' });
                    if (typeParts.Length != 2)
                    {
                        throw new Exception("Syntax error in configuration file section 'viewers'.");
                    }

                    Assembly typeAssembly = Assembly.Load(typeParts[ViewerSectionHandler.AssemblyIndex].Trim());
                    Type     typeType     = typeAssembly.GetType(typeParts[ViewerSectionHandler.TypeIndex]);

                    string viewerSpecification = xmlNode.Attributes["viewer"].Value;
                    if (viewerSpecification == null)
                    {
                        throw new Exception("Syntax error in configuration file section 'viewers'.");
                    }

                    string[] viewerParts = viewerSpecification.Split(new char[] { ',' });
                    if (viewerParts.Length != 2)
                    {
                        throw new Exception("Syntax error in configuration file section 'viewers'.");
                    }

                    Assembly viewerAssembly = Assembly.Load(viewerParts[ViewerSectionHandler.AssemblyIndex].Trim());
                    Type     viewerType     = viewerAssembly.GetType(viewerParts[ViewerSectionHandler.TypeIndex]);

                    // Add the viewer information to the section.  Each of these ViewerInfo items describes what kind of object the
                    // viewer is associated with and where to find the viewer.
                    viewerSection.Add(new ViewerInfo(typeType, viewerType));
                }
            }
            catch (Exception exception)
            {
                // Make sure that any errors caught while trying to load the viewer info is recorded in the log.  A system
                // administrator can look through these to figure out why the viewer information isn't formatted correctly.
                EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace);
            }

            // This object can be used to find a persistent store by nane and connect to it.
            return(viewerSection);
        }
Exemple #46
0
        //此函数在本应用程序中读取配置文件中地<AddInDirectories>元素
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ArrayList addInDirectories = new ArrayList();
            XmlNode   attr             = section.Attributes.GetNamedItem("ignoreDefaultPath");

            if (attr != null)
            {
                try
                {
                    addInDirectories.Add(Convert.ToBoolean(attr.Value));
                }
                catch (InvalidCastException)
                {
                    addInDirectories.Add(false);                    //如果文件读取异常,则默认设置为假,即不忽略默认的插件文件路径
                }
            }
            else
            {
                addInDirectories.Add(false);                //如果该属性不存在同样默认设置为假,即不忽略默认的插件文件路径
            }

            XmlNodeList addInDirList = section.SelectNodes("AddInDirectory");            //读取子节点

            foreach (XmlNode addInDir in addInDirList)

            {
                XmlNode path = addInDir.Attributes.GetNamedItem("path");
                if (path != null)
                {
                    addInDirectories.Add(path.Value);                    //将所有的自定义插件文件的路径字符串加到addInDirectories中
                }
            }
            return(addInDirectories);           //最后返回自定义插件文件的路径字符串以及是否要忽略默认插件文件路径的一个布尔值.
        }
Exemple #47
0
 public void Parse(ICompilateur comp, System.Xml.XmlNode node)
 {
     if (node.Attributes.GetNamedItem("indent") != null)
     {
         Int32.TryParse(node.Attributes.GetNamedItem("indent").Value, out this.indent);
     }
     this.writerName = node.Attributes.GetNamedItem("name").Value;
     this.filePath   = new List <string>();
     if (node.SelectNodes("file")[0].FirstChild != null)
     {
         foreach (XmlNode paramNode in node.SelectNodes("file/expression"))
         {
             string paramValue = paramNode.InnerText;
             this.filePath.Add(paramValue);
         }
     }
 }
 public void LoadFromXML(System.Xml.XmlNode node)
 {
     foreach (XmlNode fieldNode in node.SelectNodes("field"))
     {
         string fieldName = fieldNode.Attributes["name"].Value;
         SubValues[fieldName].LoadFromXML(fieldNode);
     }
 }
Exemple #49
0
        public static XmlNodeList SelectNodesEx(this XElement node, string nodeName)
        {
#if UNITY_WP8
            return(node.Elements(nodeName));
#else
            return(node.SelectNodes(nodeName));
#endif
        }
Exemple #50
0
        protected override Filter CreateItemFromXmlNode(System.Xml.XmlNode xmlNode)
        {
            Filter filter = new Filter();

            filter.Name        = xmlNode.GetAttributeValueIf("Name");
            filter.Description = xmlNode.GetAttributeValueIf("Description");
            string connection = xmlNode.GetNodeValueIf("Connection");

            if (ReportConfig.ConnectionManager.ItemCollection.ContainsKey(connection))
            {
                filter.Connection = ReportConfig.ConnectionManager.ItemCollection[connection];
            }

            XmlNodeList list = xmlNode.SelectNodes("Fields/Field");

            for (int i = 0; i < list.Count; i++)
            {
                QVField field = new QVField();
                field.Name       = list[i].GetAttributeValueIf("Name");
                field.Expression = list[i].GetAttributeValueIf("Expression");
                XmlNodeList valueList = list[i].SelectNodes("Value");
                for (int j = 0; j < valueList.Count; j++)
                {
                    FieldValue value = new FieldValue();
                    value.Value     = valueList[j].GetNodeValueIf();
                    value.Number    = double.Parse(valueList[j].GetAttributeValueIf("Number"));
                    value.IsNumeric = bool.Parse(valueList[j].GetAttributeValueIf("IsNumeric"));
                    field.Values.Add(value);
                }

                filter.Fields.Add(field.Name, field);
            }

            list = xmlNode.SelectNodes("Variables/Variable");
            for (int i = 0; i < list.Count; i++)
            {
                QvVariable variable = new QvVariable();
                variable.Name       = list[i].GetAttributeValueIf("Name");
                variable.Expression = list[i].GetAttributeValueIf("Expression");
                variable.Value      = list[i].GetNodeValueIf();

                filter.Variables.Add(variable.Name, variable);
            }

            return(filter);
        }
Exemple #51
0
        /// <summary>
        /// 获取ApplicationConfig中DataSource信息
        /// </summary>
        private void LoadConfigInformation()
        {
            XmlDocument oXmlDocument = new XmlDocument();

            DatabaseCollection = new Dictionary <string, Tuple <string, string, string> >();
            //Assert.VerifyNotEquals(databaseXmlFile, "", Error.PesistentError, "请设置配置文件");
            try
            {
                oXmlDocument.Load(this.m_DataTransferConfigFile);
                XmlNodeReader oXmlReader = new XmlNodeReader(oXmlDocument);

                //加载数据源
                while (oXmlReader.Read())
                {
                    if (oXmlReader.NodeType != XmlNodeType.Element)
                    {
                        continue;
                    }
                    if (oXmlReader.Name.ToLower() == "datasource")
                    {
                        DatabaseCollection.Add(oXmlReader.GetAttribute("name"), GetConnectionStr(oXmlReader));
                    }
                }

                //加载Tasks
                System.Xml.XmlNode root        = oXmlDocument.DocumentElement;
                XmlNodeList        xmlNodeList = root.SelectNodes("dataTransfer/task");
                LoadTask(xmlNodeList);

                //加载WebServiceUrls
                XmlNodeList xmlNodeListUrls = root.SelectNodes("WebServiceUrls/url");
                LoadWebServiceUrl(xmlNodeListUrls);
            }
            catch (PersistenceLayerException pException)
            {
                throw pException;
            }
            catch (Exception e)
            {
                string strErr = "错误:读取类映射文件" + this.m_DataTransferConfigFile + "发生错误,请确认你的文件路径及格式!" + e.Message;
                //Assert.Fail(Error.XmlReadError, strErr);
            }
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            CssServerConfiguration returnValue = new CssServerConfiguration();

            foreach (XmlNode node in section.SelectNodes("userTokens/userToken"))
            {
                returnValue.UserTokens.Add(node.Attributes["name"].Value, node.Attributes["value"].Value);
            }

            return(returnValue);
        }
Exemple #53
0
        /// <summary>
        /// Default implementation reads crossword dimensions (type is already known by CrosswordLoader, who used factory method
        /// to create appropriate crossword type). Then it deserializes all elements, by calling their appropriate deserializers
        /// (using factory method from ElementsFactory).
        /// Override it, if your derived crossword type requires to read specific information that was serialized.
        /// </summary>
        /// <param name="myNode">Node from disk file, containing serialized information about this crossword.</param>
        virtual public void DeserializeFromNode(System.Xml.XmlNode myNode)
        {
            int columns = int.Parse(myNode.Attributes["columns"].Value);
            int rows    = int.Parse(myNode.Attributes["rows"].Value);

            SetDimensions(columns, rows);
            foreach (XmlNode element in myNode.SelectNodes("elements/crosswordItem"))
            {
                BaseCrosswordElement bce = RecreateElementFromXmlNode(element, this);
            }
        }
        /// <summary>
        /// helper method to read a class node and store the fields
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private bool ReadAClassNode(System.Xml.XmlNode node)
        {
            bool success = true;

            System.Xml.XmlAttribute nameAttr = node.Attributes["name"];
            if (nameAttr == null)
            {
                return(false);
            }
            string className = nameAttr.Value;

            System.Xml.XmlAttribute partOfAttr = node.Attributes["partOf"];
            if (partOfAttr == null)
            {
                return(false);
            }
            string partOf = partOfAttr.Value;

            System.Xml.XmlNodeList idList = node.SelectNodes("Field");
            foreach (System.Xml.XmlNode idNode in idList)
            {
                ILexImportField field = new LexImportField();
                if (field.ReadNode(idNode))
                {
                    // is a abbrv field
                    field.IsAbbrField = m_AbbrSignatures.Contains(field.Signature);
                    AddField(className, partOf, field);

                    List <string> classnames = null;
                    if (!m_allFields.TryGetValue(field.ID, out classnames))
                    {
                        m_allFields.Add(field.ID, new List <string>(new string[] { className }));
                    }
                    else
                    {
                        // Review DanH (RandyR): Why add more than one, since only one is ever used?
                        // Maybe it should not be a List of strings, but only one string.
                        classnames.Add(className);
                        // Not used anywhere, other than adding stuff to it.
                        // m_dupFields.Add(field.ID); // Set's won't add them more than once.
                    }
                    // Not used anywhere, other than adding stuff to it.
                    // is a unique field
//					if (field.IsUnique)
//						m_uniqueFields.Add(field.ID);
                }
                else
                {
                    // error case where the xml field wasn't able to be read
                    success = false;                            // error
                }
            }
            return(success);
        }
Exemple #55
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            var         objectTypes = new Dictionary <string, ObjectConfigurationType>();
            XmlNodeList nodeObjects = section.SelectNodes(ObjectElement);

            foreach (XmlNode nodeObject in nodeObjects)
            {
                var objectType = new ObjectConfigurationType((XmlElement)nodeObject);
                objectTypes[objectType.Name] = objectType;
            }
            return(objectTypes);
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            List <UrlRewriteSection> list = new List <UrlRewriteSection>();
            UrlRewriteSection        l    = null;

            foreach (XmlNode urlRewrite in section.SelectNodes("//rewrite"))
            {
                l = new UrlRewriteSection(urlRewrite);
                list.Add(l);
            }
            return(list);
        }
Exemple #57
0
        /// <summary>
        /// ITestStep.Execute() implementation
        /// </summary>
        /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public void Execute(System.Xml.XmlNode testConfig, Context context)
        {
            XmlNodeList nodelist = testConfig.SelectNodes("VerifyId");

            foreach (XmlNode node in nodelist)
            {
                string valueToVerify = node.InnerText;
                string appinstance   = node.Attributes.GetNamedItem("appInstance").Value;
                string entity        = node.Attributes.GetNamedItem("idXRef").Value;

                string commonId = CrossReferencing.GetCommonID(entity, appinstance, valueToVerify);

                if (commonId == null || commonId == string.Empty)
                {
                    throw new ApplicationException("AppId " + valueToVerify + " not found");
                }

                context.LogInfo("IdXRef = " + entity + ". AppInstance = " + appinstance + ". AppId = " + valueToVerify + ". CommonId = " + commonId);
            }

            XmlNodeList valueNodelist = testConfig.SelectNodes("VerifyValue");

            foreach (XmlNode node in valueNodelist)
            {
                string valueToVerify = node.InnerText;
                string appType       = node.Attributes.GetNamedItem("appType").Value;
                string entity        = node.Attributes.GetNamedItem("valueXRef").Value;

                string commonValue = CrossReferencing.GetCommonValue(entity, appType, valueToVerify);

                if (commonValue == null || commonValue == string.Empty)
                {
                    throw new ApplicationException("AppValue " + valueToVerify + " not found");
                }

                context.LogInfo("IdXRef = " + entity + ". AppType = " + appType + ". AppValue = " + valueToVerify + ". CommonValue = " + commonValue);
            }

            context.LogInfo("Cross Reference Id and Value verification is complete");
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ServiceConfiguration configuration = new ServiceConfiguration();

            configuration.CallType =
                section.SelectSingleNode("calltype").Attributes["value"].Value;

            foreach (XmlNode node in section.SelectNodes("localcall/service"))
            {
                configuration.LocalService.Add(
                    node.Attributes["name"].Value,
                    node.Attributes["type"].Value);
            }

            configuration.AddressingType =
                section.SelectSingleNode("servicecall/addressing").Attributes["type"] == null
                    ? "MS.MCS.Framework.WCFService.WCFService.DefaultServiceAddressing, MS.MCS.Framework"
                    : section.SelectSingleNode("servicecall/addressing").Attributes["type"].Value;

            configuration.Bindings = new List <ServiceConfiguration.BindingConfiguration>();
            foreach (XmlNode node in section.SelectNodes("servicecall/addressing/binding"))
            {
                configuration.Bindings.Add(new ServiceConfiguration.BindingConfiguration()
                {
                    Name = node.Attributes["name"] == null
                            ? ""
                            : node.Attributes["name"].Value
                    ,
                    BaseAddress = node.Attributes["baseAddress"] == null
                           ? ""
                           : node.Attributes["baseAddress"].Value
                    ,
                    BindingElementName = node.Attributes["bindingConfig"] == null
                        ? ""
                        : node.Attributes["bindingConfig"].Value
                });
            }
            configuration.ResolveConfig();
            return(configuration);
        }
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            string typeName = null == section.Attributes["type"] ? "" : section.Attributes["type"].InnerText;
            Type   type     = Type.GetType(typeName);

            if (null == type)
            {
                return(null);
            }

            XmlNodeList paramList = section.SelectNodes("param");
            Hashtable   param     = new Hashtable();

            foreach (XmlNode n in paramList)
            {
                if (null != n.Attributes["name"] && null != n.Attributes["value"])
                {
                    param[n.Attributes["name"].InnerText] = n.Attributes["value"].InnerText;
                }
            }

            object obj = null;

            object[]        objParam    = null;
            ConstructorInfo constructor = null;

            if (param.Count > 0)
            {
                Type[] types = { typeof(IDictionary) };
                objParam = new object[1] {
                    param
                };
                constructor = type.GetConstructor(types);
            }

            if (null == constructor)
            {
                Type[] types = { };
                objParam    = new object[0];
                constructor = type.GetConstructor(types);
            }

            if (null != constructor)
            {
                obj = constructor.Invoke(objParam);
            }
            else
            {
                throw new MissingMethodException(string.Format("Cannot find an appropriated constructor of type '{0}'.", typeName));
            }
            return(obj);
        }
Exemple #60
0
 /// <summary>
 /// Load all fonts. Element must be <Fonts> node
 /// </summary>
 /// <param name="element"></param>
 public void Load(System.Xml.XmlNode element)
 {
     if (element.Name == "Fonts")
     {
         XmlNodeList fontNodes = element.SelectNodes("Font");
         foreach (XmlNode fontNode in fontNodes)
         {
             EditorFont newFont = new EditorFont();
             newFont.Load(fontNode);
             this.fonts.Add(newFont);
         }
     }
 }