public Excel_cds(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode excel_swapLegNode = xmlNode.SelectSingleNode("excel_swapLeg");
     
     if (excel_swapLegNode != null)
     {
         if (excel_swapLegNode.Attributes["href"] != null || excel_swapLegNode.Attributes["id"] != null) 
         {
             if (excel_swapLegNode.Attributes["id"] != null) 
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["id"].Value;
                 Excel_swapLeg ob = new Excel_swapLeg(excel_swapLegNode);
                 IDManager.SetID(excel_swapLegIDRef_, ob);
             }
             else if (excel_swapLegNode.Attributes["href"] != null)
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
             }
         }
         else
         {
             excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
         }
     }
     
 
     XmlNode excel_creditEventSwapLegNode = xmlNode.SelectSingleNode("excel_creditEventSwapLeg");
     
     if (excel_creditEventSwapLegNode != null)
     {
         if (excel_creditEventSwapLegNode.Attributes["href"] != null || excel_creditEventSwapLegNode.Attributes["id"] != null) 
         {
             if (excel_creditEventSwapLegNode.Attributes["id"] != null) 
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["id"].Value;
                 Excel_creditEventSwapLeg ob = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
                 IDManager.SetID(excel_creditEventSwapLegIDRef_, ob);
             }
             else if (excel_creditEventSwapLegNode.Attributes["href"] != null)
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
             }
         }
         else
         {
             excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
         }
     }
     
 
 }
Пример #2
1
        public void from(XmlNode node, XmlNamespaceManager xnm, string prefix, string subfix)
        {
            Type type = this.GetType();
            FieldInfo[] fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);

            foreach (FieldInfo field in fields)
            {
                string query = prefix +ObjectUtil.GetSimpleName(field) + subfix;
                try
                {
                    string value = null;
                    XmlNode tempNode;
                    if (xnm != null)
                    {
                        tempNode = node.SelectSingleNode(query, xnm);
                    }
                    else
                    {
                        tempNode = node.SelectSingleNode(query);
                    }
                    if (tempNode == null) {
                        field.SetValue(this,XML_NULL);
                        continue;
                    }
                    value = tempNode.InnerText;
                    field.SetValue(this, value);
                }
                catch (Exception ex) { }
            }
        }
 public CreditDefaultSwapOption(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode strikeNode = xmlNode.SelectSingleNode("strike");
     
     if (strikeNode != null)
     {
         if (strikeNode.Attributes["href"] != null || strikeNode.Attributes["id"] != null) 
         {
             if (strikeNode.Attributes["id"] != null) 
             {
                 strikeIDRef_ = strikeNode.Attributes["id"].Value;
                 CreditOptionStrike ob = new CreditOptionStrike(strikeNode);
                 IDManager.SetID(strikeIDRef_, ob);
             }
             else if (strikeNode.Attributes["href"] != null)
             {
                 strikeIDRef_ = strikeNode.Attributes["href"].Value;
             }
             else
             {
                 strike_ = new CreditOptionStrike(strikeNode);
             }
         }
         else
         {
             strike_ = new CreditOptionStrike(strikeNode);
         }
     }
     
 
     XmlNode creditDefaultSwapNode = xmlNode.SelectSingleNode("creditDefaultSwap");
     
     if (creditDefaultSwapNode != null)
     {
         if (creditDefaultSwapNode.Attributes["href"] != null || creditDefaultSwapNode.Attributes["id"] != null) 
         {
             if (creditDefaultSwapNode.Attributes["id"] != null) 
             {
                 creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["id"].Value;
                 CreditDefaultSwap ob = new CreditDefaultSwap(creditDefaultSwapNode);
                 IDManager.SetID(creditDefaultSwapIDRef_, ob);
             }
             else if (creditDefaultSwapNode.Attributes["href"] != null)
             {
                 creditDefaultSwapIDRef_ = creditDefaultSwapNode.Attributes["href"].Value;
             }
             else
             {
                 creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
             }
         }
         else
         {
             creditDefaultSwap_ = new CreditDefaultSwap(creditDefaultSwapNode);
         }
     }
     
 
 }
Пример #4
0
        /// <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);
        }
Пример #5
0
        private void readConfigfile()
        {
            try
            {
                readDeptConfig();
                // Declare a Hashtable object:
                issueLookupHash = new Hashtable();

                XmlDocument doc = new XmlDocument();
                doc.Load(strDeptUrl);
                //note: Should look something like: http://www.cs.mun.ca/~thecommons/configfiles/TrackerConfig.xml
                System.Xml.XmlNodeList ttt = doc.SelectNodes("tracker/issue-options/issue");

                //now we want to get all the issues and populate the list box
                for (int i = 0; i < ttt.Count; i++)
                {
                    System.Xml.XmlNode theNode = ttt.Item(i);
                    issueLookupHash.Add(i, theNode.SelectSingleNode("@name").Value);
                    //lbIssues.Items.Add (theNode.SelectSingleNode("@name").Value);
                }
                strDataFile   = doc.SelectSingleNode("tracker/datafile/@name").Value;
                strRoundsFile = doc.SelectSingleNode("tracker/roundsfile/@name").Value;
                //Now get the data for the buttons (note: this should be turned into a enum at some point
                System.Xml.XmlNode theElement = doc.SelectSingleNode("tracker/appslist/app[@btn='btnApp1']");
                strBtn1      = theElement.SelectSingleNode("@name").Value;
                strBtnValue1 = theElement.SelectSingleNode("@location").Value;

                System.Xml.XmlNode theElement2 = doc.SelectSingleNode("tracker/appslist/app[@btn='btnApp2']");
                strBtn2      = theElement2.SelectSingleNode("@name").Value;
                strBtnValue2 = theElement2.SelectSingleNode("@location").Value;

                System.Xml.XmlNode theElement3 = doc.SelectSingleNode("tracker/appslist/app[@btn='btnApp3']");
                strBtn3      = theElement3.SelectSingleNode("@name").Value;
                strBtnValue3 = theElement3.SelectSingleNode("@location").Value;

                System.Xml.XmlNode theElement4 = doc.SelectSingleNode("tracker/appslist/app[@btn='btnApp4']");
                strBtn4      = theElement4.SelectSingleNode("@name").Value;
                strBtnValue4 = theElement4.SelectSingleNode("@location").Value;

                System.Xml.XmlNode theElement5 = doc.SelectSingleNode("tracker/appslist/app[@btn='btnApp5']");
                strBtn5      = theElement5.SelectSingleNode("@name").Value;
                strBtnValue5 = theElement5.SelectSingleNode("@location").Value;

                System.Xml.XmlNode theElement6 = doc.SelectSingleNode("tracker/helpbutton/complocation");
                strCompLocationURL = theElement6.SelectSingleNode("@url").Value;

                System.Xml.XmlNode helpButtonElement = doc.SelectSingleNode("tracker/helpbutton/complocation");
                strCompLocationURL = helpButtonElement.SelectSingleNode("@url").Value;

                System.Xml.XmlNode roundsElement = doc.SelectSingleNode("tracker/config/rounds-on");
                boolRoundsOn = Convert.ToBoolean(roundsElement.SelectSingleNode("@truefalse").Value);

                System.Xml.XmlNode closingElement = doc.SelectSingleNode("tracker/config/closing-on");
                boolClosingOn = Convert.ToBoolean(roundsElement.SelectSingleNode("@truefalse").Value);
            }
            catch
            {
                MessageBox.Show("There was a problem loading-- " + strDataFile + " --please make sure it exists and is formatted properly", "Tracker");
            }
        }
 public PathInfo(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode typeNode = xmlNode.SelectSingleNode("type");
     
     if (typeNode != null)
     {
         if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null) 
         {
             if (typeNode.Attributes["id"] != null) 
             {
                 typeIDRef_ = typeNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(typeNode);
                 IDManager.SetID(typeIDRef_, ob);
             }
             else if (typeNode.Attributes["href"] != null)
             {
                 typeIDRef_ = typeNode.Attributes["href"].Value;
             }
             else
             {
                 type_ = new XsdTypeToken(typeNode);
             }
         }
         else
         {
             type_ = new XsdTypeToken(typeNode);
         }
     }
     
 
     XmlNode urlNode = xmlNode.SelectSingleNode("url");
     
     if (urlNode != null)
     {
         if (urlNode.Attributes["href"] != null || urlNode.Attributes["id"] != null) 
         {
             if (urlNode.Attributes["id"] != null) 
             {
                 urlIDRef_ = urlNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(urlNode);
                 IDManager.SetID(urlIDRef_, ob);
             }
             else if (urlNode.Attributes["href"] != null)
             {
                 urlIDRef_ = urlNode.Attributes["href"].Value;
             }
             else
             {
                 url_ = new XsdTypeToken(urlNode);
             }
         }
         else
         {
             url_ = new XsdTypeToken(urlNode);
         }
     }
     
 
 }
