/// <summary>
 /// Add the specified hierarchy element.
 /// </summary>
 /// <param name="element">The hierarchy element to add.</param>
 private void AddHierarchyElement(DocumentRange element)
 {
     if (_lastHierarchyElement == null)
     {
         _page.AddContent(element);
     }
     else
     {
         _lastHierarchyElement.AddElement(element);
     }
     _lastHierarchyElement = element;
 }
 /// <summary>
 /// Add an element.
 /// </summary>
 /// <param name="element">The element to add.</param>
 public void AddElement(DocumentRange element)
 {
     Elements.Add(element);
     element.Parent = this;
 }
示例#3
0
 /// <summary>
 /// Add to the content collection.
 /// </summary>
 /// <param name="span">The range to add to the collection.</param>
 public void AddContent(DocumentRange span)
 {
     span.Source = this;
     _contents.Add(span);
 }
示例#4
0
 /// <summary>
 /// Called by loadContents to load the title of the page.
 /// </summary>
 /// <param name="index">The index to begin loading at.</param>
 /// <param name="tag">The beginning tag.</param>
 protected void LoadTitle(int index, Tag tag)
 {
     var title = new DocumentRange(_page);
     title.Begin = index;
     title.End = FindEndTag(index + 1, tag);
     _page.Title = title;
 }
示例#5
0
        /// <summary>
        /// Using the data units, which should have already been loaded by this 
        /// time, load the contents of the web page.  This includes the title,
        /// any links and forms.  Div tags and spans are also processed.
        /// </summary>
        protected void LoadContents()
        {
            for (int index = 0; index < _page.getDataSize(); index++)
            {
                DataUnit du = _page.GetDataUnit(index);
                if (du is TagDataUnit)
                {
                    Tag tag = ((TagDataUnit) du).Tag;

                    if (tag.TagType != Tag.Type.End)
                    {
                        if (string.Compare(tag.Name, "a", true) == 0)
                        {
                            LoadLink(index, tag);
                        }
                        else if (string.Compare(tag.Name, "title", true) == 0)
                        {
                            LoadTitle(index, tag);
                        }
                        else if (string.Compare(tag.Name, "form", true) == 0)
                        {
                            LoadForm(index, tag);
                        }
                        else if (string.Compare(tag.Name, "input", true) == 0)
                        {
                            LoadInput(index, tag);
                        }
                    }

                    if (tag.TagType == Tag.Type.Begin)
                    {
                        if (String.Compare(tag.Name, "div", true) == 0)
                        {
                            LoadDiv(index, tag);
                        }
                        else if (String.Compare(tag.Name, "span", true) == 0)
                        {
                            LoadSpan(index, tag);
                        }
                    }

                    if (tag.TagType == Tag.Type.End)
                    {
                        if (string.Compare(tag.Name, "div") == 0)
                        {
                            if (_lastHierarchyElement != null)
                            {
                                _lastHierarchyElement =
                                    _lastHierarchyElement.Parent;
                            }
                        }
                        else if (String.Compare(tag.Name, "span", true) == 0)
                        {
                            if (_lastHierarchyElement != null)
                            {
                                _lastHierarchyElement =
                                    _lastHierarchyElement.Parent;
                            }
                        }
                    }
                }
            }
        }
示例#6
0
 /// <summary>
 /// Add an element.
 /// </summary>
 /// <param name="element">The element to add.</param>
 public void AddElement(DocumentRange element)
 {
     Elements.Add(element);
     element.Parent = this;
 }
示例#7
0
文件: WebPage.cs 项目: neismit/emds
 public void AddContent(DocumentRange span)
 {
     span.Source = this;
     this._x552e2aea89909776.Add(span);
 }
示例#8
0
 private void x9d4db4971b8e4b59(DocumentRange x4bbc2c453c470189)
 {
     if (this._xe27443ca851b9ce6 == null)
     {
         this._xbbe2f7d7c86e0379.AddContent(x4bbc2c453c470189);
     }
     else
     {
         this._xe27443ca851b9ce6.AddElement(x4bbc2c453c470189);
     }
     this._xe27443ca851b9ce6 = x4bbc2c453c470189;
 }
示例#9
0
 protected void LoadTitle(int index, Tag tag)
 {
     DocumentRange range = new DocumentRange(this._xbbe2f7d7c86e0379) {
         Begin = index,
         End = this.FindEndTag(index + 1, tag)
     };
     this._xbbe2f7d7c86e0379.Title = range;
 }
