コード例 #1
0
        public override object ReadChildren()
        {
            object obj1 = InternalValue;

            if (obj1 == null)
            {
                return(null);
            }
            int num1 = 0;

            PropertyInfo[] infoArray1 = Type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
            foreach (PropertyInfo info1 in infoArray1)
            {
                TreeNode         node1     = base.TreeNode.Nodes[num1++];
                TreeNodeProperty property1 = node1.Tag as TreeNodeProperty;
                if (property1 != null)
                {
                    info1.SetValue(obj1, property1.ReadChildren(), null);
                }
            }
            FieldInfo[] infoArray2 = Type.GetFields(BindingFlags.Public | BindingFlags.Instance);
            foreach (FieldInfo info2 in infoArray2)
            {
                TreeNode         node2     = base.TreeNode.Nodes[num1++];
                TreeNodeProperty property2 = node2.Tag as TreeNodeProperty;
                if (property2 != null)
                {
                    info2.SetValue(obj1, property2.ReadChildren(), BindingFlags.Public, null, null);
                }
            }
            return(obj1);
        }
コード例 #2
0
        private void AddBody()
        {
            TreeNode parentNode = base.TreeNode.Nodes.Add("Body");

            if (!this.isIn && (this.method.ReturnType != typeof(void)))
            {
                System.Type type = (this.result != null) ? this.result.GetType() : this.method.ReturnType;
                TreeNodeProperty.CreateTreeNodeProperty(new System.Type[] { type }, "result", this.result).RecreateSubtree(parentNode);
            }
            ParameterInfo[] parameters = this.method.GetParameters();
            for (int i = 0; i < parameters.Length; i++)
            {
                if ((!this.isIn && (parameters[i].IsOut || parameters[i].ParameterType.IsByRef)) || (this.isIn && !parameters[i].IsOut))
                {
                    System.Type parameterType = parameters[i].ParameterType;
                    if (parameterType.IsByRef)
                    {
                        parameterType = parameterType.GetElementType();
                    }
                    object val = (this.paramValues != null) ? this.paramValues[i] : (this.isIn ? TreeNodeProperty.CreateNewInstance(parameterType) : null);
                    TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(parameterType), parameters[i].Name, val).RecreateSubtree(parentNode);
                }
            }
            parentNode.ExpandAll();
        }
コード例 #3
0
        public override object ReadChildren()
        {
            object internalValue = this.InternalValue;

            if (internalValue == null)
            {
                return(null);
            }
            int num = 0;

            foreach (PropertyInfo info in this.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                TreeNode         node = base.TreeNode.Nodes[num++];
                TreeNodeProperty tag  = node.Tag as TreeNodeProperty;
                if (tag != null)
                {
                    info.SetValue(internalValue, tag.ReadChildren(), null);
                }
            }
            foreach (FieldInfo info2 in this.Type.GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                TreeNode         node2     = base.TreeNode.Nodes[num++];
                TreeNodeProperty property2 = node2.Tag as TreeNodeProperty;
                if (property2 != null)
                {
                    info2.SetValue(internalValue, property2.ReadChildren(), BindingFlags.Public, null, null);
                }
            }
            return(internalValue);
        }
コード例 #4
0
        protected override void CreateChildren()
        {
            base.TreeNode.Nodes.Clear();
            if (this.OkayToCreateChildren())
            {
                foreach (PropertyInfo info in this.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
                {
                    object val = info.GetValue(this.val, null);
                    if ((val == null) && this.IsInput())
                    {
                        val = TreeNodeProperty.CreateNewInstance(info.PropertyType);
                    }
                    TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(info.PropertyType), info.Name, val).RecreateSubtree(base.TreeNode);
                }
                foreach (FieldInfo info2 in this.Type.GetFields(BindingFlags.Public | BindingFlags.Instance))
                {
                    object obj3 = info2.GetValue(this.val);

                    if ((obj3 == null) && this.IsInput())
                    {
                        obj3 = TreeNodeProperty.CreateNewInstance(info2.FieldType);
                    }
                    TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(info2.FieldType), info2.Name, obj3).RecreateSubtree(base.TreeNode);
                }
            }
        }
