// Object graph visualizer: collection support temp disabled (porting to new NRefactory).
		/*void LoadNodeCollectionContent(AbstractNode node, GraphExpression thisObject, DebugType iListType)
		{
			var thisObjectAsIList = new GraphExpression(thisObject.Expr.CastToIList(), thisObject.GetValue);
			int listCount = thisObjectAsIList.GetValue().GetIListCount();
			PropertyInfo indexerProp = iListType.GetProperty("Item");
			
			var v = new List<String>();
			
			for (int i = 0; i < listCount; i++)	{
				var itemExpr = new GraphExpression(
					thisObjectAsIList.Expr.AppendIndexer(i),
					() => thisObjectAsIList.GetValue().GetIListItem(i)  // EXPR-EVAL, Does a 'cast' to IList
				);
				PropertyNode itemNode = new PropertyNode(
					new ObjectGraphProperty { Name = "[" + i + "]", MemberInfo = indexerProp, Expression = itemExpr, Value = "", IsAtomic = true, TargetNode = null });
				node.AddChild(itemNode);
			}
		}*/
		
		void LoadNodeObjectContent(AbstractNode node, GraphExpression expression, IType type)
		{
			// base
			var baseType = type.DirectBaseTypes.FirstOrDefault();
			if (baseType != null) {
				var baseClassNode = new BaseClassNode(baseType.FullName, baseType.Name);
				node.AddChild(baseClassNode);
				LoadNodeObjectContent(baseClassNode, expression, baseType);
			}
			
			var members = type.GetFieldsAndNonIndexedProperties(GetMemberOptions.IgnoreInheritedMembers).
				Where(m => !m.IsStatic && !m.IsSynthetic && !m.Name.EndsWith(">k__BackingField")).
				ToList();
			// non-public members
			var nonPublicProperties = createProperties(expression, members.Where(m => !m.IsPublic));
			if (nonPublicProperties.Count > 0) {
				var nonPublicMembersNode = new NonPublicMembersNode();
				node.AddChild(nonPublicMembersNode);
				foreach (var nonPublicProperty in nonPublicProperties) {
					nonPublicMembersNode.AddChild(new PropertyNode(nonPublicProperty));
				}
			}
			
			// public members
			foreach (var property in createProperties(expression, members.Where(m => m.IsPublic))) {
				node.AddChild(new PropertyNode(property));
			}
		}
示例#2
0
		void LoadNodeObjectContent(AbstractNode node, Expression expression, DebugType type)
		{
			// base
			if (type.BaseType != null && type.BaseType.FullName != "System.Object")
			{
				var baseClassNode = new BaseClassNode(type.BaseType.FullName, type.BaseType.Name);
				node.AddChild(baseClassNode);
				LoadNodeObjectContent(baseClassNode, expression, (DebugType)type.BaseType);
			}
			
			// non-public members
			var nonPublicProperties = getProperties(expression, type, this.nonPublicInstanceMemberFlags);
			if (nonPublicProperties.Count > 0)
			{
				var nonPublicMembersNode = new NonPublicMembersNode();
				node.AddChild(nonPublicMembersNode);
				foreach (var nonPublicProperty in nonPublicProperties)
				{
					nonPublicMembersNode.AddChild(new PropertyNode(nonPublicProperty));
				}
			}
			
			// public members
			foreach (var property in getProperties(expression, type, this.publicInstanceMemberFlags))
			{
				node.AddChild(new PropertyNode(property));
			}
		}
		void AddRawViewNode(AbstractNode contentRoot, ObjectGraphNode thisNode) {
			var rawViewNode = new RawViewNode();
			contentRoot.AddChild(rawViewNode);
			LoadNodeObjectContent(rawViewNode, thisNode.Expression, thisNode.PermanentReference.Type);
		}
示例#4
0
		void LoadNodeCollectionContent(AbstractNode node, Expression thisObject, DebugType iListType)
		{
			thisObject = thisObject.CastToIList();
			int listCount = thisObject.GetIListCount();
			PropertyInfo indexerProp = iListType.GetProperty("Item");
			
			for (int i = 0; i < listCount; i++)	{
				Expression itemExpr = thisObject.AppendIndexer(i);
				PropertyNode itemNode = new PropertyNode(
					new ObjectGraphProperty { Name = "[" + i + "]", MemberInfo = indexerProp, Expression = itemExpr, Value = "", IsAtomic = true, TargetNode = null });
				node.AddChild(itemNode);
			}
		}