Exemplo n.º 1
0
        /// <summary>
        ///   Binding types in the namespace.
        /// </summary>
        /// <param name="t">
        ///   A <b>GCAType</b> value indicates a type.
        /// </param>
        /// <returns></returns>
        private static TreeNode BindingType(GCAType t)
        {
            TreeNode currTypeNode = new TreeNode(t.Name);
            currTypeNode.Name = t.TTypeName.ToString();

            // Binding type's constructors.
            if (t.Constructors.Count > 0)
            {
                foreach (GCATypeMember m in t.Constructors)
                {
                    TreeNode conNode = new TreeNode(m.Text);
                    conNode.Name = "ctor";
                    currTypeNode.Nodes.Add(conNode);
                }
            }

            // Binding type's methods.
            if (t.Methods.Count > 0)
            {
                foreach (GCATypeMember m in t.Methods)
                {
                    TreeNode methodNode = new TreeNode(m.Text);
                    methodNode.Name = "Method";
                    currTypeNode.Nodes.Add(methodNode);
                }
            }

            // Binding type's properties.
            if (t.Property.Count > 0)
            {
                foreach (GCAProperty m in t.Property)
                {
                    TreeNode proNode = new TreeNode(m.Text);
                    proNode.Name = "Property";
                    if (m.AccessMethods.Count > 0)
                    {
                        foreach (GCAMethod me in m.AccessMethods)
                        {
                            TreeNode mNode = new TreeNode(me.Name);
                            mNode.Name = "Acc";
                            proNode.Nodes.Add(mNode);
                        }
                    }
                    currTypeNode.Nodes.Add(proNode);
                }
            }

            // Binding type's events.
            if (t.Events.Count > 0)
            {
                foreach (GCATypeMember m in t.Events)
                {
                    TreeNode eventdNode = new TreeNode(m.Text);
                    eventdNode.Name = "Event";
                    currTypeNode.Nodes.Add(eventdNode);
                }
            }

            return currTypeNode;
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Initialize the instance from a assembly object.
        /// </summary>
        /// <param name="assembly">
        ///   A <b>Assebmly</b> value.
        /// </param>
        public GCAAssembly(Assembly assembly)
        {
            // Check the parameter
            if (assembly == null)
            {
                throw new ArgumentNullException();
            }

            /// <summary>
            ///   Keep all types in a array.
            /// </summary>
            Type[] allTypes;

            // Get all types in the assembly.
            allTypes = assembly.GetTypes();

            // Get assembly's name.
            this._name = assembly.GetName().Name;

            // Check all types in the assembly
            foreach (Type t in allTypes)
            {
                // If Namespace is null, do not show the type.
                if (t.Namespace == null)
                    continue;

                // Find the namespace, if the namesapce not exist.

                if (!Namespaces.Keys.Contains(t.Namespace))
                {
                    // Add a new namespace.
                    GCANamespace tempNamespace = new GCANamespace(t.Namespace);
                    Namespaces.Add(t.Namespace, tempNamespace);
                }

                // Add the types to the namespace.
                GCAType tempType = new GCAType(t);
                Namespaces[t.Namespace].Types.Add(tempType);
            }
        }