コード例 #1
0
        private static void FillEntities(List <DTEntity> entities, CodeTreeNode node, bool isReadOnly, bool isPinned)
        {
            var name = JSON.GetStringValue(node.Name.ToString());

            if (node.Type == CodeType.Object)
            {
                var members = DTOPool.CreateDTEntities(isPinned);
                //收集成员
                foreach (CodeTreeNode item in node.Childs)
                {
                    FillEntities(members, item, isReadOnly, isPinned);
                }

                var obj = DTOPool.CreateDTEObject(members, isPinned);
                obj.Name = name;
                entities.Add(obj);
            }
            else if (node.Type == CodeType.List)
            {
                var childs = DTOPool.CreateObjects(isPinned);
                using (var temp = DTOPool.EntitiesPool.Borrow())
                {
                    //收集成员
                    var tempChilds = temp.Item;
                    foreach (CodeTreeNode item in node.Childs)
                    {
                        FillEntities(tempChilds, item, isReadOnly, isPinned);
                    }

                    foreach (var e in tempChilds)
                    {
                        var item = CreateDTObject(e, isReadOnly, isPinned);
                        childs.Add(item);
                    }
                }

                var list = DTOPool.CreateDTEList(childs, isPinned);
                list.Name = name;
                entities.Add(list);
            }
            else
            {
                object value = node.Type == CodeType.StringValue ? JSON.GetStringValue(node.Value) : JSON.GetValue(node.Value);
                var    dte   = DTOPool.CreateDTEValue(name, value, isPinned);
                entities.Add(dte);
            }
        }
コード例 #2
0
 public void Init(DTEList owner, bool isPinned)
 {
     _owner        = owner;
     this.IsPinned = isPinned;
     _list         = DTOPool.CreateObjects(isPinned);
 }
コード例 #3
0
 public static DTEList CreateDTEList(bool isPinned)
 {
     return(CreateDTEList(DTOPool.CreateObjects(isPinned), isPinned));
 }