Exemplo n.º 1
0
 private bool IsFrameInDocument(HTMLDocument doc, string contexturl)
 {
     for (int i = 0; i < doc.frames.length; i++)
     {
         object             itemRef = i;
         mshtml.HTMLWindow2 frmElem = (HTMLWindow2)doc.frames.item(ref itemRef);
         HTMLIFrame         frm     = (HTMLIFrame)frmElem.frameElement;
         if (frm.src != null)
         {
             string temp = frm.src;
             Debug.WriteLine("Found Frame: " + temp);
             if (contexturl.EndsWith(frm.src, StringComparison.InvariantCultureIgnoreCase))
             {
                 return(true);
             }
         }
         if (frmElem.document != null)
         {
             HTMLDocument subdoc = (HTMLDocument)frmElem.document;
             if (IsFrameInDocument(subdoc, contexturl))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        public Dictionary <string, HTMLDocument> GetFrames()
        {
            Dictionary <string, HTMLDocument> ret = new Dictionary <string, HTMLDocument>();

            if (web.Document != null)
            {
                for (int i = 0; i < ((HTMLDocument)web.Document).frames.length; i++)
                {
                    object             itemRef    = i;
                    mshtml.HTMLWindow2 frmElement = (HTMLWindow2)((HTMLDocument)web.Document).frames.item(ref itemRef);
                    ret.Add(((HTMLIFrame)frmElement.frameElement).id, (HTMLDocument)frmElement.document);
                }
            }
            return(ret);
        }
 protected void LoadFrameList()
 {
     if (web.Document != null)
     {
         lock (frames)
         {
             frames.Clear();
             for (int i = 0; i < ((HTMLDocument)web.Document).frames.length; i++)
             {
                 object             itemRef    = i;
                 mshtml.HTMLWindow2 frmElement = (HTMLWindow2)((HTMLDocument)web.Document).frames.item(ref itemRef);
                 frames.Add(((HTMLIFrame)frmElement.frameElement).id, (HTMLDocument)frmElement.document);
             }
         }
     }
 }