Пример #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serialCTNode"></param>
        /// <returns></returns>
        private static CommuniType CreateSerialSerialCommuniType(XmlNode serialCTNode)
        {
            if (serialCTNode == null)
            {
                throw new ArgumentNullException("serialCTNode");
            }

            XmlNode node = null;
            node = serialCTNode.SelectSingleNode(SerialCommuniTypeNodeNames.PortName);
            string portname = node.InnerText;

            node = serialCTNode.SelectSingleNode(SerialCommuniTypeNodeNames.BaudRate);
            int baudrate = int.Parse(node.InnerText );

            node = serialCTNode.SelectSingleNode(SerialCommuniTypeNodeNames.Parity);
            Parity parity = (Parity)Enum.Parse(typeof(Parity), node.InnerText);

            node = serialCTNode.SelectSingleNode(SerialCommuniTypeNodeNames.DataBits );
            int databits = int.Parse(node.InnerText);

            node = serialCTNode.SelectSingleNode(SerialCommuniTypeNodeNames.StopBits);
            StopBits stopbits = (StopBits)Enum.Parse(typeof(StopBits), node.InnerText);

            return new SerialCommuniType(portname, baudrate, parity, databits, stopbits);
        }
 public IndexChange(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode indexFactorNode = xmlNode.SelectSingleNode("indexFactor");
     
     if (indexFactorNode != null)
     {
         if (indexFactorNode.Attributes["href"] != null || indexFactorNode.Attributes["id"] != null) 
         {
             if (indexFactorNode.Attributes["id"] != null) 
             {
                 indexFactorIDRef_ = indexFactorNode.Attributes["id"].Value;
                 XsdTypeDecimal ob = new XsdTypeDecimal(indexFactorNode);
                 IDManager.SetID(indexFactorIDRef_, ob);
             }
             else if (indexFactorNode.Attributes["href"] != null)
             {
                 indexFactorIDRef_ = indexFactorNode.Attributes["href"].Value;
             }
             else
             {
                 indexFactor_ = new XsdTypeDecimal(indexFactorNode);
             }
         }
         else
         {
             indexFactor_ = new XsdTypeDecimal(indexFactorNode);
         }
     }
     
 
     XmlNode factoredCalculationAmountNode = xmlNode.SelectSingleNode("factoredCalculationAmount");
     
     if (factoredCalculationAmountNode != null)
     {
         if (factoredCalculationAmountNode.Attributes["href"] != null || factoredCalculationAmountNode.Attributes["id"] != null) 
         {
             if (factoredCalculationAmountNode.Attributes["id"] != null) 
             {
                 factoredCalculationAmountIDRef_ = factoredCalculationAmountNode.Attributes["id"].Value;
                 Money ob = new Money(factoredCalculationAmountNode);
                 IDManager.SetID(factoredCalculationAmountIDRef_, ob);
             }
             else if (factoredCalculationAmountNode.Attributes["href"] != null)
             {
                 factoredCalculationAmountIDRef_ = factoredCalculationAmountNode.Attributes["href"].Value;
             }
             else
             {
                 factoredCalculationAmount_ = new Money(factoredCalculationAmountNode);
             }
         }
         else
         {
             factoredCalculationAmount_ = new Money(factoredCalculationAmountNode);
         }
     }
     
 
 }
 public ReferenceEntity(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode entityNameNode = xmlNode.SelectSingleNode("entityName");
     
     if (entityNameNode != null)
     {
         if (entityNameNode.Attributes["href"] != null || entityNameNode.Attributes["id"] != null) 
         {
             if (entityNameNode.Attributes["id"] != null) 
             {
                 entityNameIDRef_ = entityNameNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(entityNameNode);
                 IDManager.SetID(entityNameIDRef_, ob);
             }
             else if (entityNameNode.Attributes["href"] != null)
             {
                 entityNameIDRef_ = entityNameNode.Attributes["href"].Value;
             }
             else
             {
                 entityName_ = new XsdTypeToken(entityNameNode);
             }
         }
         else
         {
             entityName_ = new XsdTypeToken(entityNameNode);
         }
     }
     
 
     XmlNode entityIdNode = xmlNode.SelectSingleNode("entityId");
     
     if (entityIdNode != null)
     {
         if (entityIdNode.Attributes["href"] != null || entityIdNode.Attributes["id"] != null) 
         {
             if (entityIdNode.Attributes["id"] != null) 
             {
                 entityIdIDRef_ = entityIdNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(entityIdNode);
                 IDManager.SetID(entityIdIDRef_, ob);
             }
             else if (entityIdNode.Attributes["href"] != null)
             {
                 entityIdIDRef_ = entityIdNode.Attributes["href"].Value;
             }
             else
             {
                 entityId_ = new XsdTypeToken(entityIdNode);
             }
         }
         else
         {
             entityId_ = new XsdTypeToken(entityIdNode);
         }
     }
     
 
 }
Пример #10
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));
        }
Пример #11
0
 public void FromXML(XmlNode node)
 {
     XmlNode guidNode = node.SelectSingleNode("FileGuid");
     this.Guid = guidNode.InnerText;
     XmlNode nameNode = node.SelectSingleNode("FileName");
     this.FileName = nameNode.InnerText;
 }
 public DividendPeriodDividend(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode dividendNode = xmlNode.SelectSingleNode("dividend");
     
     if (dividendNode != null)
     {
         if (dividendNode.Attributes["href"] != null || dividendNode.Attributes["id"] != null) 
         {
             if (dividendNode.Attributes["id"] != null) 
             {
                 dividendIDRef_ = dividendNode.Attributes["id"].Value;
                 NonNegativeMoney ob = new NonNegativeMoney(dividendNode);
                 IDManager.SetID(dividendIDRef_, ob);
             }
             else if (dividendNode.Attributes["href"] != null)
             {
                 dividendIDRef_ = dividendNode.Attributes["href"].Value;
             }
             else
             {
                 dividend_ = new NonNegativeMoney(dividendNode);
             }
         }
         else
         {
             dividend_ = new NonNegativeMoney(dividendNode);
         }
     }
     
 
     XmlNode multiplierNode = xmlNode.SelectSingleNode("multiplier");
     
     if (multiplierNode != null)
     {
         if (multiplierNode.Attributes["href"] != null || multiplierNode.Attributes["id"] != null) 
         {
             if (multiplierNode.Attributes["id"] != null) 
             {
                 multiplierIDRef_ = multiplierNode.Attributes["id"].Value;
                 PositiveDecimal ob = new PositiveDecimal(multiplierNode);
                 IDManager.SetID(multiplierIDRef_, ob);
             }
             else if (multiplierNode.Attributes["href"] != null)
             {
                 multiplierIDRef_ = multiplierNode.Attributes["href"].Value;
             }
             else
             {
                 multiplier_ = new PositiveDecimal(multiplierNode);
             }
         }
         else
         {
             multiplier_ = new PositiveDecimal(multiplierNode);
         }
     }
     
 
 }
Пример #13
0
        public void FromXml(XmlNode node)
        {
            Id = Dml.Attribute(node, "Id", "");
            Name = Dml.Attribute(node, "Name", "");
            Text = Dml.Attribute(node, "Text", "");
            LibId = Dml.Attribute(node, "LibId", "");

            XmlNode temp = node.SelectSingleNode("Resource/Config");
            if (temp != null)
            {
                ConnectionString = temp.InnerText;
            }
            temp = node.SelectSingleNode("Resource/Uri");
            if (temp != null)
            {
                Uri = temp.InnerText;
            }
            temp = node.SelectSingleNode("Resource/User");
            if (temp != null)
            {
                User = temp.InnerText;
            }
            temp = node.SelectSingleNode("Resource/Password");
            if (temp != null)
            {
                Password = temp.InnerText;
            }
        }
Пример #14
0
		internal UserStatus(XmlNode node)
		{
			if( node == null ) 
				throw new ArgumentNullException("node");

			if( node.Attributes["id"] != null )
				_userId = node.Attributes["id"].Value;
			if( node.Attributes["nsid"] != null )
				_userId = node.Attributes["nsid"].Value;
			if( node.Attributes["ispro"] != null )
				_isPro = node.Attributes["ispro"].Value=="1";
			if( node.SelectSingleNode("username") != null )
				_username = node.SelectSingleNode("username").InnerText;
			XmlNode bandwidth = node.SelectSingleNode("bandwidth");
			if( bandwidth != null )
			{
				_bandwidthMax = Convert.ToInt64(bandwidth.Attributes["max"].Value);
				_bandwidthUsed = Convert.ToInt64(bandwidth.Attributes["used"].Value);
			}
			XmlNode filesize = node.SelectSingleNode("filesize");
			if( filesize != null )
			{
				_filesizeMax = Convert.ToInt64(filesize.Attributes["max"].Value);
			}
		}
        public XmlPageTemplateDefinition(System.Xml.XmlNode template)
        {
            Key       = template.Attributes["key"].Value;
            Height    = template.Attributes["height"].Value;
            Width     = template.Attributes["width"].Value;
            Colortype = template.Attributes["colortype"].Value;
            if (template.Attributes["bleeding"] != null)
            {
                Bleeding = template.Attributes["bleeding"].Value;
            }

            XmlNode dynamicXmlContentNode = template.SelectSingleNode("dynamicContent");
            XmlNode staticContentNode     = template.SelectSingleNode("staticContent");

            if (staticContentNode != null)
            {
                XmlStaticContent = new XmlContent(staticContentNode);
            }

            if (dynamicXmlContentNode != null)
            {
                XmlDynamicContent = new XmlContent(dynamicXmlContentNode);
            }

            XmlLayout = new XmlLayoutDefinition(template.SelectSingleNode("layout"));
        }
