Esempio n. 1
0
        protected void ProcessMemberDataT(XmlNode memberNode)
        {
            var  fullName = memberNode.Attributes["name"].InnerText.Split(':')[1];
            Type type     = Type.GetType(fullName + ", " + AssemblyDef.AssemblyName);

            var def = ClassDef.FromType(type);

            XmlNode node;

            for (int i = 0; i < memberNode.ChildNodes.Count; i++)
            {
                node = memberNode.ChildNodes[i];

                switch (node.Name)
                {
                case "summary":
                    def.Summary = node.InnerText;
                    break;

                case "remarks":
                    def.Remarks = node.InnerText;
                    break;
                }
            }

            AssemblyDef.ClassDefs.Add(type, def);
        }
Esempio n. 2
0
        protected void ProcessMemberDataM(XmlNode memberNode)
        {
            // Szczytywanie ogólnych danych
            var    name = memberNode.Attributes["name"].InnerText.Split(':')[1];
            string fullName;
            string paramsString;

            // Oddzielenie parametrów od nazwy
            string[] tmp = name.Split('(');
            fullName     = tmp[0];
            paramsString = tmp[1].Substring(0, tmp[1].Length - 1);

            int    lastDot   = fullName.LastIndexOf('.');
            string className = fullName.Substring(0, lastDot);

            name = fullName.Substring(lastDot + 1);

            // Pobieranie klasy rodzica
            Type classType = Type.GetType(className + ", " + AssemblyDef.AssemblyName);

            // Pobieranie definicji klasy rodzica
            ClassDef parentClass;

            if (AssemblyDef.ClassDefs.ContainsKey(classType))
            {
                parentClass = AssemblyDef.ClassDefs[classType];
            }
            else
            {
                parentClass = ClassDef.FromType(classType);
                AssemblyDef.ClassDefs.Add(classType, parentClass);
            }

            // Przetwarzanie listy parametrów
            Type parentClassType = parentClass.TypeDef.Type;

            Type[] paramsTypes = ProcessParametersString(paramsString);

            // Pobieranie informacji o metodzie
            if (name != "#ctor")
            {
                MethodInfo info = parentClassType.GetMethod(name,
                                                            BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy,
                                                            null,
                                                            paramsTypes,
                                                            null
                                                            );

                if (info == null)
                {
                    return;
                }

                // Pobieranie definicji metody
                MethodDef def;
                if (parentClass.Methods.ContainsKey(info))
                {
                    def = parentClass.Methods[info];
                }
                else
                {
                    def = MethodDef.FromMethodInfo(parentClass, info);
                    parentClass.Methods.Add(info, def);
                }

                // Przetwarzanie danych XML
                XmlNode node;
                for (int i = 0; i < memberNode.ChildNodes.Count; i++)
                {
                    node = memberNode.ChildNodes[i];

                    switch (node.Name)
                    {
                    case "summary":
                        def.Summary = node.InnerText;
                        break;

                    case "remarks":
                        def.Remarks = node.InnerText;
                        break;

                    case "param":
                        var paramName = node.Attributes["name"].InnerText;

                        var paramDef = def.GetParam(paramName);
                        if (paramDef != null)
                        {
                            paramDef.Description = node.InnerText;
                        }
                        break;

                    case "returns":
                        def.Returns.Description = node.InnerText;
                        break;
                    }
                }
            }
            else
            {
                ConstructorInfo info = parentClassType.GetConstructor(
                    BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance,
                    null,
                    paramsTypes,
                    null
                    );

                if (info == null)
                {
                    return;
                }

                // Pobieranie definicji metody
                ConstructorDef def;
                if (parentClass.Constructors.ContainsKey(info))
                {
                    def = parentClass.Constructors[info];
                }
                else
                {
                    def = ConstructorDef.FromConstructorInfo(parentClass, info);
                    parentClass.Constructors.Add(info, def);
                }

                // Przetwarzanie danych XML
                XmlNode node;
                for (int i = 0; i < memberNode.ChildNodes.Count; i++)
                {
                    node = memberNode.ChildNodes[i];

                    switch (node.Name)
                    {
                    case "summary":
                        def.Summary = node.InnerText;
                        break;

                    case "remarks":
                        def.Remarks = node.InnerText;
                        break;

                    case "param":
                        var paramName = node.Attributes["name"].InnerText;

                        var paramDef = def.GetParam(paramName);
                        if (paramDef != null)
                        {
                            paramDef.Description = node.InnerText;
                        }
                        break;
                    }
                }
            }
        }
Esempio n. 3
0
        protected void ProcessType(Type type)
        {
            ClassDef def = ClassDef.FromType(type, this);

            AssemblyDef.AddClassDef(def);
        }