Example #1
0
        public bool IsVisualizerAvailable(DebugType type)
        {
            DebugType collectionType, itemType;

            // Visualizer available for IEnumerable<T> (that means also IList<T>)
            return(type.ResolveIEnumerableImplementation(out collectionType, out itemType));
        }
Example #2
0
        public bool IsVisualizerAvailable(DebugType type)
        {
            if (type.IsAtomic())
            {
                return(false);
            }
            DebugType collectionType, itemType;

            // Visualizer available for IEnumerable<T> (that is, also IList<T>)
            return(type.ResolveIEnumerableImplementation(out collectionType, out itemType));
        }
        public static IEnumerable <TreeNode> LazyGetChildNodesOfObject(TreeNode current, Expression targetObject, DebugType shownType)
        {
            MemberInfo[] publicStatic      = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] publicInstance    = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicStatic   = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicInstance = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            DebugType baseType = (DebugType)shownType.BaseType;

            if (baseType != null)
            {
                yield return(new TreeNode(
                                 DebuggerResourceService.GetImage("Icons.16x16.Class"),
                                 StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.BaseClass}"),
                                 baseType.Name,
                                 baseType.FullName,
                                 current,
                                 newNode => baseType.FullName == "System.Object" ? null : Utils.LazyGetChildNodesOfObject(newNode, targetObject, baseType)
                                 ));
            }

            if (nonPublicInstance.Length > 0)
            {
                yield return(new TreeNode(
                                 null,
                                 StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.NonPublicMembers}"),
                                 string.Empty,
                                 string.Empty,
                                 current,
                                 newNode => Utils.LazyGetMembersOfObject(newNode, targetObject, nonPublicInstance)
                                 ));
            }

            if (publicStatic.Length > 0 || nonPublicStatic.Length > 0)
            {
                yield return(new TreeNode(
                                 null,
                                 StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.StaticMembers}"),
                                 string.Empty,
                                 string.Empty,
                                 current,
                                 p => {
                    var children = Utils.LazyGetMembersOfObject(p, targetObject, publicStatic);
                    if (nonPublicStatic.Length > 0)
                    {
                        TreeNode nonPublicStaticNode = new TreeNode(
                            null,
                            StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.NonPublicStaticMembers}"),
                            string.Empty,
                            string.Empty,
                            p,
                            newNode => Utils.LazyGetMembersOfObject(newNode, targetObject, nonPublicStatic)
                            );
                        children = Utils.PrependNode(nonPublicStaticNode, children);
                    }
                    return children;
                }
                                 ));
            }

            DebugType iListType = (DebugType)shownType.GetInterface(typeof(IList).FullName);

            if (iListType != null)
            {
                yield return(new IListNode(current, targetObject));
            }
            else
            {
                DebugType iEnumerableType, itemType;
                if (shownType.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                {
                    yield return(new IEnumerableNode(current, targetObject, itemType));
                }
            }

            foreach (TreeNode node in LazyGetMembersOfObject(current, targetObject, publicInstance))
            {
                yield return(node);
            }
        }