Пример #16
0
 public EmailTemplate(XmlNode rootNode)
 {
     XmlNode namedItem = rootNode.Attributes.GetNamedItem("priority");
     MailPriority mailPriority;
     if (namedItem != null && System.Enum.TryParse<MailPriority>(namedItem.InnerText, out mailPriority))
     {
         this.priority = mailPriority;
     }
     namedItem = rootNode.Attributes.GetNamedItem("templateName");
     if (namedItem != null)
     {
         this.templateName = namedItem.InnerText;
     }
     XmlNode xmlNode = rootNode.SelectSingleNode("subject");
     if (xmlNode != null)
     {
         this.subject = xmlNode.InnerText;
     }
     XmlNode xmlNode2 = rootNode.SelectSingleNode("from");
     if (xmlNode2 != null)
     {
         this.From = xmlNode2.InnerText;
     }
     XmlNode xmlNode3 = rootNode.SelectSingleNode("body");
     if (xmlNode3 != null)
     {
         namedItem = xmlNode3.Attributes.GetNamedItem("url");
         if (namedItem != null)
         {
             this.BodyUrl = namedItem.InnerText;
             return;
         }
         this.Body = xmlNode3.InnerXml;
     }
 }
Пример #17
0
        /// <summary />
        public static string GetNodeValue(this System.Xml.XmlNode element, string XPath, XmlNamespaceManager nsManager, string defaultValue)
        {
            try
            {
                XmlNode node = null;
                if (nsManager == null)
                {
                    node = element.SelectSingleNode(XPath);
                }
                else
                {
                    node = element.SelectSingleNode(XPath, nsManager);
                }

                if (node == null)
                {
                    return(defaultValue);
                }
                else
                {
                    return(node.InnerText);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #18
0
		internal GroupFullInfo(XmlNode node)
		{
			if( node.Attributes.GetNamedItem("id") != null )
				GroupId = node.Attributes.GetNamedItem("id").Value;
			if( node.SelectSingleNode("name") != null )
				GroupName = node.SelectSingleNode("name").InnerText;
			if( node.SelectSingleNode("description") != null )
				Description = node.SelectSingleNode("description").InnerXml;
			if( node.SelectSingleNode("members") != null )
				Members = int.Parse(node.SelectSingleNode("members").InnerText);
			if( node.SelectSingleNode("privacy") != null )
				Privacy = (PoolPrivacy)int.Parse(node.SelectSingleNode("privacy").InnerText);

			if( node.SelectSingleNode("throttle") != null )
			{
				XmlNode throttle = node.SelectSingleNode("throttle");
				ThrottleInfo = new GroupThrottleInfo();
				if( throttle.Attributes.GetNamedItem("count") != null )
					ThrottleInfo.Count = int.Parse(throttle.Attributes.GetNamedItem("count").Value);
				if( throttle.Attributes.GetNamedItem("mode") != null )
					ThrottleInfo.setMode(throttle.Attributes.GetNamedItem("mode").Value);
				if( throttle.Attributes.GetNamedItem("remaining") != null )
					ThrottleInfo.Remaining = int.Parse(throttle.Attributes.GetNamedItem("remaining").Value);
			}
		}
        private void ProcessCodeGroupNode(XmlNode node)
        {
            try
            {
                if (node.Name == CodeGroup.CodeGroupKey)
                {
                    XmlNode codeGroupTypeNode = node.SelectSingleNode(CodeGroup.CodeGroupTypeKey);
                    if (codeGroupTypeNode == null)
                    {
                        throw new ArgumentException(
                                  "Current Configuration is out of date, please press the Reset button.");
                    }

                    XmlNode textNode    = node.SelectSingleNode(CodeGroup.DisplayTextKey);
                    XmlNode commentNode = node.SelectSingleNode(CodeGroup.CommentKey);

                    string text    = textNode != null ? textNode.InnerText : string.Empty;
                    string comment = commentNode != null ? commentNode.InnerText : string.Empty;

                    if (codeGroupTypeNode.InnerText == RegexCodeGroup.RegexKey)
                    {
                        RegisterRegexCodeGroup(node, text, comment);
                    }
                    else if (codeGroupTypeNode.InnerText == ElementTypeCodeGroup.ElementTypeName)
                    {
                        DecomposeElementTypeNodeAndRegister(node, text, comment);
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.HandleException(ex);
            }
        }
Пример #20
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, XmlNode section)
        {
            var config = new SiteConfig();
            var dynamicDiscoveryNode = section.SelectSingleNode("DynamicDiscovery");
            if (dynamicDiscoveryNode != null && dynamicDiscoveryNode.Attributes != null)
            {
                var attribute = dynamicDiscoveryNode.Attributes["Enabled"];
                if (attribute != null)
                    config.DynamicDiscovery = Convert.ToBoolean(attribute.Value);
            }

            var engineNode = section.SelectSingleNode("Engine");
            if (engineNode != null && engineNode.Attributes != null)
            {
                var attribute = engineNode.Attributes["Type"];
                if (attribute != null)
                    config.EngineType = attribute.Value;
            }

            var themeNode = section.SelectSingleNode("Themes");
            if (themeNode != null && themeNode.Attributes != null)
            {
                var attribute = themeNode.Attributes["basePath"];
                if (attribute != null)
                    config.ThemeBasePath = attribute.Value;
            }

            return config;
        }
        internal static void SetTitleOnImage(XmlNode xmlNode, Image image)
        {
            var copyright = xmlNode.SelectSingleNode("copyright").InnerText;
            var title = copyright;
            var author = string.Empty;
            if (copyright.Contains("©"))
            {
                var copySymbolPosition = copyright.LastIndexOf("©");
                title = copyright.Substring(0, copySymbolPosition - 1).Trim();
                var endOfCopyright = copyright.LastIndexOf(")") - copySymbolPosition - 1;
                if (endOfCopyright == -1)
                {
                    author = copyright.Substring(copySymbolPosition + 1).Trim();
                }
                else
                {
                    author = copyright.Substring(copySymbolPosition + 1, endOfCopyright).Trim();
                }
            }

            SetPropertyItemString(image, ImageMetadataPropertyId.Title, title);
            SetPropertyItemString(image, ImageMetadataPropertyId.Author, author);
            SetPropertyItemString(image, ImageMetadataPropertyId.Comment, $"Bing Image For {xmlNode.SelectSingleNode("startdate").InnerText}-{xmlNode.SelectSingleNode("enddate").InnerText}");
            SetPropertyItemString(image, ImageMetadataPropertyId.Keywords, DateTime.Now.ToShortDateString());
        }
 public Excel_fxForward(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode excel_issueInfoNode = xmlNode.SelectSingleNode("excel_issueInfo");
     
     if (excel_issueInfoNode != null)
     {
         if (excel_issueInfoNode.Attributes["href"] != null || excel_issueInfoNode.Attributes["id"] != null) 
         {
             if (excel_issueInfoNode.Attributes["id"] != null) 
             {
                 excel_issueInfoIDRef_ = excel_issueInfoNode.Attributes["id"].Value;
                 Excel_issueInfo ob = new Excel_issueInfo(excel_issueInfoNode);
                 IDManager.SetID(excel_issueInfoIDRef_, ob);
             }
             else if (excel_issueInfoNode.Attributes["href"] != null)
             {
                 excel_issueInfoIDRef_ = excel_issueInfoNode.Attributes["href"].Value;
             }
             else
             {
                 excel_issueInfo_ = new Excel_issueInfo(excel_issueInfoNode);
             }
         }
         else
         {
             excel_issueInfo_ = new Excel_issueInfo(excel_issueInfoNode);
         }
     }
     
 
     XmlNode fx_exchangeLegNode = xmlNode.SelectSingleNode("fx_exchangeLeg");
     
     if (fx_exchangeLegNode != null)
     {
         if (fx_exchangeLegNode.Attributes["href"] != null || fx_exchangeLegNode.Attributes["id"] != null) 
         {
             if (fx_exchangeLegNode.Attributes["id"] != null) 
             {
                 fx_exchangeLegIDRef_ = fx_exchangeLegNode.Attributes["id"].Value;
                 Fx_exchangeLeg ob = new Fx_exchangeLeg(fx_exchangeLegNode);
                 IDManager.SetID(fx_exchangeLegIDRef_, ob);
             }
             else if (fx_exchangeLegNode.Attributes["href"] != null)
             {
                 fx_exchangeLegIDRef_ = fx_exchangeLegNode.Attributes["href"].Value;
             }
             else
             {
                 fx_exchangeLeg_ = new Fx_exchangeLeg(fx_exchangeLegNode);
             }
         }
         else
         {
             fx_exchangeLeg_ = new Fx_exchangeLeg(fx_exchangeLegNode);
         }
     }
     
 
 }
 public RateCouponCalculation(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode typeNode = xmlNode.SelectSingleNode("type");
     
     if (typeNode != null)
     {
         if (typeNode.Attributes["href"] != null || typeNode.Attributes["id"] != null) 
         {
             if (typeNode.Attributes["id"] != null) 
             {
                 typeIDRef_ = typeNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(typeNode);
                 IDManager.SetID(typeIDRef_, ob);
             }
             else if (typeNode.Attributes["href"] != null)
             {
                 typeIDRef_ = typeNode.Attributes["href"].Value;
             }
             else
             {
                 type_ = new XsdTypeToken(typeNode);
             }
         }
         else
         {
             type_ = new XsdTypeToken(typeNode);
         }
     }
     
 
     XmlNode fixedRateCouponCalculationNode = xmlNode.SelectSingleNode("fixedRateCouponCalculation");
     
     if (fixedRateCouponCalculationNode != null)
     {
         if (fixedRateCouponCalculationNode.Attributes["href"] != null || fixedRateCouponCalculationNode.Attributes["id"] != null) 
         {
             if (fixedRateCouponCalculationNode.Attributes["id"] != null) 
             {
                 fixedRateCouponCalculationIDRef_ = fixedRateCouponCalculationNode.Attributes["id"].Value;
                 FixedRateCouponCalculation ob = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
                 IDManager.SetID(fixedRateCouponCalculationIDRef_, ob);
             }
             else if (fixedRateCouponCalculationNode.Attributes["href"] != null)
             {
                 fixedRateCouponCalculationIDRef_ = fixedRateCouponCalculationNode.Attributes["href"].Value;
             }
             else
             {
                 fixedRateCouponCalculation_ = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
             }
         }
         else
         {
             fixedRateCouponCalculation_ = new FixedRateCouponCalculation(fixedRateCouponCalculationNode);
         }
     }
     
 
 }
 public ReferenceEntityInfo(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode curveListNode = xmlNode.SelectSingleNode("curveList");
     
     if (curveListNode != null)
     {
         if (curveListNode.Attributes["href"] != null || curveListNode.Attributes["id"] != null) 
         {
             if (curveListNode.Attributes["id"] != null) 
             {
                 curveListIDRef_ = curveListNode.Attributes["id"].Value;
                 CurveList ob = new CurveList(curveListNode);
                 IDManager.SetID(curveListIDRef_, ob);
             }
             else if (curveListNode.Attributes["href"] != null)
             {
                 curveListIDRef_ = curveListNode.Attributes["href"].Value;
             }
             else
             {
                 curveList_ = new CurveList(curveListNode);
             }
         }
         else
         {
             curveList_ = new CurveList(curveListNode);
         }
     }
     
 
     XmlNode jointProbabilityTraitNode = xmlNode.SelectSingleNode("jointProbabilityTrait");
     
     if (jointProbabilityTraitNode != null)
     {
         if (jointProbabilityTraitNode.Attributes["href"] != null || jointProbabilityTraitNode.Attributes["id"] != null) 
         {
             if (jointProbabilityTraitNode.Attributes["id"] != null) 
             {
                 jointProbabilityTraitIDRef_ = jointProbabilityTraitNode.Attributes["id"].Value;
                 JointProbabilityTrait ob = new JointProbabilityTrait(jointProbabilityTraitNode);
                 IDManager.SetID(jointProbabilityTraitIDRef_, ob);
             }
             else if (jointProbabilityTraitNode.Attributes["href"] != null)
             {
                 jointProbabilityTraitIDRef_ = jointProbabilityTraitNode.Attributes["href"].Value;
             }
             else
             {
                 jointProbabilityTrait_ = new JointProbabilityTrait(jointProbabilityTraitNode);
             }
         }
         else
         {
             jointProbabilityTrait_ = new JointProbabilityTrait(jointProbabilityTraitNode);
         }
     }
     
 
 }
 public PreDefinedVariableInfo(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode refInstanceNameNode = xmlNode.SelectSingleNode("refInstanceName");
     
     if (refInstanceNameNode != null)
     {
         if (refInstanceNameNode.Attributes["href"] != null || refInstanceNameNode.Attributes["id"] != null) 
         {
             if (refInstanceNameNode.Attributes["id"] != null) 
             {
                 refInstanceNameIDRef_ = refInstanceNameNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(refInstanceNameNode);
                 IDManager.SetID(refInstanceNameIDRef_, ob);
             }
             else if (refInstanceNameNode.Attributes["href"] != null)
             {
                 refInstanceNameIDRef_ = refInstanceNameNode.Attributes["href"].Value;
             }
             else
             {
                 refInstanceName_ = new XsdTypeToken(refInstanceNameNode);
             }
         }
         else
         {
             refInstanceName_ = new XsdTypeToken(refInstanceNameNode);
         }
     }
     
 
     XmlNode fixingInformationNode = xmlNode.SelectSingleNode("fixingInformation");
     
     if (fixingInformationNode != null)
     {
         if (fixingInformationNode.Attributes["href"] != null || fixingInformationNode.Attributes["id"] != null) 
         {
             if (fixingInformationNode.Attributes["id"] != null) 
             {
                 fixingInformationIDRef_ = fixingInformationNode.Attributes["id"].Value;
                 FixingInformation ob = new FixingInformation(fixingInformationNode);
                 IDManager.SetID(fixingInformationIDRef_, ob);
             }
             else if (fixingInformationNode.Attributes["href"] != null)
             {
                 fixingInformationIDRef_ = fixingInformationNode.Attributes["href"].Value;
             }
             else
             {
                 fixingInformation_ = new FixingInformation(fixingInformationNode);
             }
         }
         else
         {
             fixingInformation_ = new FixingInformation(fixingInformationNode);
         }
     }
     
 
 }
 public ForwardModel(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode tenorNode = xmlNode.SelectSingleNode("tenor");
     
     if (tenorNode != null)
     {
         if (tenorNode.Attributes["href"] != null || tenorNode.Attributes["id"] != null) 
         {
             if (tenorNode.Attributes["id"] != null) 
             {
                 tenorIDRef_ = tenorNode.Attributes["id"].Value;
                 Tenor ob = new Tenor(tenorNode);
                 IDManager.SetID(tenorIDRef_, ob);
             }
             else if (tenorNode.Attributes["href"] != null)
             {
                 tenorIDRef_ = tenorNode.Attributes["href"].Value;
             }
             else
             {
                 tenor_ = new Tenor(tenorNode);
             }
         }
         else
         {
             tenor_ = new Tenor(tenorNode);
         }
     }
     
 
     XmlNode fittingYieldCurveNode = xmlNode.SelectSingleNode("fittingYieldCurve");
     
     if (fittingYieldCurveNode != null)
     {
         if (fittingYieldCurveNode.Attributes["href"] != null || fittingYieldCurveNode.Attributes["id"] != null) 
         {
             if (fittingYieldCurveNode.Attributes["id"] != null) 
             {
                 fittingYieldCurveIDRef_ = fittingYieldCurveNode.Attributes["id"].Value;
                 FittingYieldCurve ob = new FittingYieldCurve(fittingYieldCurveNode);
                 IDManager.SetID(fittingYieldCurveIDRef_, ob);
             }
             else if (fittingYieldCurveNode.Attributes["href"] != null)
             {
                 fittingYieldCurveIDRef_ = fittingYieldCurveNode.Attributes["href"].Value;
             }
             else
             {
                 fittingYieldCurve_ = new FittingYieldCurve(fittingYieldCurveNode);
             }
         }
         else
         {
             fittingYieldCurve_ = new FittingYieldCurve(fittingYieldCurveNode);
         }
     }
     
 
 }
Пример #27
0
        public override void Initialize(System.Xml.XmlNode input)
        {
            if (input == null)
            {
                return;
            }

            XmlNode node = input.SelectSingleNode(NodeNames.LABEL_LIST);

            this.Labels = new Labels();
            this.Labels.Initialize(node);

            XmlNode subcolumns = input.SelectSingleNode(NodeNames.SUBCOLUM_LIST);

            SubColumns = new List <Column>();
            if (subcolumns != null)
            {
                foreach (XmlNode sbnode in subcolumns.ChildNodes)
                {
                    if (sbnode.Name != NodeNames.COLUMN)
                    {
                        continue;
                    }
                    Column c = new Column();
                    c.Initialize(sbnode);
                    SubColumns.Add(c);
                }
            }
        }
Пример #28
0
 internal ExcelFontXml(XmlNamespaceManager nsm, XmlNode topNode) :
     base(nsm, topNode)
 {
     _name = GetXmlNodeString(namePath);
     _size = (float)GetXmlNodeDecimal(sizePath);
     _family = GetXmlNodeInt(familyPath);
     _scheme = GetXmlNodeString(schemePath);
     _color = new ExcelColorXml(nsm, topNode.SelectSingleNode(_colorPath, nsm));
     _bold = (topNode.SelectSingleNode(boldPath, NameSpaceManager) != null);
     _italic = (topNode.SelectSingleNode(italicPath, NameSpaceManager) != null);
     _strike = (topNode.SelectSingleNode(strikePath, NameSpaceManager) != null);
     _verticalAlign = GetXmlNodeString(verticalAlignPath);
     if (topNode.SelectSingleNode(underLinedPath, NameSpaceManager) != null)
     {
         string ut = GetXmlNodeString(underLinedPath + "/@val");
         if (ut == "")
         {
             _underlineType = ExcelUnderLineType.Single;
         }
         else
         {
             _underlineType = (ExcelUnderLineType)Enum.Parse(typeof(ExcelUnderLineType), ut, true);
         }
     }
     else
     {
         _underlineType = ExcelUnderLineType.None;
     }
 }
Пример #29
0
        public IList<XmlNode> CompileModelsFromScene( XmlNode xmlNode )
        {
            IList< XmlNode > models = new List<XmlNode>( );

            var entitiesNode = xmlNode.SelectSingleNode( "/scene/nodes" );

            if ( entitiesNode != null )
            {
                foreach ( XmlNode entity in entitiesNode.ChildNodes )
                {
                    var userDataNode = xmlNode.SelectSingleNode( ".//userData" );

                    if( userDataNode != null )
                    {
                        userDataNode.ParentNode.RemoveChild( userDataNode );
                    }

                    var modelFile = new XmlDocument( );
                    var modelNode = modelFile.ImportNode( entity, true );
                    modelFile.AppendChild( modelNode );

                    models.Add( modelFile );
                }
            }

            return models;
        }
 public string ConvertFunctionNodeToMarkdown(XmlNode Node)
 {
     string Name = Node.SelectSingleNode("name").InnerText;
     string Type = ConvertToMarkdown(Node.SelectSingleNode("type"));
     string Args = ConvertToMarkdown(Node.SelectSingleNode("argsstring"));
     return Utility.IsNullOrWhitespace(Type)? (Name + Args + ";") : (Type + Name + Args + ";");
 }
Пример #31
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);
		}
Пример #32
0
        public override void Load(System.Xml.XmlNode element)
        {
            base.Load(element);

            // Load text
            XmlNode node = element.SelectSingleNode("Text");

            if (node != null)
            {
                this.Text = node.Attributes["Value"].Value;
            }


            // Load formula
            node = element.SelectSingleNode("Formula");
            if (node != null)
            {
                this.Formula = node.Attributes["Value"].Value;
            }

            // Load formula format
            node = element.SelectSingleNode("FormulaFormat");
            if (node != null)
            {
                this.FormulaFormat = node.Attributes["Value"].Value;
            }
        }
Пример #33
0
        /// <summary>
        ///
        /// </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)
        {
            ConfigInfo configInfo = new ConfigInfo();
            XmlNode    aNode      = section.SelectSingleNode("Authorization");

            configInfo.AuthorizationServiceProvider = GetServiceProvider(aNode);


            aNode = section.SelectSingleNode("Authenticate");
            configInfo.AuthenticateServiceProvider = GetServiceProvider(aNode);

            XmlNode propertiesNode = section.SelectSingleNode("Properties");

            if (propertiesNode != null && propertiesNode.ChildNodes != null && propertiesNode.ChildNodes.Count > 0)
            {
                foreach (XmlNode prop in propertiesNode.ChildNodes)
                {
                    if (prop.Attributes["name"] != null && prop.Attributes["value"] != null)
                    {
                        configInfo.AddProperty(prop.Attributes["name"].Value, prop.Attributes["value"].Value);
                    }
                }
            }
            return(configInfo);
        }
 public FxRateAsset(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode quotedCurrencyPairNode = xmlNode.SelectSingleNode("quotedCurrencyPair");
     
     if (quotedCurrencyPairNode != null)
     {
         if (quotedCurrencyPairNode.Attributes["href"] != null || quotedCurrencyPairNode.Attributes["id"] != null) 
         {
             if (quotedCurrencyPairNode.Attributes["id"] != null) 
             {
                 quotedCurrencyPairIDRef_ = quotedCurrencyPairNode.Attributes["id"].Value;
                 QuotedCurrencyPair ob = new QuotedCurrencyPair(quotedCurrencyPairNode);
                 IDManager.SetID(quotedCurrencyPairIDRef_, ob);
             }
             else if (quotedCurrencyPairNode.Attributes["href"] != null)
             {
                 quotedCurrencyPairIDRef_ = quotedCurrencyPairNode.Attributes["href"].Value;
             }
             else
             {
                 quotedCurrencyPair_ = new QuotedCurrencyPair(quotedCurrencyPairNode);
             }
         }
         else
         {
             quotedCurrencyPair_ = new QuotedCurrencyPair(quotedCurrencyPairNode);
         }
     }
     
 
     XmlNode rateSourceNode = xmlNode.SelectSingleNode("rateSource");
     
     if (rateSourceNode != null)
     {
         if (rateSourceNode.Attributes["href"] != null || rateSourceNode.Attributes["id"] != null) 
         {
             if (rateSourceNode.Attributes["id"] != null) 
             {
                 rateSourceIDRef_ = rateSourceNode.Attributes["id"].Value;
                 FxSpotRateSource ob = new FxSpotRateSource(rateSourceNode);
                 IDManager.SetID(rateSourceIDRef_, ob);
             }
             else if (rateSourceNode.Attributes["href"] != null)
             {
                 rateSourceIDRef_ = rateSourceNode.Attributes["href"].Value;
             }
             else
             {
                 rateSource_ = new FxSpotRateSource(rateSourceNode);
             }
         }
         else
         {
             rateSource_ = new FxSpotRateSource(rateSourceNode);
         }
     }
     
 
 }
 public RedemptionNotionalTrigger(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode payoffDateInfoNode = xmlNode.SelectSingleNode("payoffDateInfo");
     
     if (payoffDateInfoNode != null)
     {
         if (payoffDateInfoNode.Attributes["href"] != null || payoffDateInfoNode.Attributes["id"] != null) 
         {
             if (payoffDateInfoNode.Attributes["id"] != null) 
             {
                 payoffDateInfoIDRef_ = payoffDateInfoNode.Attributes["id"].Value;
                 PayoffDateInfo ob = new PayoffDateInfo(payoffDateInfoNode);
                 IDManager.SetID(payoffDateInfoIDRef_, ob);
             }
             else if (payoffDateInfoNode.Attributes["href"] != null)
             {
                 payoffDateInfoIDRef_ = payoffDateInfoNode.Attributes["href"].Value;
             }
             else
             {
                 payoffDateInfo_ = new PayoffDateInfo(payoffDateInfoNode);
             }
         }
         else
         {
             payoffDateInfo_ = new PayoffDateInfo(payoffDateInfoNode);
         }
     }
     
 
     XmlNode redemptionAmountNode = xmlNode.SelectSingleNode("redemptionAmount");
     
     if (redemptionAmountNode != null)
     {
         if (redemptionAmountNode.Attributes["href"] != null || redemptionAmountNode.Attributes["id"] != null) 
         {
             if (redemptionAmountNode.Attributes["id"] != null) 
             {
                 redemptionAmountIDRef_ = redemptionAmountNode.Attributes["id"].Value;
                 XsdTypeDouble ob = new XsdTypeDouble(redemptionAmountNode);
                 IDManager.SetID(redemptionAmountIDRef_, ob);
             }
             else if (redemptionAmountNode.Attributes["href"] != null)
             {
                 redemptionAmountIDRef_ = redemptionAmountNode.Attributes["href"].Value;
             }
             else
             {
                 redemptionAmount_ = new XsdTypeDouble(redemptionAmountNode);
             }
         }
         else
         {
             redemptionAmount_ = new XsdTypeDouble(redemptionAmountNode);
         }
     }
     
 
 }
 public YieldCurve(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode algorithmNode = xmlNode.SelectSingleNode("algorithm");
     
     if (algorithmNode != null)
     {
         if (algorithmNode.Attributes["href"] != null || algorithmNode.Attributes["id"] != null) 
         {
             if (algorithmNode.Attributes["id"] != null) 
             {
                 algorithmIDRef_ = algorithmNode.Attributes["id"].Value;
                 XsdTypeString ob = new XsdTypeString(algorithmNode);
                 IDManager.SetID(algorithmIDRef_, ob);
             }
             else if (algorithmNode.Attributes["href"] != null)
             {
                 algorithmIDRef_ = algorithmNode.Attributes["href"].Value;
             }
             else
             {
                 algorithm_ = new XsdTypeString(algorithmNode);
             }
         }
         else
         {
             algorithm_ = new XsdTypeString(algorithmNode);
         }
     }
     
 
     XmlNode forecastRateIndexNode = xmlNode.SelectSingleNode("forecastRateIndex");
     
     if (forecastRateIndexNode != null)
     {
         if (forecastRateIndexNode.Attributes["href"] != null || forecastRateIndexNode.Attributes["id"] != null) 
         {
             if (forecastRateIndexNode.Attributes["id"] != null) 
             {
                 forecastRateIndexIDRef_ = forecastRateIndexNode.Attributes["id"].Value;
                 ForecastRateIndex ob = new ForecastRateIndex(forecastRateIndexNode);
                 IDManager.SetID(forecastRateIndexIDRef_, ob);
             }
             else if (forecastRateIndexNode.Attributes["href"] != null)
             {
                 forecastRateIndexIDRef_ = forecastRateIndexNode.Attributes["href"].Value;
             }
             else
             {
                 forecastRateIndex_ = new ForecastRateIndex(forecastRateIndexNode);
             }
         }
         else
         {
             forecastRateIndex_ = new ForecastRateIndex(forecastRateIndexNode);
         }
     }
     
 
 }
        // Make sure the default company name and acronym are in the config file under system settings
        protected override void OnSystemSettingsLoaded(XmlDocument configurationFile, XmlNode systemSettingsNode)
        {
            XmlNode companyNameNode = systemSettingsNode.SelectSingleNode("add[@name = 'CompanyName']");
            XmlNode companyAcronymNode = systemSettingsNode.SelectSingleNode("add[@name = 'CompanyAcronym']");

            // Modify or add the CompanyName parameter.
            if (companyNameNode != null)
            {
                companyNameNode.Attributes["value"].Value = Context.Parameters["DP_CompanyName"];
            }
            else
            {
                companyNameNode = configurationFile.CreateNode(XmlNodeType.Element, "add", string.Empty);
                companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "name", "CompanyName"));
                companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "value", Context.Parameters["DP_CompanyName"]));
                companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "description", "The name of the company who owns this instance of the SIEGate."));
                companyNameNode.Attributes.Append(CreateAttribute(configurationFile, "encrypted", "false"));
                systemSettingsNode.AppendChild(companyNameNode);
            }

            // Modify or add the CompanyAcronym parameter.
            if (companyAcronymNode != null)
            {
                companyAcronymNode.Attributes["value"].Value = Context.Parameters["DP_CompanyAcronym"];
            }
            else
            {
                companyAcronymNode = configurationFile.CreateNode(XmlNodeType.Element, "add", string.Empty);
                companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "name", "CompanyAcronym"));
                companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "value", Context.Parameters["DP_CompanyAcronym"]));
                companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "description", "The acronym representing the company who owns this instance of the SIEGate."));
                companyAcronymNode.Attributes.Append(CreateAttribute(configurationFile, "encrypted", "false"));
                systemSettingsNode.AppendChild(companyAcronymNode);
            }
        }
        public void RunMockAssemblyTests()
        {
            ITestResult result = NUnit.TestUtilities.TestBuilder.RunTestFixture(typeof(MockTestFixture));

            Assert.NotNull(result);

            StringBuilder sb     = new StringBuilder();
            StringWriter  writer = new StringWriter(sb);

            new NUnit2XmlOutputWriter().WriteResultFile(result, writer);
            writer.Close();

#if DEBUG
            StreamWriter sw = new StreamWriter("MockAssemblyResult.xml");
            sw.WriteLine(sb.ToString());
            sw.Close();
#endif

            doc = new XmlDocument();
            doc.LoadXml(sb.ToString());

            topNode = doc.SelectSingleNode("/test-results");
            if (topNode != null)
            {
                envNode     = topNode.SelectSingleNode("environment");
                cultureNode = topNode.SelectSingleNode("culture-info");
                suiteNode   = topNode.SelectSingleNode("test-suite");
            }
        }
 public ReportIdentification(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode numberOfSectionsNode = xmlNode.SelectSingleNode("numberOfSections");
     
     if (numberOfSectionsNode != null)
     {
         if (numberOfSectionsNode.Attributes["href"] != null || numberOfSectionsNode.Attributes["id"] != null) 
         {
             if (numberOfSectionsNode.Attributes["id"] != null) 
             {
                 numberOfSectionsIDRef_ = numberOfSectionsNode.Attributes["id"].Value;
                 XsdTypePositiveInteger ob = new XsdTypePositiveInteger(numberOfSectionsNode);
                 IDManager.SetID(numberOfSectionsIDRef_, ob);
             }
             else if (numberOfSectionsNode.Attributes["href"] != null)
             {
                 numberOfSectionsIDRef_ = numberOfSectionsNode.Attributes["href"].Value;
             }
             else
             {
                 numberOfSections_ = new XsdTypePositiveInteger(numberOfSectionsNode);
             }
         }
         else
         {
             numberOfSections_ = new XsdTypePositiveInteger(numberOfSectionsNode);
         }
     }
     
 
     XmlNode submissionsCompleteNode = xmlNode.SelectSingleNode("submissionsComplete");
     
     if (submissionsCompleteNode != null)
     {
         if (submissionsCompleteNode.Attributes["href"] != null || submissionsCompleteNode.Attributes["id"] != null) 
         {
             if (submissionsCompleteNode.Attributes["id"] != null) 
             {
                 submissionsCompleteIDRef_ = submissionsCompleteNode.Attributes["id"].Value;
                 XsdTypeBoolean ob = new XsdTypeBoolean(submissionsCompleteNode);
                 IDManager.SetID(submissionsCompleteIDRef_, ob);
             }
             else if (submissionsCompleteNode.Attributes["href"] != null)
             {
                 submissionsCompleteIDRef_ = submissionsCompleteNode.Attributes["href"].Value;
             }
             else
             {
                 submissionsComplete_ = new XsdTypeBoolean(submissionsCompleteNode);
             }
         }
         else
         {
             submissionsComplete_ = new XsdTypeBoolean(submissionsCompleteNode);
         }
     }
     
 
 }
