Ejemplo n.º 1
0
 public HttpNotificationTemplate(JToken node) : base(node)
 {
     if (node["url"] != null)
     {
         this._Url = node["url"].Value <string>();
     }
     if (node["method"] != null)
     {
         this._Method = (HttpNotificationMethod)ParseEnum(typeof(HttpNotificationMethod), node["method"].Value <string>());
     }
     if (node["data"] != null)
     {
         this._Data = ObjectFactory.Create <HttpNotificationData>(node["data"]);
     }
     if (node["timeout"] != null)
     {
         this._Timeout = ParseInt(node["timeout"].Value <string>());
     }
     if (node["connectTimeout"] != null)
     {
         this._ConnectTimeout = ParseInt(node["connectTimeout"].Value <string>());
     }
     if (node["username"] != null)
     {
         this._Username = node["username"].Value <string>();
     }
     if (node["password"] != null)
     {
         this._Password = node["password"].Value <string>();
     }
     if (node["authenticationMethod"] != null)
     {
         this._AuthenticationMethod = (HttpNotificationAuthenticationMethod)ParseEnum(typeof(HttpNotificationAuthenticationMethod), node["authenticationMethod"].Value <string>());
     }
     if (node["sslVersion"] != null)
     {
         this._SslVersion = (HttpNotificationSslVersion)ParseEnum(typeof(HttpNotificationSslVersion), node["sslVersion"].Value <string>());
     }
     if (node["sslCertificate"] != null)
     {
         this._SslCertificate = node["sslCertificate"].Value <string>();
     }
     if (node["sslCertificateType"] != null)
     {
         this._SslCertificateType = (HttpNotificationCertificateType)StringEnum.Parse(typeof(HttpNotificationCertificateType), node["sslCertificateType"].Value <string>());
     }
     if (node["sslCertificatePassword"] != null)
     {
         this._SslCertificatePassword = node["sslCertificatePassword"].Value <string>();
     }
     if (node["sslEngine"] != null)
     {
         this._SslEngine = node["sslEngine"].Value <string>();
     }
     if (node["sslEngineDefault"] != null)
     {
         this._SslEngineDefault = node["sslEngineDefault"].Value <string>();
     }
     if (node["sslKeyType"] != null)
     {
         this._SslKeyType = (HttpNotificationSslKeyType)StringEnum.Parse(typeof(HttpNotificationSslKeyType), node["sslKeyType"].Value <string>());
     }
     if (node["sslKey"] != null)
     {
         this._SslKey = node["sslKey"].Value <string>();
     }
     if (node["sslKeyPassword"] != null)
     {
         this._SslKeyPassword = node["sslKeyPassword"].Value <string>();
     }
     if (node["customHeaders"] != null)
     {
         this._CustomHeaders = new List <KeyValue>();
         foreach (var arrayNode in node["customHeaders"].Children())
         {
             this._CustomHeaders.Add(ObjectFactory.Create <KeyValue>(arrayNode));
         }
     }
 }
        public HttpNotificationTemplate(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "url":
                    this._Url = propertyNode.InnerText;
                    continue;

                case "method":
                    this._Method = (HttpNotificationMethod)ParseEnum(typeof(HttpNotificationMethod), propertyNode.InnerText);
                    continue;

                case "data":
                    this._Data = ObjectFactory.Create <HttpNotificationData>(propertyNode);
                    continue;

                case "timeout":
                    this._Timeout = ParseInt(propertyNode.InnerText);
                    continue;

                case "connectTimeout":
                    this._ConnectTimeout = ParseInt(propertyNode.InnerText);
                    continue;

                case "username":
                    this._Username = propertyNode.InnerText;
                    continue;

                case "password":
                    this._Password = propertyNode.InnerText;
                    continue;

                case "authenticationMethod":
                    this._AuthenticationMethod = (HttpNotificationAuthenticationMethod)ParseEnum(typeof(HttpNotificationAuthenticationMethod), propertyNode.InnerText);
                    continue;

                case "sslVersion":
                    this._SslVersion = (HttpNotificationSslVersion)ParseEnum(typeof(HttpNotificationSslVersion), propertyNode.InnerText);
                    continue;

                case "sslCertificate":
                    this._SslCertificate = propertyNode.InnerText;
                    continue;

                case "sslCertificateType":
                    this._SslCertificateType = (HttpNotificationCertificateType)StringEnum.Parse(typeof(HttpNotificationCertificateType), propertyNode.InnerText);
                    continue;

                case "sslCertificatePassword":
                    this._SslCertificatePassword = propertyNode.InnerText;
                    continue;

                case "sslEngine":
                    this._SslEngine = propertyNode.InnerText;
                    continue;

                case "sslEngineDefault":
                    this._SslEngineDefault = propertyNode.InnerText;
                    continue;

                case "sslKeyType":
                    this._SslKeyType = (HttpNotificationSslKeyType)StringEnum.Parse(typeof(HttpNotificationSslKeyType), propertyNode.InnerText);
                    continue;

                case "sslKey":
                    this._SslKey = propertyNode.InnerText;
                    continue;

                case "sslKeyPassword":
                    this._SslKeyPassword = propertyNode.InnerText;
                    continue;

                case "customHeaders":
                    this._CustomHeaders = new List <KeyValue>();
                    foreach (XmlElement arrayNode in propertyNode.ChildNodes)
                    {
                        this._CustomHeaders.Add(ObjectFactory.Create <KeyValue>(arrayNode));
                    }
                    continue;
                }
            }
        }