示例#10
0
 protected void LoadContents()
 {
     Tag tag;
     int i = 0;
     if ((((uint) i) + ((uint) i)) >= 0)
     {
         if ((((uint) i) + ((uint) i)) < 0)
         {
             goto Label_0278;
         }
         if ((((uint) i) | 0xfffffffe) == 0)
         {
             goto Label_01A4;
         }
         goto Label_0056;
     }
     if (((uint) i) <= uint.MaxValue)
     {
         goto Label_003F;
     }
     goto Label_0052;
     Label_0031:
     if (tag.TagType == Tag.Type.End)
     {
         goto Label_00BD;
     }
     goto Label_0052;
     Label_003F:
     if ((string.Compare(tag.Name, "span", true) == 0) && (this._xe27443ca851b9ce6 != null))
     {
         if (3 == 0)
         {
             goto Label_0278;
         }
         this._xe27443ca851b9ce6 = this._xe27443ca851b9ce6.Parent;
     }
     Label_0052:
     i++;
     Label_0056:
     if (i < this._xbbe2f7d7c86e0379.getDataSize())
     {
         DataUnit dataUnit = this._xbbe2f7d7c86e0379.GetDataUnit(i);
         if (((((uint) i) & 0) == 0) && !(dataUnit is TagDataUnit))
         {
             if ((((uint) i) + ((uint) i)) > uint.MaxValue)
             {
                 return;
             }
             goto Label_0052;
         }
         tag = ((TagDataUnit) dataUnit).Tag;
         if (tag.TagType != Tag.Type.End)
         {
             goto Label_0293;
         }
         goto Label_012D;
     }
     return;
     Label_00BD:
     if (string.Compare(tag.Name, "div") != 0)
     {
         goto Label_003F;
     }
     Label_00D4:
     if (this._xe27443ca851b9ce6 != null)
     {
         this._xe27443ca851b9ce6 = this._xe27443ca851b9ce6.Parent;
         if (0 != 0)
         {
             goto Label_00BD;
         }
     }
     goto Label_0052;
     Label_012D:
     if (tag.TagType == Tag.Type.Begin)
     {
         goto Label_01A4;
     }
     goto Label_0031;
     Label_013D:
     if (string.Compare(tag.Name, "span", true) == 0)
     {
         this.xc4283bf79484a931(i, tag);
         if (1 != 0)
         {
             goto Label_0031;
         }
         goto Label_0052;
     }
     if (((uint) i) >= 0)
     {
         goto Label_0031;
     }
     if (((uint) i) > uint.MaxValue)
     {
         goto Label_01F6;
     }
     if (4 != 0)
     {
         goto Label_00BD;
     }
     goto Label_00D4;
     Label_01A4:
     if (string.Compare(tag.Name, "div", true) != 0)
     {
         goto Label_013D;
     }
     this.xd333635ed28a1b6d(i, tag);
     goto Label_0031;
     Label_01F6:
     if ((((uint) i) - ((uint) i)) <= uint.MaxValue)
     {
         goto Label_012D;
     }
     Label_0238:
     if ((((uint) i) - ((uint) i)) >= 0)
     {
         goto Label_01A4;
     }
     if (((uint) i) <= uint.MaxValue)
     {
         if (((((uint) i) & 0) == 0) && ((((uint) i) | 1) != 0))
         {
             if (0xff == 0)
             {
                 goto Label_012D;
             }
             goto Label_013D;
         }
         goto Label_01A4;
     }
     goto Label_0052;
     Label_0278:
     if ((((uint) i) - ((uint) i)) > uint.MaxValue)
     {
         goto Label_01F6;
     }
     Label_0293:
     if (string.Compare(tag.Name, "a", true) == 0)
     {
         this.LoadLink(i, tag);
     }
     else if (string.Compare(tag.Name, "title", true) != 0)
     {
         if (string.Compare(tag.Name, "form", true) != 0)
         {
             if (string.Compare(tag.Name, "input", true) == 0)
             {
                 this.LoadInput(i, tag);
                 if ((((uint) i) - ((uint) i)) <= uint.MaxValue)
                 {
                     goto Label_012D;
                 }
                 goto Label_0238;
             }
             goto Label_01F6;
         }
         this.LoadForm(i, tag);
     }
     else
     {
         this.LoadTitle(i, tag);
     }
     goto Label_012D;
 }
示例#11
0
 /// <summary>
 /// Add the specified hierarchy element.
 /// </summary>
 /// <param name="element">The hierarchy element to add.</param>
 private void AddHierarchyElement(DocumentRange element)
 {
     if (this.lastHierarchyElement == null)
     {
         this.page.AddContent(element);
     }
     else
     {
         this.lastHierarchyElement.AddElement(element);
     }
     this.lastHierarchyElement = element;
 }