示例#1
0
 /// <summary>
 ///
 /// </summary>
 internal Node()
 {
     this.ResetChildern();
     Identification    = new System.Web.Configuration.nBrowser.Identification[1];
     Identification[0] = new System.Web.Configuration.nBrowser.Identification(true, "header", "User-Agent", ".");
     this.Id           = "[Base Node]";
     this.NameType     = NodeType.Browser;
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        private void ProcessIdentification(System.Xml.XmlNode node)
        {
            //I know not all of these will be used but enough will
            Identification = new System.Web.Configuration.nBrowser.Identification[node.ChildNodes.Count];

            int i = -1;

            for (int a = 0; a <= node.ChildNodes.Count - 1; a++)
            {
                switch (node.ChildNodes[a].NodeType)
                {
                case System.Xml.XmlNodeType.Text:
                    continue;

                case System.Xml.XmlNodeType.Comment:
                    continue;
                }

                string patterngroup = string.Empty;
                string patternname  = string.Empty;

                if (string.Compare(node.ChildNodes[a].Name, "userAgent", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    patterngroup = "header";
                    patternname  = "User-Agent";
                }
                else if (string.Compare(node.ChildNodes[a].Name, "header", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    patterngroup = node.ChildNodes[a].Name;
                    patternname  = node.ChildNodes[a].Attributes["name"].Value;
                }
                else if (string.Compare(node.ChildNodes[a].Name, "capability", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    patterngroup = node.ChildNodes[a].Name;
                    patternname  = node.ChildNodes[a].Attributes["name"].Value;
                }
                else
                {
                    throw new nBrowser.Exception("Invalid Node found in Identification");
                }

                if (node.ChildNodes[a].Attributes["match"] != null)
                {
                    i++;
                    Identification[i] = new System.Web.Configuration.nBrowser.Identification(true, patterngroup, patternname, node.ChildNodes[a].Attributes["match"].Value);
                }
                else if (node.ChildNodes[a].Attributes["nonMatch"] != null)
                {
                    i++;
                    Identification[i] = new System.Web.Configuration.nBrowser.Identification(false, patterngroup, patternname, node.ChildNodes[a].Attributes["nonMatch"].Value);
                }
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="node"></param>
        private void ProcessCapture(System.Xml.XmlNode node)
        {
            //I know not all of these will be used but enough will
            Capture = new System.Web.Configuration.nBrowser.Identification[node.ChildNodes.Count];

            int i = -1;

            for (int a = 0; a <= node.ChildNodes.Count - 1; a++)
            {
                switch (node.ChildNodes[a].NodeType)
                {
                case System.Xml.XmlNodeType.Text:
                    continue;

                case System.Xml.XmlNodeType.Comment:
                    continue;
                }

                string pattern      = string.Empty;
                string patterngroup = string.Empty;
                string patternname  = string.Empty;

                if (node.ChildNodes[a].Name == "userAgent")
                {
                    patterngroup = "header";
                    patternname  = "User-Agent";
                }
                else
                {
                    patterngroup = node.ChildNodes[a].Name;
                    patternname  = node.ChildNodes[a].Attributes["name"].Value;
                }
                pattern = node.ChildNodes[a].Attributes["match"].Value;
                i++;
                Capture[i] = new System.Web.Configuration.nBrowser.Identification(true, patterngroup, patternname, pattern);
            }
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        public void Reset()
        {
            //Making sure we start off on a good footing.
            Capture             = null;
            Capabilities        = null;
            Adapter             = null;
            AdapterControlTypes = null;
            AdapterTypes        = null;
            if (string.Compare(this.xmlNode.Name, "browser", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
            {
                this.NameType = NodeType.Browser;
            }
            else if (string.Compare(this.xmlNode.Name, "defaultBrowser", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
            {
                this.NameType = NodeType.DefaultBrowser;
            }
            else if (string.Compare(this.xmlNode.Name, "gateway", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
            {
                this.NameType = NodeType.Gateway;
            }


            //-------------------------------------------------------------------------
            //Looping though the Attributes is easier since and more efficient
            //then doing finds for specific attribute names. This also handles the
            //cases where there are no attributes really well. Also it doesn't care
            //about the order in witch the attributes are found either
            //-------------------------------------------------------------------------
            for (int a = 0; a <= xmlNode.Attributes.Count - 1; a++)
            {
                //Reason I am not using a switch here because I do not have the ability
                //to make sure the items are in the same upper/lower case as I am expecting
                //so I default to ignore case and compare.
                if (string.Compare(xmlNode.Attributes[a].Name, "id", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    Id = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
                }
                else if (string.Compare(xmlNode.Attributes[a].Name, "parentID", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ParentId = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
                }
                else if (string.Compare(xmlNode.Attributes[a].Name, "refID", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    RefId = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
                }
            }

            for (int a = 0; a <= xmlNode.ChildNodes.Count - 1; a++)
            {
                //Reason I am not using a switch here because I do not have the ability
                //to make sure the items are in the same upper/lower case as I am expecting
                //so I default to ignore case and compare.
                if (string.Compare(xmlNode.ChildNodes[a].Name, "identification", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ProcessIdentification(xmlNode.ChildNodes[a]);
                }
                else if (string.Compare(xmlNode.ChildNodes[a].Name, "capture", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ProcessCapture(xmlNode.ChildNodes[a]);
                }
                else if (string.Compare(xmlNode.ChildNodes[a].Name, "capabilities", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ProcessCapabilities(xmlNode.ChildNodes[a]);
                }
                else if (string.Compare(xmlNode.ChildNodes[a].Name, "controlAdapters", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ProcessControlAdapters(xmlNode.ChildNodes[a]);
                }
                else if (string.Compare(xmlNode.ChildNodes[a].Name, "sampleHeaders", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    ProcessSampleHeaders(xmlNode.ChildNodes[a]);
                }

                if (Id == "default" && (Identification == null || Identification.Length == 0))
                {
                    Identification    = new Identification[1];
                    Identification[0] = new System.Web.Configuration.nBrowser.Identification(true, "header", "User-Agent", ".");
                }
            }
        }
示例#5
0
		/// <summary>
		/// 
		/// </summary>
		public void Reset()
		{
			//Making sure we start off on a good footing.
			Capture = null;
			Capabilities = null;
			Adapter = null;
			AdapterControlTypes = null;
			AdapterTypes = null;
			if (string.Compare(this.xmlNode.Name, "browser", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
			{
				this.NameType = NodeType.Browser;
			}
			else if (string.Compare(this.xmlNode.Name, "defaultBrowser", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
			{
				this.NameType = NodeType.DefaultBrowser;
			}
			else if (string.Compare(this.xmlNode.Name, "gateway", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
			{
				this.NameType = NodeType.Gateway;
			}


			//-------------------------------------------------------------------------
			//Looping though the Attributes is easier since and more efficient
			//then doing finds for specific attribute names. This also handles the
			//cases where there are no attributes really well. Also it doesn't care
			//about the order in witch the attributes are found either
			//-------------------------------------------------------------------------
			for (int a = 0;a <= xmlNode.Attributes.Count - 1;a++)
			{
				//Reason I am not using a switch here because I do not have the ability
				//to make sure the items are in the same upper/lower case as I am expecting
				//so I default to ignore case and compare.
				if (string.Compare(xmlNode.Attributes[a].Name, "id", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					Id = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
				}
				else if (string.Compare(xmlNode.Attributes[a].Name, "parentID", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ParentId = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
				}
				else if (string.Compare(xmlNode.Attributes[a].Name, "refID", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					RefId = xmlNode.Attributes[a].Value.ToLower(System.Globalization.CultureInfo.CurrentCulture);
				}
			}

			for (int a = 0;a <= xmlNode.ChildNodes.Count - 1;a++)
			{
				//Reason I am not using a switch here because I do not have the ability
				//to make sure the items are in the same upper/lower case as I am expecting
				//so I default to ignore case and compare.
				if (string.Compare(xmlNode.ChildNodes[a].Name, "identification", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ProcessIdentification(xmlNode.ChildNodes[a]);
				}
				else if (string.Compare(xmlNode.ChildNodes[a].Name, "capture", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ProcessCapture(xmlNode.ChildNodes[a]);
				}
				else if (string.Compare(xmlNode.ChildNodes[a].Name, "capabilities", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ProcessCapabilities(xmlNode.ChildNodes[a]);
				}
				else if (string.Compare(xmlNode.ChildNodes[a].Name, "controlAdapters", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ProcessControlAdapters(xmlNode.ChildNodes[a]);
				}
				else if (string.Compare(xmlNode.ChildNodes[a].Name, "sampleHeaders", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					ProcessSampleHeaders(xmlNode.ChildNodes[a]);
				}
				
				if (Id == "default" && (Identification == null || Identification.Length == 0))
				{
					Identification = new Identification[1];
					Identification[0] = new System.Web.Configuration.nBrowser.Identification(true, "header", "User-Agent", ".");
				}
			}
		}
示例#6
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="node"></param>
		private void ProcessCapture(System.Xml.XmlNode node)
		{
			//I know not all of these will be used but enough will
			Capture = new System.Web.Configuration.nBrowser.Identification[node.ChildNodes.Count];

			int i = -1;
			for (int a = 0;a <= node.ChildNodes.Count - 1;a++)
			{
				switch (node.ChildNodes[a].NodeType)
				{
					case System.Xml.XmlNodeType.Text:
						continue;
					case System.Xml.XmlNodeType.Comment:
						continue;
				}

				string pattern = string.Empty;
				string patterngroup = string.Empty;
				string patternname = string.Empty;

				if (node.ChildNodes[a].Name == "userAgent")
				{
					patterngroup = "header";
					patternname = "User-Agent";
				}
				else
				{
					patterngroup = node.ChildNodes[a].Name;
					patternname = node.ChildNodes[a].Attributes["name"].Value;
				}
				pattern = node.ChildNodes[a].Attributes["match"].Value;
				i++;
				Capture[i] = new System.Web.Configuration.nBrowser.Identification(true, patterngroup, patternname, pattern);
			}
		}
示例#7
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="node"></param>
		private void ProcessIdentification(System.Xml.XmlNode node)
		{
			//I know not all of these will be used but enough will
			Identification = new System.Web.Configuration.nBrowser.Identification[node.ChildNodes.Count];

			int i = -1;
			for (int a = 0;a <= node.ChildNodes.Count - 1;a++)
			{
				switch (node.ChildNodes[a].NodeType)
				{
					case System.Xml.XmlNodeType.Text:
						continue;
					case System.Xml.XmlNodeType.Comment:
						continue;
				}

				string patterngroup = string.Empty;
				string patternname = string.Empty;

				if (string.Compare(node.ChildNodes[a].Name, "userAgent", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					patterngroup = "header";
					patternname = "User-Agent";
				}
				else if (string.Compare(node.ChildNodes[a].Name, "header", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					patterngroup = node.ChildNodes[a].Name;
					patternname = node.ChildNodes[a].Attributes["name"].Value;
				}
				else if (string.Compare(node.ChildNodes[a].Name, "capability", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
				{
					patterngroup = node.ChildNodes[a].Name;
					patternname = node.ChildNodes[a].Attributes["name"].Value;
				}
				else
				{
					throw new nBrowser.Exception("Invalid Node found in Identification");
				}

				if (node.ChildNodes[a].Attributes["match"] != null)
				{
					i++;
					Identification[i] = new System.Web.Configuration.nBrowser.Identification(true, patterngroup, patternname, node.ChildNodes[a].Attributes["match"].Value);
				}
				else if (node.ChildNodes[a].Attributes["nonMatch"] != null)
				{
					i++;
					Identification[i] = new System.Web.Configuration.nBrowser.Identification(false, patterngroup, patternname, node.ChildNodes[a].Attributes["nonMatch"].Value);
				}
			}
		}
示例#8
0
		/// <summary>
		/// 
		/// </summary>
		internal Node()
		{
			this.ResetChildern();
			Identification = new System.Web.Configuration.nBrowser.Identification[1];
			Identification[0] = new System.Web.Configuration.nBrowser.Identification(true, "header", "User-Agent", ".");
			this.Id = "[Base Node]";
			this.NameType = NodeType.Browser;

		}