Example #4
0
		public static IEnumerable<TreeNode> LazyGetChildNodesOfObject(Expression targetObject, DebugType shownType)
		{
			MemberInfo[] publicStatic      = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public    | BindingFlags.Static   | BindingFlags.DeclaredOnly);
			MemberInfo[] publicInstance    = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public    | BindingFlags.Instance | BindingFlags.DeclaredOnly);
			MemberInfo[] nonPublicStatic   = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Static   | BindingFlags.DeclaredOnly);
			MemberInfo[] nonPublicInstance = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
			
			DebugType baseType = (DebugType)shownType.BaseType;
			if (baseType != null) {
				yield return new TreeNode(
					ImageService.GetImage("Icons.16x16.Class"),
					"BaseClass",
					baseType.Name,
					baseType.FullName,
					baseType.FullName == "System.Object" ? null : Utils.LazyGetChildNodesOfObject(targetObject, baseType)
				);
			}
			
			if (nonPublicInstance.Length > 0) {
				yield return new TreeNode(
					null,
					"NonPublicMembers",
					string.Empty,
					string.Empty,
					Utils.LazyGetMembersOfObject(targetObject, nonPublicInstance)
				);
			}
			
			if (publicStatic.Length > 0 || nonPublicStatic.Length > 0) {
				IEnumerable<TreeNode> childs = Utils.LazyGetMembersOfObject(targetObject, publicStatic);
				if (nonPublicStatic.Length > 0) {
					TreeNode nonPublicStaticNode = new TreeNode(
						null,
						"NonPublicStaticMembers",
						string.Empty,
						string.Empty,
						Utils.LazyGetMembersOfObject(targetObject, nonPublicStatic)
					);
					childs = Utils.PrependNode(nonPublicStaticNode, childs);
				}
				yield return new TreeNode(
					null,
					"StaticMembers",
					string.Empty,
					string.Empty,
					childs
				);
			}
			
			DebugType iListType = (DebugType)shownType.GetInterface(typeof(IList).FullName);
			if (iListType != null) {
				yield return new IListNode(targetObject);
			} else {
				DebugType iEnumerableType, itemType;
				if (shownType.ResolveIEnumerableImplementation(out iEnumerableType, out itemType)) {
					yield return new IEnumerableNode(targetObject, itemType);
				}
			}
			
			foreach(TreeNode node in LazyGetMembersOfObject(targetObject, publicInstance)) {
				yield return node;
			}
		}