Пример #40
0
        public override void LoadDataFromXmlNode(System.Xml.XmlNode node)
        {
            base.LoadDataFromXmlNode(node);

            try { this.language = node.SelectSingleNode("Language").InnerText; }
            catch { }
            try { this.location = node.SelectSingleNode("Location").InnerText; }
            catch { }
        }
Пример #41
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)
        {
            RegistryKey   rk      = null;
            SqlConnection conn    = null;
            SqlCommand    command = null;

            try
            {
                rk = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\BizTalk Server\\3.0\\Administration\\");
                string  dbname       = rk.GetValue("MgmtDBName").ToString();
                string  server       = rk.GetValue("MgmtDBServer").ToString();
                string  connection   = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";Integrated Security=SSPI;";
                XmlNode loginNode    = testConfig.SelectSingleNode("LoginId");
                XmlNode passwordNode = testConfig.SelectSingleNode("password");

                if (loginNode != null && passwordNode != null)
                {
                    connection = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";User Id=" + loginNode.InnerText + ";password="******";";
                }
                else if (loginNode != null && passwordNode == null)                //blank password !
                {
                    connection = "Initial Catalog=" + dbname + " ;Data Source=" + server + ";User Id=" + loginNode.InnerText + ";password="******";";
                }

                conn = new SqlConnection(connection);
                conn.Open();

                command            = new SqlCommand();
                command.Connection = conn;

                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "xref_Cleanup";

                command.ExecuteNonQuery();

                context.LogInfo("Cross reference tables were cleared.");
            }
            finally
            {
                if (rk != null)
                {
                    rk.Close();
                }

                if (command != null)
                {
                    command.Dispose();
                }

                if (null != conn && conn.State != ConnectionState.Closed)
                {
                    conn.Close();
                    conn.Dispose();
                }
            }
        }
