Exemplo n.º 1
0
 private List<CwbElement> GetElementsByTagName(string tagName, CwbElement parent)
 {
     List<CwbElement> list = new List<CwbElement>();
     foreach (CwbElement e in parent.ChildElements)
     {
         if (string.IsNullOrEmpty(e.TagName)) continue;
         List<CwbElement> items = GetElementsByTagName(tagName, e);
         if (e.TagName.ToUpper() == tagName.ToUpper())
         {
             list.Add(e);
         }
         list.AddRange(items);
     }
     return list;
 }
Exemplo n.º 2
0
        public void Load()
        {
            Global.flag = false;
            if (Root != null)
            {
                Root.ChildElements.Clear();
            }
            browser.SendProcessMessage(CefProcessId.Renderer, CefProcessMessage.Create("GetDocument"));
            while (!Global.flag)
            {

            }
            _root = Global.RootList[ browser.Identifier ];
            CefCookieManager.Global.VisitUrlCookies(browser.GetMainFrame().Url, true, new CwbCookieVisitor(CwbCookieStyle.csVisitUrlCookie, this));
        }
Exemplo n.º 3
0
 private CwbElement GetElementById(string id, CwbElement parent)
 {
     foreach (CwbElement e in parent.ChildElements)
     {
         if (e.Id.ToUpper() == id.ToUpper())
         {
             return e;
         }
         CwbElement element = GetElementById(id, e);
         if (element != null)
         {
             if (element.Id.ToUpper() == id.ToUpper())
             {
                 return element;
             }
         }
     }
     return null;
 }
Exemplo n.º 4
0
 private CwbElement CreateElement(CefDomNode node)
 {
     string id = string.Empty;
     if (node.HasAttribute("id"))
     {
         id = node.GetAttribute("id");
     }
     CwbElement retValue = new CwbElement(browser,id, node.ElementTagName,node.GetAttribute("value"),
         node.IsElement,node.IsEditable,
         node.HasChildren,node.InnerText,
         node.HasAttributes
         );
     foreach (KeyValuePair<string, string> item in node.GetAttributes())
     {
         retValue.Attributes.Add(item);
     }
     return retValue;
 }
Exemplo n.º 5
0
        public void AppendAllChildElement(CefDomNode parentNode,CwbElement parentElement, string indePath)
        {
            if (parentNode.HasChildren)
            {
                CefDomNode node = parentNode.FirstChild;
                if (node == null) return;

                int index = 0;
                CwbElement childElement = CreateElement(node);
                childElement.IndexPath = indePath + "."+index.ToString();
                parentElement.ChildElements.Add(childElement);
                AppendAllChildElement(node, childElement, childElement.IndexPath);

                node = node.NextSibling;
                while (node != null)
                {
                    childElement = CreateElement(node);
                    index++;
                    childElement.IndexPath = indePath + "." + index.ToString();
                    parentElement.ChildElements.Add(childElement);
                    AppendAllChildElement(node, childElement, childElement.IndexPath);
                    node = node.NextSibling;
                    System.Windows.Forms.Application.DoEvents();
                }
            }
        }