Example #5
0
        public static IEnumerable <TreeNode> LazyGetChildNodesOfObject(Expression targetObject, DebugType shownType)
        {
            MemberInfo[] publicStatic      = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] publicInstance    = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicStatic   = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicInstance = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            DebugType baseType = (DebugType)shownType.BaseType;

            if (baseType != null)
            {
                yield return(new TreeNode(
                                 ImageCache.GetIcon(TypeIcon.Class, BackgroundType.DebuggerToolTip),
                                 "BaseClass",
                                 baseType.Name,
                                 baseType.FullName,
                                 baseType.FullName == "System.Object" ? null : Utils.LazyGetChildNodesOfObject(targetObject, baseType)
                                 ));
            }

            if (nonPublicInstance.Length > 0)
            {
                yield return(new TreeNode(
                                 null,
                                 "NonPublicMembers",
                                 string.Empty,
                                 string.Empty,
                                 Utils.LazyGetMembersOfObject(targetObject, nonPublicInstance)
                                 ));
            }

            if (publicStatic.Length > 0 || nonPublicStatic.Length > 0)
            {
                IEnumerable <TreeNode> childs = Utils.LazyGetMembersOfObject(targetObject, publicStatic);
                if (nonPublicStatic.Length > 0)
                {
                    TreeNode nonPublicStaticNode = new TreeNode(
                        null,
                        "NonPublicStaticMembers",
                        string.Empty,
                        string.Empty,
                        Utils.LazyGetMembersOfObject(targetObject, nonPublicStatic)
                        );
                    childs = Utils.PrependNode(nonPublicStaticNode, childs);
                }
                yield return(new TreeNode(
                                 null,
                                 "StaticMembers",
                                 string.Empty,
                                 string.Empty,
                                 childs
                                 ));
            }

            DebugType iListType = (DebugType)shownType.GetInterface(typeof(IList).FullName);

            if (iListType != null)
            {
                yield return(new IListNode(targetObject));
            }
            else
            {
                DebugType iEnumerableType, itemType;
                if (shownType.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                {
                    yield return(new IEnumerableNode(targetObject, itemType));
                }
            }

            foreach (TreeNode node in LazyGetMembersOfObject(targetObject, publicInstance))
            {
                yield return(node);
            }
        }
        public static IEnumerable <TreeNode> LazyGetChildNodesOfObject(Expression targetObject, DebugType shownType)
        {
            MemberInfo[] publicStatic      = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] publicInstance    = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicStatic   = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
            MemberInfo[] nonPublicInstance = shownType.GetFieldsAndNonIndexedProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            DebugType baseType = (DebugType)shownType.BaseType;

            if (baseType != null)
            {
                if (Variables.Langue == "en")
                {
                    yield return(new TreeNode(
                                     Properties.Resources._namespace,
                                     StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_BaseClass_EN),
                                     baseType.Name,
                                     baseType.FullName,
                                     baseType.FullName == "System.Object" ? null : Utils.LazyGetChildNodesOfObject(targetObject, baseType)
                                     ));
                }
                else
                {
                    yield return(new TreeNode(
                                     Properties.Resources._namespace,
                                     StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_BaseClass),
                                     baseType.Name,
                                     baseType.FullName,
                                     baseType.FullName == "System.Object" ? null : Utils.LazyGetChildNodesOfObject(targetObject, baseType)
                                     ));
                }
            }

            // if (nonPublicInstance.Length > 0) {
            //     if (Variables.Langue == "en")
            //     {
            //         yield return new TreeNode(
            //             null,
            //             StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_NonPublicMembers_EN),
            //             string.Empty,
            //             string.Empty,
            //             Utils.LazyGetMembersOfObject(targetObject, nonPublicInstance)
            //         );
            //     }
            //     else
            //     {
            //         yield return new TreeNode(
            //             null,
            //             StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_NonPublicMembers),
            //             string.Empty,
            //             string.Empty,
            //             Utils.LazyGetMembersOfObject(targetObject, nonPublicInstance)
            //         );
            //     }
            // }
            //
            // if (publicStatic.Length > 0 || nonPublicStatic.Length > 0) {
            //  IEnumerable<TreeNode> childs = Utils.LazyGetMembersOfObject(targetObject, publicStatic);
            //  if (nonPublicStatic.Length > 0) {
            //         if (Variables.Langue == "en")
            //         {
            //             TreeNode nonPublicStaticNode = new TreeNode(
            //                 null,
            //                 StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_NonPublicStaticMembers_EN),
            //                 string.Empty,
            //                 string.Empty,
            //                 Utils.LazyGetMembersOfObject(targetObject, nonPublicStatic)
            //             );
            //             childs = Utils.PrependNode(nonPublicStaticNode, childs);
            //         }
            //         else
            //         {
            //             TreeNode nonPublicStaticNode = new TreeNode(
            //                 null,
            //                 StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_NonPublicStaticMembers),
            //                 string.Empty,
            //                 string.Empty,
            //                 Utils.LazyGetMembersOfObject(targetObject, nonPublicStatic)
            //             );
            //             childs = Utils.PrependNode(nonPublicStaticNode, childs);
            //         }
            //  }
            //     if (Variables.Langue == "en")
            //     {
            //         yield return new TreeNode(
            //             null,
            //             StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_StaticMembers_EN),
            //             string.Empty,
            //             string.Empty,
            //             childs
            //         );
            //     }
            //     else
            //     {
            //         yield return new TreeNode(
            //             null,
            //             StringParser.Parse(VelerSoftware.SZC.Properties.Resources.MainWindow_Windows_Debug_LocalVariables_StaticMembers),
            //             string.Empty,
            //             string.Empty,
            //             childs
            //         );
            //     }
            // }

            DebugType iListType = (DebugType)shownType.GetInterface(typeof(IList).FullName);

            if (iListType != null)
            {
                yield return(new IListNode(targetObject));
            }
            else
            {
                DebugType iEnumerableType, itemType;
                if (shownType.ResolveIEnumerableImplementation(out iEnumerableType, out itemType))
                {
                    yield return(new IEnumerableNode(targetObject, itemType));
                }
            }

            foreach (TreeNode node in LazyGetMembersOfObject(targetObject, publicInstance))
            {
                yield return(node);
            }
        }