Пример #42
0
        public override void Initialize(System.Xml.XmlNode input)
        {
            if (input == null)
            {
                return;
            }

            string grouping = input.Attributes[NodeNames.GROUPING] == null ? "list" : input.Attributes[NodeNames.GROUPING].Value;

            ShowHeader     = input.Attributes[NodeNames.SHOW_HEADER] != null && input.Attributes[NodeNames.SHOW_HEADER].Value == "yes";
            ShowGroupTotal = input.Attributes[NodeNames.SHOW_GROUP_TOTAL] != null && input.Attributes[NodeNames.SHOW_GROUP_TOTAL].Value == "yes";

            try
            {
                this.Grouping = (Grouping)Enum.Parse(typeof(Grouping), grouping);
            }
            catch
            {
                return;
            }
            switch (Grouping)
            {
            case Grouping.list:
                XmlNode list = input.SelectSingleNode(NodeNames.LIST);
                if (list == null)
                {
                    return;
                }
                listname     = list.Attributes[NodeNames.LIST_NAME] == null ? string.Empty : list.Attributes[NodeNames.LIST_NAME].Value;
                varname      = list.Attributes[NodeNames.VAR_NAME] == null ? string.Empty : list.Attributes[NodeNames.VAR_NAME].Value;
                this.Factors = list.Attributes[NodeNames.VAR_NAME] == null || list.Attributes[NodeNames.VAR_NAME].Value == "no" ? false : true;
                break;

            case Grouping.options:
                optionList = new List <OptionItem>();
                XmlNode optionnodeList = input.SelectSingleNode(NodeNames.OPTION_LIST);
                if (optionList == null)
                {
                    return;
                }

                foreach (XmlNode onode in optionnodeList.ChildNodes)
                {
                    if (onode.Name != NodeNames.OPTION)
                    {
                        continue;
                    }
                    OptionItem item = new OptionItem();
                    item.condition = onode.Attributes[NodeNames.OPTION_CONDITION] == null ? string.Empty :  onode.Attributes[NodeNames.OPTION_CONDITION].Value;
                    item.Text      = new ComplexText();
                    item.Text.Initialize(onode);
                    optionList.Add(item);
                }
                break;
            }
        }