コード例 #5
0
 protected override void CreateChildren()
 {
     base.TreeNode.Nodes.Clear();
     if (base.InternalValue != null)
     {
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "Name", this.xmlElement.Name).RecreateSubtree(base.TreeNode);
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "NamespaceURI", this.xmlElement.NamespaceURI).RecreateSubtree(base.TreeNode);
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "TextValue", this.xmlElement.InnerText).RecreateSubtree(base.TreeNode);
         ArrayList list  = new ArrayList();
         ArrayList list2 = new ArrayList();
         if (this.xmlElement != null)
         {
             for (XmlNode node = this.xmlElement.FirstChild; node != null; node = node.NextSibling)
             {
                 if (node.NodeType == XmlNodeType.Element)
                 {
                     list2.Add(node);
                 }
             }
             foreach (XmlAttribute attribute in this.xmlElement.Attributes)
             {
                 if ((attribute.Name != "xmlns") && !attribute.Name.StartsWith("xmlns:"))
                 {
                     list.Add(attribute);
                 }
             }
         }
         XmlAttribute[] val          = ((list.Count == 0) && !this.IsInput()) ? null : (list.ToArray(typeof(XmlAttribute)) as XmlAttribute[]);
         XmlElement[]   elementArray = ((list2.Count == 0) && !this.IsInput()) ? null : (list2.ToArray(typeof(XmlElement)) as XmlElement[]);
         TreeNodeProperty.CreateTreeNodeProperty(attrArrayType, "Attributes", val).RecreateSubtree(base.TreeNode);
         TreeNodeProperty.CreateTreeNodeProperty(elemArrayType, "SubElements", elementArray).RecreateSubtree(base.TreeNode);
     }
 }
コード例 #6
0
 protected virtual MethodInfo GetCurrentMethod()
 {
     TreeNodeProperty parent = GetParent();
     if (parent == null)
     {
         return null;
     }
     return parent.GetCurrentMethod();
 }
コード例 #7
0
 protected override void CreateChildren()
 {
     base.TreeNode.Nodes.Clear();
     foreach (PropertyInfo info in this.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
     {
         object val = info.GetValue(this.proxyProperties, null);
         TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(info.PropertyType), info.Name, val).RecreateSubtree(base.TreeNode);
     }
 }
コード例 #8
0
 protected virtual object GetCurrentProxy()
 {
     TreeNodeProperty parent = GetParent();
     if (parent == null)
     {
         return null;
     }
     return parent.GetCurrentProxy();
 }
コード例 #9
0
 protected virtual bool IsInput()
 {
     TreeNodeProperty parent = GetParent();
     if (parent == null)
     {
         return false;
     }
     return parent.IsInput();
 }
コード例 #10
0
        protected virtual bool IsInput()
        {
            TreeNodeProperty property1 = GetParent();

            if (property1 == null)
            {
                return(false);
            }
            return(property1.IsInput());
        }
コード例 #11
0
        protected virtual MethodInfo GetCurrentMethod()
        {
            TreeNodeProperty property1 = GetParent();

            if (property1 == null)
            {
                return(null);
            }
            return(property1.GetCurrentMethod());
        }
コード例 #12
0
        protected virtual object GetCurrentProxy()
        {
            TreeNodeProperty property1 = GetParent();

            if (property1 == null)
            {
                return(null);
            }
            return(property1.GetCurrentProxy());
        }
コード例 #13
0
        protected virtual bool IsInput()
        {
            TreeNodeProperty parent = this.GetParent();

            if (parent == null)
            {
                return(false);
            }
            return(parent.IsInput());
        }
コード例 #14
0
 protected override void CreateChildren()
 {
     base.TreeNode.Nodes.Clear();
     if (base.InternalValue != null)
     {
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "Name", this.xmlAttribute.Name).RecreateSubtree(base.TreeNode);
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "NamespaceURI", this.xmlAttribute.NamespaceURI).RecreateSubtree(base.TreeNode);
         TreeNodeProperty.CreateTreeNodeProperty(stringType, "Value", this.xmlAttribute.Value).RecreateSubtree(base.TreeNode);
     }
 }
コード例 #15
0
 private Type GetContainedType(ITypeDescriptorContext context)
 {
     if (context != null)
     {
         TreeNodeProperty property1 = context.Instance as TreeNodeProperty;
         if (property1 != null)
         {
             return(property1.Type);
         }
     }
     return(null);
 }
コード例 #16
0
 private static Type GetContainedType(ITypeDescriptorContext context)
 {
     if (context != null)
     {
         TreeNodeProperty instance = context.Instance as TreeNodeProperty;
         if (instance != null)
         {
             return(instance.Type);
         }
     }
     return(null);
 }
コード例 #17
0
 public static TreeNodeProperty CreateTreeNodeProperty(TreeNodeProperty tnp)
 {
     if (tnp is ClassProperty)
     {
         var property = tnp as ClassProperty;
         return(CreateTreeNodeProperty(property.types, property.Name, property.InternalValue));
     }
     if (tnp is PrimitiveProperty)
     {
         var property2 = tnp as PrimitiveProperty;
         return(CreateTreeNodeProperty(property2.types, property2.Name, property2.Value));
     }
     return(CreateTreeNodeProperty(tnp.types, tnp.Name, null));
 }
