public static TreeNode_Editor NewChildNodeFromField(TreeNode_Editor parent, FieldInfo fieldInfo) { TreeNode_Editor treeNode_Editor = new TreeNode_Editor(); treeNode_Editor.parentNode = parent; treeNode_Editor.nestDepth = parent.nestDepth + 1; treeNode_Editor.owningField = fieldInfo; if (!fieldInfo.FieldType.IsValueEditable()) { treeNode_Editor.obj = fieldInfo.GetValue(parent.obj); treeNode_Editor.RebuildChildNodes(); } treeNode_Editor.InitiallyCacheData(); return(treeNode_Editor); }
public static TreeNode_Editor NewRootNode(object rootObj) { if (rootObj.GetType().IsValueEditable()) { throw new ArgumentException(); } TreeNode_Editor treeNode_Editor = new TreeNode_Editor(); treeNode_Editor.owningField = null; treeNode_Editor.obj = rootObj; treeNode_Editor.nestDepth = 0; treeNode_Editor.RebuildChildNodes(); treeNode_Editor.InitiallyCacheData(); return(treeNode_Editor); }
private static TreeNode_Editor NewChildNodeFromListItem(TreeNode_Editor parent, int listIndex) { TreeNode_Editor treeNode_Editor = new TreeNode_Editor(); treeNode_Editor.parentNode = parent; treeNode_Editor.nestDepth = parent.nestDepth + 1; treeNode_Editor.owningIndex = listIndex; object obj = parent.obj; Type type = obj.GetType(); if (!type.GetGenericArguments()[0].IsValueEditable()) { object obj2 = (treeNode_Editor.obj = type.GetProperty("Item").GetValue(obj, new object[1] { listIndex })); treeNode_Editor.RebuildChildNodes(); } treeNode_Editor.InitiallyCacheData(); return(treeNode_Editor); }