Пример #43
0
        public int RestoreItem(string tempFolder, System.Xml.XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group)
        {
            if (itemType == typeof(SystemUser))
            {
                SharePointServer sps = GetSharePoint(serviceId);

                // extract meta item
                XmlSerializer serializer = new XmlSerializer(typeof(SystemUser));
                SystemUser    user       = (SystemUser)serializer.Deserialize(
                    new XmlNodeReader(itemNode.SelectSingleNode("SystemUser")));

                // create user if required
                if (!sps.UserExists(itemName))
                {
                    user.Password = CryptoUtils.Decrypt(user.Password);
                    sps.CreateUser(user);

                    // restore password
                    user.Password = CryptoUtils.Encrypt(user.Password);
                }

                // add meta-item if required
                if (PackageController.GetPackageItemByName(packageId, itemName, typeof(SystemUser)) == null)
                {
                    user.PackageId = packageId;
                    user.ServiceId = serviceId;
                    PackageController.AddPackageItem(user);
                }
            }
            else if (itemType == typeof(SystemGroup))
            {
                SharePointServer sps = GetSharePoint(serviceId);

                // extract meta item
                XmlSerializer serializer = new XmlSerializer(typeof(SystemGroup));
                SystemGroup   sysGroup   = (SystemGroup)serializer.Deserialize(
                    new XmlNodeReader(itemNode.SelectSingleNode("SystemGroup")));

                // create user if required
                if (!sps.GroupExists(itemName))
                {
                    sps.CreateGroup(sysGroup);
                }

                // add meta-item if required
                if (PackageController.GetPackageItemByName(packageId, itemName, typeof(SystemGroup)) == null)
                {
                    sysGroup.PackageId = packageId;
                    sysGroup.ServiceId = serviceId;
                    PackageController.AddPackageItem(sysGroup);
                }
            }

            return(0);
        }