コード例 #18
0
        private void AddHeaders()
        {
            TreeNode parentNode = base.TreeNode.Nodes.Add("Headers");

            FieldInfo[]           soapHeaders = GetSoapHeaders(this.method, this.isIn);
            HttpWebClientProtocol proxy       = this.proxyProperty.GetProxy();

            foreach (FieldInfo info in soapHeaders)
            {
                object val = (proxy != null) ? info.GetValue(proxy) : null;
                TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(info.FieldType), info.Name, val).RecreateSubtree(parentNode);
            }
            parentNode.ExpandAll();
        }
コード例 #19
0
 public static TreeNodeProperty CreateTreeNodeProperty(TreeNodeProperty tnp)
 {
     if (tnp is ClassProperty)
     {
         ClassProperty property1 = tnp as ClassProperty;
         return CreateTreeNodeProperty(property1.types, property1.Name, property1.InternalValue);
     }
     if (tnp is PrimitiveProperty)
     {
         PrimitiveProperty property2 = tnp as PrimitiveProperty;
         return CreateTreeNodeProperty(property2.types, property2.Name, property2.Value);
     }
     return CreateTreeNodeProperty(tnp.types, tnp.Name, null);
 }
コード例 #20
0
 protected virtual bool OkayToCreateChildren()
 {
     if (TreeNodeProperty.IsInternalType(this.Type))
     {
         return(false);
     }
     if (TreeNodeProperty.IsDeepNesting(this))
     {
         this.InternalValue = null;
     }
     if (this.InternalValue == null)
     {
         return(false);
     }
     return(true);
 }
