Beispiel #1
0
 private void LoadField(TreeNode parentNode, FieldInfo fd)
 {
     TreeNode tr;
     if (fd.IsLiteral)
     {
         tr = new FieldTreeNode(fd, Access.Public, true);
         parentNode.Nodes.Add(tr);
     }
     else if (fd.IsPublic)
     {
         tr = new FieldTreeNode(fd, Access.Public, false);
         parentNode.Nodes.Add(tr);
     }
     else if (fd.IsPrivate)
     {
         tr = new FieldTreeNode(fd, Access.Private, false);
         parentNode.Nodes.Add(tr);
     }
     else if (fd.IsFamilyOrAssembly)
     {
         tr = new FieldTreeNode(fd, Access.Internal, false);
         parentNode.Nodes.Add(tr);
     }
     else
     {
         // It must be protected.
         tr = new FieldTreeNode(fd, Access.Protected, false);
         parentNode.Nodes.Add(tr);
     }
 }
Beispiel #2
0
        //private void LoadConstant(TreeNode parentNode, PropertyInfo ptd)
        //{
        //    //TreeNode tr = new FieldTreeNode(fd, Access.Protected, false);
        //    //parentNode.Nodes.Add(tr);
        //    parentNode.Nodes.Add(ptd.FullName, ptd.Name, Constants.ConstantIcon, Constants.ConstantIcon);
        //}

        #region LoadEnum
        private void LoadEnum(TreeNode parentNode, Type td)
        {
            TreeNode enode;
            TreeNode tr;
            if (td.IsPublic)
            {
                enode = new ClassTreeNode(td, ClassType.Enum, Access.Public);
                parentNode.Nodes.Add(enode);
            }
            else if (td.IsNestedPrivate)
            {
                enode = new ClassTreeNode(td, ClassType.Enum, Access.Private);
                parentNode.Nodes.Add(enode);
            }
            else if (td.IsNestedFamORAssem)
            {
                enode = new ClassTreeNode(td, ClassType.Enum, Access.Internal);
                parentNode.Nodes.Add(enode);
            }
            else
            {
                // It must be protected.
                enode = new ClassTreeNode(td, ClassType.Enum, Access.Protected);
                parentNode.Nodes.Add(enode);
            }
            // Now we get to load it's values.
            foreach (FieldInfo fd in td.GetFields())
            {
                // We don't want to show "value__" because it's automatically added 
                // by the compiler.
                if (fd.Name != "value__")
                {
                    tr = new FieldTreeNode(fd, Access.Public, true);
                    enode.Nodes.Add(tr);
                }
            }
        }