Пример #44
0
        public void LoadFromXML(System.Xml.XmlNode node)
        {
            //以后要改成 Load出错时,提示信息更加人性化,如告诉用户那个 helpid 的 哪个节点读取出错

            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            //this.XmlNode = node;

            this.ID = node.GetAttrOrDefault("id", null);

            this.Remarks         = this.GetPropFromNode(node, "Remarks", string.Empty);
            this.Title           = this.GetPropFromNode(node, "Title", string.Empty);
            this.Icon            = this.GetPropFromNode(node, "Icon", string.Empty);
            this.CodeField       = this.GetPropFromNode(node, "CodeField", string.Empty);
            this.NameField       = this.GetPropFromNode(node, "NameField", string.Empty);
            this.SortField       = this.GetPropFromNode(node, "SortField", string.Empty);
            this.DataServiceName = this.GetPropFromNode(node, "DataService", string.Empty);
            this.SelectMode      = (SelectMode)Enum.Parse(typeof(SelectMode), this.GetPropFromNode(node, "SelectMode", "Default"), true);

            this.List = node.SelectSingleNode("List") ?? node.SelectSingleNode("TreeList");

            var treeNode = node.SelectSingleNode("Tree");

            if (treeNode != null)
            {
                this.Tree = new CommHelpTree(treeNode);
            }

            var queryNode = node.SelectSingleNode("Query");

            if (queryNode != null)
            {
                this.Query = new CommHelpQuery(queryNode);
            }

            if (this.List == null)
            {
                var allFieldNode = node.SelectSingleNode("AllField");

                if (allFieldNode != null)
                {
                    this.AllField    = allFieldNode.InnerXml.Split('|');
                    this.AllFieldKey = allFieldNode.GetAttrOrDefault("key", string.Empty);
                }
                else
                {
                    this.AllField    = new string[0];
                    this.AllFieldKey = string.Empty;
                }
            }
        }
Пример #45
0
        /* LOAD CONNECTIONSTRING AND ROOT DIR */
        public override void LoadSettings(System.Xml.XmlNode settingsXml)
        {
            if (settingsXml != null)
            {
                RootPath = Umbraco.Courier.Core.Helpers.Xml.GetNodeValue(settingsXml.SelectSingleNode("./path"));

                if (settingsXml.SelectSingleNode("./connectionstring") != null)
                {
                    DatabaseConnectionString = Umbraco.Courier.Core.Helpers.Xml.GetNodeValue(settingsXml.SelectSingleNode("./DatabaseConnectionString"));
                }
            }
        }
Пример #46
0
        public override void Initialize(System.Xml.XmlNode input)
        {
            this.ID = input.Attributes[NodeNames.ID] == null ? string.Empty : input.Attributes[NodeNames.ID].Value;
            XmlNode headernode = input.SelectSingleNode(NodeNames.TABLE_HEADER);

            this.Header.Initialize(headernode);

            XmlNode columnlist = input.SelectSingleNode(NodeNames.COLUMN_LIST);

            foreach (XmlNode node in columnlist.ChildNodes)
            {
                if (node.Name != NodeNames.COLUMN)
                {
                    continue;
                }
                Column c = new Column();
                c.Initialize(node);
                Columns.Add(c);
            }

            XmlNode rowlist = input.SelectSingleNode(NodeNames.ROW_LIST);

            foreach (XmlNode node in rowlist.ChildNodes)
            {
                if (node.Name != NodeNames.ROW)
                {
                    continue;
                }
                Row r = new Row();
                r.Initialize(node);
                if (r.Labels != null)//19Sep2013 corsstab "Count"
                {
                    Rows.Add(r);
                }
            }

            XmlNode footnotes = input.SelectSingleNode(NodeNames.FOOTNOTE_LIST);

            if (footnotes != null)
            {
                foreach (XmlNode node in footnotes.ChildNodes)
                {
                    if (node.Name != NodeNames.FOOTNOTE)
                    {
                        continue;
                    }
                    FootNote fn = new FootNote();
                    fn.Initialize(node);
                    FootNotes.Add(fn);
                }
            }
        }
Пример #47
0
        public override void LoadDataFromXmlNode(System.Xml.XmlNode node)
        {
            base.LoadDataFromXmlNode(node);

            try { this.url = node.SelectSingleNode("Url").InnerText; }
            catch { }
            try { this.webPageType = (WebPageType)Convert.ToInt32(node.SelectSingleNode("WPT").InnerText); }
            catch { }
            try { this.width = Convert.ToInt32(node.SelectSingleNode("WPW").InnerText); }
            catch { }
            try { this.height = Convert.ToInt32(node.SelectSingleNode("WPH").InnerText); }
            catch { }
        }
Пример #48
0
        /// <summary>
        /// Create the configuration section
        /// </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)
        {
            // Connection manager configuration
            XmlNode connectionManagerConfig = section.SelectSingleNode("./*[local-name() = 'connectionManager']");

            if (connectionManagerConfig == null)
            {
                throw new ConfigurationErrorsException("connection must be specified", section);
            }

            // Connection manager configuration
            if (connectionManagerConfig.Attributes["connection"] != null)
            {
                ConnectionStringSettings settings = ApplicationContext.Current.GetService <IConfigurationManager>().ConnectionStrings[connectionManagerConfig.Attributes["connection"].Value];
                if (settings == null)
                {
                    throw new ConfigurationErrorsException(String.Format("Cannot find the connection string '{0}'", connectionManagerConfig.Attributes["connection"].Value), connectionManagerConfig);
                }

                // Create the dbProvider and cstring
                m_connectionString = settings.ConnectionString;

                // get the type
                m_providerFactory = DbProviderFactories.GetFactory(settings.ProviderName);
                if (m_providerFactory == null)
                {
                    throw new ConfigurationErrorsException(String.Format("Can't find provider type '{0}'", settings.ProviderName), connectionManagerConfig);
                }
            }
            else
            {
                Trace.TraceError("Cannot determine the connection string settings");
                throw new ConfigurationErrorsException("Cannot determine the connection string to use", connectionManagerConfig);
            }

            // Maximum query age
            connectionManagerConfig = section.SelectSingleNode("./*[local-name() = 'limit']");
            if (connectionManagerConfig != null)
            {
                if (connectionManagerConfig.Attributes["maxAge"] != null)
                {
                    this.MaxQueryAge = Convert.ToInt32(connectionManagerConfig.Attributes["maxAge"].Value);
                }
                else
                {
                    this.MaxQueryAge = 30;
                }
            }

            return(this);
        }
