private List <ObjectGraphProperty> getProperties(Expression expression, DebugType shownType, BindingFlags flags) { List <ObjectGraphProperty> propertyList = new List <ObjectGraphProperty>(); foreach (MemberInfo memberProp in shownType.GetFieldsAndNonIndexedProperties(flags)) { // skip backing fields if (memberProp.Name.Contains("<")) { continue; } // ObjectGraphProperty needs an expression // to use expanded / nonexpanded (and to evaluate?) Expression propExpression = expression.AppendMemberReference((IDebugMemberInfo)memberProp); // Value, IsAtomic are lazy evaluated propertyList.Add(new ObjectGraphProperty { Name = memberProp.Name, Expression = propExpression, Value = "", /*PropInfo = memberProp,*/ IsAtomic = true, TargetNode = null }); } return(propertyList.Sorted(ObjectPropertyComparer.Instance)); }
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); } }
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; } }
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); } }
/// <summary> /// Gets members that will be displayed as columns. /// </summary> public IList <MemberInfo> GetItemTypeMembers() { var publicPropetiesAndFields = itemType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Instance); return(publicPropetiesAndFields); }
/// <summary> /// Gets members that will be displayed as columns. /// </summary> public IList <MemberInfo> GetItemTypeMembers() { return(itemType.GetFieldsAndNonIndexedProperties(BindingFlags.Public | BindingFlags.Instance)); }
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); } }