Пример #1
0
        internal static Element GetTypedElement(DomContainer domContainer, IHTMLElement element)
        {
            Assembly assembly = Assembly.Load("ItiN");

            Element returnElement = new ElementsContainer(domContainer, element);

            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(Element)))
                {
                    PropertyInfo property = type.GetProperty("ElementTags");
                    if (property != null)
                    {
                        ArrayList elementTags = (ArrayList)property.GetValue(type, null);

                        if (ElementTag.IsValidElement(element, elementTags))
                        {
                            ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(Element) });
                            if (constructor != null)
                            {
                                returnElement = (Element)constructor.Invoke(new object[] { returnElement });
                                break;
                            }
                        }
                    }
                }
            }

            return(returnElement);
        }
Пример #2
0
        internal static Element GetTypedElement(DomContainer domContainer, IHTMLElement element)
        {
            Assembly assembly = Assembly.Load("ItiN");

            Element returnElement = new ElementsContainer(domContainer, element);

            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(Element)))
                {
                    PropertyInfo property = type.GetProperty("ElementTags");
                    if (property != null)
                    {
                        ArrayList elementTags = (ArrayList)property.GetValue(type, null);

                        if (ElementTag.IsValidElement(element, elementTags))
                        {
                            ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(Element) });
                            if (constructor != null)
                            {
                                returnElement = (Element)constructor.Invoke(new object[] { returnElement });
                                break;
                            }
                        }
                    }
                }
            }

            return returnElement;
        }