Пример #49
0
 /// <summary>
 /// 获得皮肤
 /// </summary>
 void GetXmlSkin()
 {
     try
     {
         XmlDocument mydoc = new XmlDocument();
         mydoc.Load(XMLPath);
         System.Xml.XmlNode ressNode = mydoc.SelectSingleNode("SetSkin");
         defaultSkinName = ressNode.SelectSingleNode("Skinstring").InnerText;
         defaultRbStyle  = ressNode.SelectSingleNode("Stylestring").InnerText;
     }
     catch (Exception ex)
     {
         DevExpress.XtraEditors.XtraMessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #50
0
 internal static string getNodeText(System.Xml.XmlNode xmlNode, string nodeName)
 {
     if (xmlNode.SelectSingleNode(nodeName) == null)
     {
         return("");
     }
     else if (xmlNode.FirstChild.SelectSingleNode(nodeName) != null)
     {
         return(xmlNode.FirstChild.SelectSingleNode(nodeName).InnerText.Trim());
     }
     else
     {
         return(xmlNode.SelectSingleNode(nodeName).InnerText.Trim());
     }
 }
Пример #51
0
        public void Extract(System.Xml.XmlNode node)
        {
            Description = node.SelectSingleNode("//description").InnerText;

            XmlNode utilityNode = node.SelectSingleNode("//utility_space");

            Options = new NegotiationDescription <NegotiationTopic <NegotiationOption>, NegotiationOption>();
            Options.Extract(utilityNode.SelectSingleNode("//objective"));

            OwnerVariantDict = utilityNode.SelectNodes("//agent").Cast <XmlNode>().Select(x => new
            {
                Owner       = x.Attributes["owner"].Value,
                Description = ExtractVariant(x),
                Name        = x.Attributes["personality"].Value
            }).GroupBy(x => x.Owner).ToDictionary(x => x.Key, x => x.ToDictionary(y => y.Name, y => y.Description));
        }
Пример #52
0
 public bool DisableRewriter(string configPath)
 {
     try
     {
         XmlDocument xDoc = new XmlDocument();
         xDoc.Load(configPath);
         if (xDoc != null)
         {
             System.Xml.XmlNode xRoot = xDoc.DocumentElement;
             System.Xml.XmlNode xNode = xRoot.SelectSingleNode("//system.webServer/modules");
             if (xNode != null)
             {
                 bool isInstalled = false;
                 foreach (XmlNode n in xNode.ChildNodes)
                 {
                     if (n.Attributes["name"].Value == "ForumsReWriter")
                     {
                         xNode.RemoveChild(n);
                         isInstalled = true;
                         break;
                     }
                 }
                 if (isInstalled)
                 {
                     xDoc.Save(configPath);
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #53
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String adName   = Request.QueryString["ad"];
        String redirect = Request.QueryString["target"];

        if (adName == null | redirect == null)
        {
            redirect = "AdRedirection.aspx";
        }

        XmlDocument doc = new XmlDocument();

        doc.Load(Server.MapPath("AdResponses.xml"));
        System.Xml.XmlNode root   = doc.DocumentElement;
        System.Xml.XmlNode adNode =
            root.SelectSingleNode(
                @"descendant::ad[@adname='" + adName + "']");
        if (adNode != null)
        {
            int ctr =
                int.Parse(adNode.Attributes["hitCount"].Value);
            ctr += 1;
            System.Xml.XmlNode newAdNode = adNode.CloneNode(false);
            newAdNode.Attributes["hitCount"].Value = ctr.ToString();
            root.ReplaceChild(newAdNode, adNode);
            doc.Save(Server.MapPath("AdResponses.xml"));
        }
        Response.Redirect(redirect);
    }
Пример #54
0
        public IConfigurationSettingItem Parse(System.Xml.XmlNode section)
        {
            var setting = new RedisCacheSetting();

            setting.Name      = section.GetAttributeValue("name");
            setting.CacheType = Type.GetType(section.GetAttributeValue("type"), false, true);
            var configNode = section.SelectSingleNode("config");

            if (configNode != null)
            {
                var serializerType = configNode.GetAttributeValue("serializerType");
                if (!string.IsNullOrEmpty(serializerType))
                {
                    setting.SerializerType = serializerType.ParseType();
                }

                setting.MaxReadPoolSize  = configNode.GetAttributeValue("maxReadPoolSize", 5);
                setting.MaxWritePoolSize = configNode.GetAttributeValue("maxWritePoolSize", 5);
                setting.DefaultDb        = configNode.GetAttributeValue("defaultDb", 0);
                setting.Password         = configNode.GetAttributeValue("password");

                foreach (XmlNode nd in configNode.SelectNodes("host"))
                {
                    var host = new RedisCacheHost();
                    host.Server   = nd.GetAttributeValue("server");
                    host.Port     = nd.GetAttributeValue("port", 0);
                    host.ReadOnly = nd.GetAttributeValue("readonly", false);

                    setting.Hosts.Add(host);
                }
            }

            return(setting);
        }
        /// <summary>
        /// Create the configuration section
        /// </summary>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            this.MessageHandlers = new List <IMessageHandlerService>();

            // get the handler
            XmlElement addNodes = section.SelectSingleNode(".//*[local-name() = 'handlers']") as XmlElement;

            foreach (XmlElement nd in addNodes.ChildNodes)
            {
                if (nd.Attributes["type"] != null)
                {
                    Type t = Type.GetType(nd.Attributes["type"].Value);
                    if (t != null)
                    {
                        ConstructorInfo ci = t.GetConstructor(Type.EmptyTypes);
                        if (ci != null)
                        {
                            this.MessageHandlers.Add(ci.Invoke(null) as IMessageHandlerService);
                            Trace.TraceInformation("Added message handler {0}", t.FullName);
                        }
                        else
                        {
                            Trace.TraceWarning("Can't find parameterless constructor on type {0}", t.FullName);
                        }
                    }
                    else
                    {
                        Trace.TraceWarning("Can't find type described by '{0}'", nd.Attributes["type"].Value);
                    }
                }
            }

            return(this);
        }
Пример #56
0
    public static void WriteHelpExtension(string Name, Pix PixSource, Pix PixTarget, string[] Line1, Languages Lang = Languages.vbnet)
    {
        if (PixSource != null)
        {
            PixSource.WriteJpeg("..\\..\\ALL_Help\\HelpImages\\" + Name + "_S.jpg", 75, 0);
        }

        if (PixTarget != null)
        {
            PixTarget.WriteJpeg("..\\..\\ALL_Help\\HelpImages\\" + Name + "_T.jpg", 75, 0);
        }

        if (File.Exists("..\\..\\VB_Lib\\IncludeComments.xml") == true)
        {
            System.Xml.XmlDocument XML = new System.Xml.XmlDocument();
            XML.Load("..\\..\\VB_LIB\\IncludeComments.xml");
            System.Xml.XmlNode Node = XML.SelectSingleNode("Comments/" + Name);

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

            var CodeNode = Node.SelectSingleNode("example/code[@language=\"" + Lang.ToString() + "\"]");

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

            CodeNode.InnerXml = Environment.NewLine + string.Join(Environment.NewLine, Line1);
            XML.Save("IncludeComments.xml");
        }
    }
Пример #57
0
    //Interface
    protected override void OnInit(EventArgs e)
    {
        //Event handler for page Init event
        if (!Page.IsPostBack && !ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
        {
            //Get configuration values for this control
            string             path       = Page.Request.CurrentExecutionFilePath.Replace(".aspx", "");
            string             reportName = path.Substring(path.LastIndexOf('/') + 1);
            System.Xml.XmlNode rpt        = this.xmlConfig.GetXmlDocument().SelectSingleNode("//report[@name='" + reportName.ToLower() + "']");
            if (rpt != null)
            {
                System.Xml.XmlNode ddp = rpt.SelectSingleNode("DualDateTimePicker");
                if (ddp != null)
                {
                    this.mDateDaysBack    = int.Parse(ddp.Attributes["datedaysback"].Value);
                    this.mDateDaysForward = int.Parse(ddp.Attributes["datedaysforward"].Value);
                    this.mDateDaysSpread  = int.Parse(ddp.Attributes["datedaysspread"].Value);
                }
            }

            //Set defaults if not set by host page
            if (this.txtTo.Text.Length == 0)
            {
                this.txtTo.Text = DateTime.Now.ToLongDateString();
            }
            if (this.txtFrom.Text.Length == 0)
            {
                this.txtFrom.Text = this.txtTo.Text;
            }
        }
        base.OnInit(e);
    }
Пример #58
0
    //
    //createDataElement
    //
    private static void createDataElement(
        ref System.Xml.XmlDocument pdoc,
        string pname, string pvalue,
        string pcomment)
    {
        System.Xml.XmlElement data = pdoc.CreateElement("data");
        data.SetAttribute("name", pname);
        data.SetAttribute("xml:space", "preserve");

        System.Xml.XmlElement value = pdoc.CreateElement("value");
        value.InnerText = pvalue;
        data.AppendChild(value);

        if (!(pcomment == null))
        {
            System.Xml.XmlElement comment = pdoc.CreateElement("comment");
            comment.InnerText = pcomment;
            data.AppendChild(comment);
        }

        System.Xml.XmlNode root     = pdoc.SelectSingleNode("//root");
        System.Xml.XmlNode old_data = root.SelectSingleNode("//data[@name='" + pname + "']");
        if (old_data == null)
        {
            root.AppendChild(data);
        }
        else
        {
            root.ReplaceChild(data, old_data);
        }
    }
Пример #59
0
        public int RestoreItem(string tempFolder, System.Xml.XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group)
        {
            if (itemType == typeof(StatsSite))
            {
                StatisticsServer stats = GetStatisticsServer(serviceId);

                // extract meta item
                XmlSerializer serializer = new XmlSerializer(typeof(StatsSite));
                StatsSite     site       = (StatsSite)serializer.Deserialize(
                    new XmlNodeReader(itemNode.SelectSingleNode("StatsSite")));

                // create site if required
                if (stats.GetSite(site.SiteId) == null)
                {
                    stats.AddSite(site);
                }

                // add meta-item if required
                if (PackageController.GetPackageItemByName(packageId, itemName, typeof(StatsSite)) == null)
                {
                    site.PackageId = packageId;
                    site.ServiceId = serviceId;
                    PackageController.AddPackageItem(site);
                }
            }

            return(0);
        }
Пример #60
0
        public int RestoreItem(string tempFolder, System.Xml.XmlNode itemNode, int itemId, Type itemType, string itemName, int packageId, int serviceId, ResourceGroupInfo group)
        {
            if (itemType == typeof(FtpAccount))
            {
                FTPServer ftp = GetFTPServer(serviceId);

                // extract meta item
                XmlSerializer serializer = new XmlSerializer(typeof(FtpAccount));
                FtpAccount    account    = (FtpAccount)serializer.Deserialize(
                    new XmlNodeReader(itemNode.SelectSingleNode("FtpAccount")));

                // create DSN if required
                if (!ftp.AccountExists(itemName))
                {
                    account.Password = CryptoUtils.Decrypt(account.Password);
                    ftp.CreateAccount(account);

                    // restore password
                    account.Password = CryptoUtils.Encrypt(account.Password);
                }

                // add meta-item if required
                if (PackageController.GetPackageItemByName(packageId, itemName, typeof(FtpAccount)) == null)
                {
                    account.PackageId = packageId;
                    account.ServiceId = serviceId;
                    PackageController.AddPackageItem(account);
                }
            }

            return(0);
        }