예제 #1
0
        /// <summary>
        /// Loads feed serializer
        /// </summary>
        /// <param name="typeName">Type name of serializer</param>
        /// <returns>Feed serializer object.</returns>
        public static IFeedSerializer LoadSerializer(string typeName)
        {
            Type type = Type.GetType(typeName, false);

            if (type != null)
            {
                return(FeedTransport.LoadSerializer(type));
            }
            return(null);
        }
예제 #2
0
        public FeedHttpTransport(XmlNodeList configData)
        {
            this.connections    = new Hashtable();
            this.defaulPort     = 80;
            this.outboundLimit  = 16;
            this.receiveTimeout = 10000;

            if (configData != null)
            {
                foreach (XmlNode node in configData)
                {
                    XmlElement element = node as XmlElement;
                    if (element != null)
                    {
                        switch (element.LocalName)
                        {
                        case "connectionLimit":
                        {
                            int outLimit = Convert.ToInt32(element.Attributes["inbound"].Value);
                            //int inLimit = Convert.ToInt32(element.Attributes["outbound"].Value);
                            this.outboundLimit = outLimit;
                            //this.inboundLimit = inLimit;
                            continue;
                        }

                        case "defaultPort":
                        {
                            this.defaulPort = Convert.ToInt32(element.Attributes["value"].Value);
                            continue;
                        }

                        case "serializer":
                        {
                            string serializerType = element.Attributes["type"].Value;
                            this.serializer = FeedTransport.LoadSerializer(serializerType);
                            continue;
                        }

                        case "hosts":
                        {
                            //this.ParseHosts(element);
                            continue;
                        }

                        case "receiveTimeout":
                        {
                            this.receiveTimeout = Convert.ToInt32(element.Attributes["value"].Value);
                            continue;
                        }
                            //case "sendTimeout":
                            //    {
                            //        this.sendTimeout = Convert.ToInt32(element.Attributes["value"].Value);
                            //        continue;
                            //    }
                        }
                    }
                }
            }
            if (this.serializer == null)
            {
                this.serializer = new FeedSerializer();
            }
        }