public RICustomData Copy() { RICustomData copy = new RICustomData(Caption, new List <RICustomDataColumn>(Columns), ShowColumns, IsPropertyGrid) { AllowSort = AllowSort, HasDetails = HasDetails, MaxCategoryLevels = MaxCategoryLevels, Expanded = Expanded }; copy.Children.AddRange(Children); return(copy); }
internal RICustomDataCategory(RICustomData root, String caption, RICustomDataElementType cType, Int16 level) : base(root, cType, level) { Root = root; Caption = caption; Expanded = true; Children = new List <RICustomDataElement>(); if (Root != null) { if ((level + 1) > root.MaxCategoryLevels) { root.MaxCategoryLevels = (Int16)(level + 1); } } }
private static void UpdateCustomData(RICustomData cData, String groupName, List <ListNode> list) { if (list.Count == 0) { return; } RICustomDataCategory cat = cData.AddCategory(groupName); using (var pool = FastFormatterPool.Pool.Container()) { foreach (ListNode node in list) { RICustomDataRow row = cat.AddRow(); row.AddField(node.FName); row.AddField(node.FValue); row.SetExtraData(pool.Instance, new DetailContainerInt32(node.FStates.GetHashCode())); } } }
public static RICustomData BuildObjectPropertyMap(Object obj, ObjectScope scope) { if (obj == null) { throw new NullReferenceException("BuildObjectPropertyMap: Object cannot be null."); } // Scope must contain one or more of the following // enumerated ObjectScope values: Public, Protected, Private and/or All if (scope > ObjectScope.All) { throw new ArgumentException("BuildObjectPropertyMap: Invalid ObjectScope defined. Scope must have one or more of the following: Public, Protected, Private and/or All"); } BindingFlags bindings = BindingFlags.Static | BindingFlags.Instance; if ((scope & ObjectScope.Public) != ObjectScope.None) { bindings |= BindingFlags.Public; } if (((scope & ObjectScope.Protected) != ObjectScope.None) || ((scope & ObjectScope.Private) != ObjectScope.None)) { bindings |= BindingFlags.NonPublic; } List <ListNode> privateList = new List <ListNode>(); List <ListNode> protectedList = new List <ListNode>(); List <ListNode> publicList = new List <ListNode>(); Type typ = obj.GetType(); // Get FieldInfo foreach (FieldInfo field in typ.GetFields(bindings)) { if (field.IsPublic) { publicList.Add(new ListNode(field, obj)); } else if (field.IsPrivate && (scope & ObjectScope.Private) != ObjectScope.None) { privateList.Add(new ListNode(field, obj)); } else if ((scope & ObjectScope.Protected) != ObjectScope.None) { protectedList.Add(new ListNode(field, obj)); } } // Get PropertyInfo with at least a GetMethod foreach (PropertyInfo prop in typ.GetProperties(bindings)) { if (!prop.CanRead) { continue; } MethodInfo mInfo = prop.GetGetMethod(true); if (mInfo.IsPublic) { publicList.Add(new ListNode(prop, obj)); } else if (mInfo.IsPrivate && (scope & ObjectScope.Private) != ObjectScope.None) { privateList.Add(new ListNode(prop, obj)); } else if ((scope & ObjectScope.Protected) != ObjectScope.None) { protectedList.Add(new ListNode(prop, obj)); } } if (privateList.Count > 0) { privateList.Sort((a, b) => { return(String.Compare(a.FName, b.FName, true)); }); } if (protectedList.Count > 0) { protectedList.Sort((a, b) => { return(String.Compare(a.FName, b.FName, true)); }); } if (publicList.Count > 0) { publicList.Sort((a, b) => { return(String.Compare(a.FName, b.FName, true)); }); } List <RICustomDataColumn> columns = new List <RICustomDataColumn>(); columns.Add(new RICustomDataColumn("Property")); columns.Add(new RICustomDataColumn("Value")); RICustomData cData = new RICustomData(String.Format("Type: {0}", typ.FullName), columns, true, true); // Only do this if necessary. if (privateList.Count > 0) { UpdateCustomData(cData, "Private", privateList); } if (protectedList.Count > 0) { UpdateCustomData(cData, "Protected", protectedList); } if (publicList.Count > 0) { UpdateCustomData(cData, "Public", publicList); } return(cData); }
internal RICustomDataCategory(RICustomData root, String caption, Int16 level) : this(root, caption, RICustomDataElementType.Category, level) { }
// non-serialize internal RICustomDataRow(RICustomData root, Int16 level) : base(root, RICustomDataElementType.Row, level) { Fields = new List <RICustomDataField>(); ClearExtraData(); }
internal RICustomDataField(RICustomData root, Object value, Int16 cPos, Int16 level) : base(root, RICustomDataElementType.Field, level) { Value = value; ColumnPos = cPos; Column = root.Columns[cPos]; }
internal RICustomDataElement(RICustomData root, RICustomDataElementType cType, Int16 level) { Root = root; CustomDataType = cType; Level = level; }