public object Visit(SimpleNode g) { this.Write(g.Text ?? "<null>", false, false); return this._builder; }
internal static ObjectNode Create(ObjectNode parent, object item, int maxDepth, DataContextDriver dcDriver) { if (item is ObjectNode) { ObjectNode node = (ObjectNode)item; node.Parent = parent; return(node); } if (item == null) { return(new SimpleNode(parent, null)); } if (((!(item is string) && !(item is int)) && !(item is decimal)) && !(item is DateTime)) { Type type = item.GetType(); if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(Nullable <>))) { type = type.GetGenericArguments()[0]; } if (Type.GetTypeCode(type) == TypeCode.Object) { HandleObjectProxies(ref item, parent, dcDriver); } if (item == ObjectGraphInfo.GetDisplayNothingToken()) { return(new EmptyNode()); } if (item == null) { return(new SimpleNode(parent, null)); } } Type type2 = item.GetType(); if ((((item is byte[]) || (item is Binary)) && (parent != null)) && !(parent.ObjectValue is HeadingPresenter)) { string str; byte[] buffer = item as byte[]; if (buffer == null) { buffer = ((Binary)item).ToArray(); } if (buffer.Length <= 20) { StringBuilder builder = new StringBuilder(); foreach (byte num2 in buffer) { if (builder.Length > 0) { builder.Append(" "); } builder.AppendFormat("{0:X2}", num2); } str = builder.ToString(); } else { str = "byte[]"; } return(new SimpleNode(parent, str, "(binary data)", SimpleNodeKind.Metadata)); } if (((((((item is string) || (item is bool)) || ((item is char) || (item is TimeSpan))) || (((item is IFormattable) || (item is XObject)) || ((item is XName) || (item is XNamespace)))) || ((((item is SqlBoolean) || (item is SqlByte)) || ((item is SqlDateTime) || (item is SqlDecimal))) || (((item is SqlDouble) || (item is SqlGuid)) || ((item is SqlInt16) || (item is SqlInt32))))) || (((item is SqlInt64) || (item is SqlMoney)) || (item is SqlSingle))) || (item is SqlString)) { return(new SimpleNode(parent, item.ToString())); } if (item is XmlNode) { return(new SimpleNode(parent, XmlHelper.ToFormattedString((XmlNode)item))); } Type type3 = type2.IsGenericType ? type2.GetGenericTypeDefinition() : null; if (!(((!(type3 == typeof(EntitySet <>)) || (parent == null)) || (parent.IsAnonType || (parent is ListNode))) || (parent.ObjectValue is HeadingPresenter))) { return(new SimpleNode(parent, "EntitySet", type2.FormatTypeName(), SimpleNodeKind.Metadata)); } for (ObjectNode node3 = parent; node3 == null; node3 = node3.Parent) { Label_0305: if (0 == 0) { if ((type3 == typeof(Table <>)) && (node3 != null)) { return(new SimpleNode(parent, "Table", type2.FormatTypeName(), SimpleNodeKind.Metadata)); } if (item is DBNull) { return(new SimpleNode(parent, "null", "DbNull", SimpleNodeKind.Metadata)); } string text = null; ObjectNode payload = null; ReturnDataSet set = item as ReturnDataSet; if (set != null) { text = set.ReturnValue.ToString(); if (set.OutputParameters != null) { foreach (KeyValuePair <string, object> pair in set.OutputParameters) { if (pair.Value != null) { string str3 = text; text = str3 + ", " + pair.Key + "=" + pair.Value.ToString(); } } } payload = new SimpleNode(null, text); } if ((item is DataSet) && (((DataSet)item).Tables.Count == 1)) { item = ((DataSet)item).Tables[0]; } if (item is DataSet) { return(new ListPayloadNode(parent, ((DataSet)item).Tables, maxDepth, dcDriver, "Result Sets", payload, "ReturnValue")); } if (item is DataTable) { return(new ListPayloadNode(parent, ((DataTable)item).Rows, maxDepth, dcDriver, "Result Set", payload, "ReturnValue")); } if (item is DataRow) { return(new DataRowNode(parent, (DataRow)item, maxDepth, dcDriver)); } if (item is IDataReader) { DataReaderNode node5 = new DataReaderNode(parent, (IDataReader)item, maxDepth, dcDriver); if (node5.Items.Count == 1) { return(node5.Items[0]); } return(node5); } if (item is IDataRecord) { return(new DataRecordMemberNode(parent, null, (IDataRecord)item, maxDepth, dcDriver)); } if (type2.GetInterfaces().Any <Type>(t => t.FullName == typeof(ICustomMemberProvider).FullName)) { try { return(new CustomMemberProviderNode(parent, item, maxDepth, dcDriver, false)); } catch (Exception exception) { Log.Write(exception, "CustomMemberProvider"); } } if ((dcDriver != null) && (dcDriver.GetCustomDisplayMemberProvider(item) != null)) { return(new CustomMemberProviderNode(parent, item, maxDepth, dcDriver, true)); } if (item is Type) { for (ObjectNode node6 = parent; node6 != null; node6 = node6.Parent) { node6.HasTypeReferences = true; } } if (!(ExpandTypes || !(item is Type))) { return(new SimpleNode(parent, "typeof (" + ((Type)item).FormatTypeName() + ")", ((Type)item).FormatTypeName(true), SimpleNodeKind.Metadata) { HasTypeReferences = true }); } if (item is Image) { Image image = (Image)item; MemoryStream stream = new MemoryStream(); image.Save(stream, ImageFormat.Png); item = Util.Image(stream.ToArray()); } if (((!type2.IsArray && (item is IList)) && (((IList)item).Count == 1)) && (((IList)item)[0] == item)) { return(new ClrMemberNode(parent, item, maxDepth, dcDriver)); } if (type2.IsArray && (type2.GetArrayRank() == 2)) { Type elementType = type2.GetElementType(); if (elementType.IsGenericType && (elementType.GetGenericTypeDefinition() == typeof(Nullable <>))) { elementType = elementType.GetGenericArguments()[0]; } if (((typeof(IFormattable).IsAssignableFrom(elementType) || (elementType == typeof(bool))) || ((elementType == typeof(char)) || (elementType == typeof(TimeSpan)))) || (elementType == typeof(string))) { return(new MultiDimArrayNode(parent, (Array)item)); } } if (item is IEnumerable) { return(new ListNode(parent, (IEnumerable)item, maxDepth, dcDriver)); } if (item is Exception) { return(new ExceptionNode(parent, (Exception)item, maxDepth)); } if (item is DynamicObject) { return(new DynamicObjectMemberNode(parent, (DynamicObject)item, maxDepth, dcDriver)); } return(new ClrMemberNode(parent, item, maxDepth, dcDriver)); } } goto Label_0305; }