コード例 #21
0
 protected static bool IsDeepNesting(TreeNodeProperty tnp)
 {
     if (tnp != null)
     {
         int num = 0;
         while ((tnp = tnp.GetParent()) != null)
         {
             num++;
             if (num > 12)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #22
0
 public TreeNodeProperty GetParent()
 {
     if (TreeNode != null)
     {
         TreeNode node1 = TreeNode;
         while (node1.Parent != null)
         {
             node1 = node1.Parent;
             TreeNodeProperty property1 = node1.Tag as TreeNodeProperty;
             if (property1 != null)
             {
                 return(property1);
             }
         }
     }
     return(null);
 }
コード例 #23
0
 public TreeNodeProperty GetParent()
 {
     if (this.TreeNode != null)
     {
         System.Windows.Forms.TreeNode treeNode = this.TreeNode;
         while (treeNode.Parent != null)
         {
             treeNode = treeNode.Parent;
             TreeNodeProperty tag = treeNode.Tag as TreeNodeProperty;
             if (tag != null)
             {
                 return(tag);
             }
         }
     }
     return(null);
 }
コード例 #24
0
 protected override void CreateChildren()
 {
     base.TreeNode.Nodes.Clear();
     if (this.OkayToCreateChildren())
     {
         System.Type elementType = this.Type.GetElementType();
         int         length      = this.Length;
         for (int i = 0; i < length; i++)
         {
             object val = this.ArrayValue.GetValue(i);
             if ((val == null) && this.IsInput())
             {
                 val = TreeNodeProperty.CreateNewInstance(elementType);
             }
             TreeNodeProperty.CreateTreeNodeProperty(base.GetIncludedTypes(elementType), base.Name + "_" + i.ToString(), val).RecreateSubtree(base.TreeNode);
         }
     }
 }
コード例 #25
0
        public override object ReadChildren()
        {
            object proxyProperties = this.proxyProperties;

            if (proxyProperties == null)
            {
                return(null);
            }
            int num = 0;

            foreach (PropertyInfo info in this.Type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
            {
                TreeNode         node = base.TreeNode.Nodes[num++];
                TreeNodeProperty tag  = node.Tag as TreeNodeProperty;
                if (tag != null)
                {
                    info.SetValue(proxyProperties, tag.ReadChildren(), null);
                }
            }
            return(proxyProperties);
        }
コード例 #26
0
        public override object ReadChildren()
        {
            Array array1 = ArrayValue;

            if (array1 == null)
            {
                return(null);
            }
            int num1 = 0;

            for (int num2 = 0; num2 < array1.Length; num2++)
            {
                TreeNode         node1     = base.TreeNode.Nodes[num1++];
                TreeNodeProperty property1 = node1.Tag as TreeNodeProperty;
                if (property1 != null)
                {
                    array1.SetValue(property1.ReadChildren(), num2);
                }
            }
            return(array1);
        }
コード例 #27
0
        public override object ReadChildren()
        {
            Array arrayValue = this.ArrayValue;

            if (arrayValue == null)
            {
                return(null);
            }
            int num = 0;

            for (int i = 0; i < arrayValue.Length; i++)
            {
                TreeNode         node = base.TreeNode.Nodes[num++];
                TreeNodeProperty tag  = node.Tag as TreeNodeProperty;
                if (tag != null)
                {
                    arrayValue.SetValue(tag.ReadChildren(), i);
                }
            }
            return(arrayValue);
        }
コード例 #28
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            Type type = null;

            if (value == null)
            {
                TreeNodeProperty instance = context.Instance as TreeNodeProperty;
                if (instance != null)
                {
                    type = instance.Type;
                }
            }
            else
            {
                type = value.GetType();
            }
            if (type != null)
            {
                return(GetEditor(type).EditValue(context, provider, value));
            }
            return(base.EditValue(context, provider, value));
        }
コード例 #29
0
        private void ReadBody()
        {
            TreeNode node1 = base.TreeNode.Nodes[1];

            ParameterInfo[] infoArray1 = method.GetParameters();
            paramValues = new object[infoArray1.Length];
            int num1 = 0;
            int num2 = 0;

            while (num1 < paramValues.Length)
            {
                ParameterInfo info1 = infoArray1[num1];
                if (!info1.IsOut)
                {
                    TreeNode         node2     = node1.Nodes[num2++];
                    TreeNodeProperty property1 = node2.Tag as TreeNodeProperty;
                    if (property1 != null)
                    {
                        paramValues[num1] = property1.ReadChildren();
                    }
                }
                num1++;
            }
        }
コード例 #30
0
        private void ReadBody()
        {
            TreeNode node = base.TreeNode.Nodes[1];

            ParameterInfo[] parameters = this.method.GetParameters();
            this.paramValues = new object[parameters.Length];
            int index = 0;
            int num2  = 0;

            while (index < this.paramValues.Length)
            {
                ParameterInfo info = parameters[index];
                if (!info.IsOut)
                {
                    TreeNode         node2 = node.Nodes[num2++];
                    TreeNodeProperty tag   = node2.Tag as TreeNodeProperty;
                    if (tag != null)
                    {
                        this.paramValues[index] = tag.ReadChildren();
                    }
                }
                index++;
            }
        }
コード例 #31
0
 public static TreeNodeProperty CreateTreeNodeProperty(TreeNodeProperty tnp, object val)
 {
     return CreateTreeNodeProperty(tnp.types, tnp.Name, val);
 }
コード例 #32
0
 private void CopyToClipboard(TreeNodeProperty tnp)
 {
     if (!this.IsValidCopyNode(tnp))
     {
         throw new Exception("Cannot copy from here");
     }
     object o = tnp.ReadChildren();
     if (o != null)
     {
         StringWriter writer = new StringWriter();
         System.Type[] extraTypes = new System.Type[] { o.GetType() };
         System.Type type = (o is DataSet) ? typeof(DataSet) : typeof(object);
         new XmlSerializer(type, extraTypes).Serialize((TextWriter) writer, o);
         Clipboard.SetDataObject(writer.ToString());
     }
 }
コード例 #33
0
 protected static bool IsDeepNesting(TreeNodeProperty tnp)
 {
     if (tnp != null)
     {
         int num = 0;
         while ((tnp = tnp.GetParent()) != null)
         {
             num++;
             if (num > 12)
             {
                 return true;
             }
         }
     }
     return false;
 }
コード例 #34
0
 private void CopyToClipboard(TreeNodeProperty tnp)
 {
     if (!IsValidCopyNode(tnp))
     {
         throw new Exception("Cannot copy from here");
     }
     object obj1 = tnp.ReadChildren();
     if (obj1 != null)
     {
         StringWriter writer1 = new StringWriter();
         Type[] typeArray1 = new Type[] { obj1.GetType() };
         Type type1 = (obj1 is DataSet) ? typeof(DataSet) : typeof(object);
         new XmlSerializer(type1, typeArray1).Serialize(writer1, obj1);
         Clipboard.SetDataObject(writer1.ToString());
     }
 }
コード例 #35
0
 public static TreeNodeProperty CreateTreeNodeProperty(TreeNodeProperty tnp, object val)
 {
     return(CreateTreeNodeProperty(tnp.types, tnp.Name, val));
 }
コード例 #36
0
 private bool IsValidCopyNode(TreeNodeProperty tnp)
 {
     return (((tnp != null) && (tnp.TreeNode.Parent != null)) && (tnp.GetType() != typeof(TreeNodeProperty)));
 }
コード例 #37
0
 private bool IsValidPasteNode(TreeNodeProperty tnp)
 {
     IDataObject obj1 = Clipboard.GetDataObject();
     if ((obj1 == null) || (obj1.GetData(DataFormats.Text) == null))
     {
         return false;
     }
     return IsValidCopyNode(tnp);
 }