protected ITargetObject GetStaticMember(ITargetStructType stype, StackFrame frame, ITargetMemberInfo member) { if (member is ITargetPropertyInfo) return GetStaticProperty (stype, frame, (ITargetPropertyInfo) member); else if (member is ITargetEventInfo) return GetStaticEvent (stype, frame, (ITargetEventInfo) member); else return GetStaticField (stype, frame, (ITargetFieldInfo) member); }
protected ITargetObject GetMember(ITargetStructObject sobj, ITargetMemberInfo member) { if (member is ITargetPropertyInfo) return GetProperty (sobj, (ITargetPropertyInfo) member); else if (member is ITargetEventInfo) return GetEvent (sobj, (ITargetEventInfo) member); else return GetField (sobj, (ITargetFieldInfo) member); }
bool InsertStructMember(TreeIter parent, ITargetStructObject sobj, ITargetMemberInfo member, bool is_field) { bool inserted = false; string icon_name = GetIcon (member); #if NET_2_0 DebuggerBrowsableAttribute battr = GetDebuggerBrowsableAttribute (member); if (battr != null) { TreeIter iter; switch (battr.State) { case DebuggerBrowsableState.Never: // don't display it at all continue; case DebuggerBrowsableState.Collapsed: // the default behavior for the debugger (c&p from the battr == null branch at the bottom of this function) iter = store.Append (parent); AddObject (member.Name, icon_name, is_field ? sobj.GetField (member.Index) : sobj.GetProperty (member.Index), iter); inserted = true; break; case DebuggerBrowsableState.Expanded: // add it as in the Collapsed case... iter = store.Append (parent); AddObject (member.Name, icon_name, is_field ? sobj.GetField (member.Index) : sobj.GetProperty (member.Index), iter); inserted = true; // then expand the row tree.ExpandRow (store.GetPath (iter), false); break; case DebuggerBrowsableState.RootHidden: ITargetObject member_obj = is_field ? sobj.GetField (member.Index) : sobj.GetProperty (member.Index); if (member_obj != null) { switch (member_obj.TypeInfo.Type.Kind) { case TargetObjectKind.Array: iter = store.Append (parent); // handle arrays normally, should check how vs2005 does this. AddObject (member.Name, icon_name, member_obj, iter); inserted = true; break; case TargetObjectKind.Class: try { inserted = InsertClassChildren (parent, (ITargetClassObject)member_obj, false); } catch { // what about this case? where the member is possibly // uninitialized, do we try to add it later? } break; case TargetObjectKind.Struct: try { inserted = InsertStructChildren (parent, (ITargetStructObject)member_obj, false); } catch { // what about this case? where the member is possibly // uninitialized, do we try to add it later? } break; default: // nothing break; } } break; } } else { #endif TreeIter iter = store.Append (parent); AddObject (member.Name, icon_name, is_field ? sobj.GetField (member.Index) : sobj.GetProperty (member.Index), iter); inserted = true; #if NET_2_0 } #endif return inserted; }
DebuggerBrowsableAttribute GetDebuggerBrowsableAttribute(ITargetMemberInfo info) { if (info.Handle != null && info.Handle is System.Reflection.MemberInfo) { System.Reflection.MemberInfo mi = (System.Reflection.MemberInfo)info.Handle; object[] attrs = mi.GetCustomAttributes (typeof (DebuggerBrowsableAttribute), false); if (attrs != null && attrs.Length > 0) return (DebuggerBrowsableAttribute)attrs[0]; } return null; }
string GetIcon(ITargetMemberInfo member) { string icon = ""; #if mdb_api_brokenness if (member.Handle is PropertyInfo) icon = Runtime.Gui.Icons.GetIcon ((PropertyInfo)member.Handle); else if (member.Handle is FieldInfo) icon = Runtime.Gui.Icons.GetIcon ((FieldInfo)member.Handle); #endif return icon; }