Exemplo n.º 1
0
        /// <summary>
        /// 获取服务端所有变量
        /// </summary>
        /// <param name="bl"></param>
        private void GetServerAllTag(BLModal bl)
        {
            if (bl == null)
            {
                throw new ArgumentNullException();
            }
            if (bl.ItemType == ItemType.Tag)
            {
                _ServerTags.Add(new TagItem()
                {
                    Id       = Guid.NewGuid().ToString(),
                    ServerId = bl.GetID(),
                    Name     = bl.Name
                });
            }

            foreach (var item in bl.Children)
            {
                GetServerAllTag(item);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取服务端系统变量
        /// </summary>
        /// <param name="bl"></param>
        private void GetServerSysTag(BLModal bl)
        {
            if (bl == null)
            {
                throw new ArgumentNullException();
            }
            if (bl.ItemType == ItemType.Tag)
            {
                if (!string.IsNullOrEmpty(bl.Name) && bl.Name.StartsWith("_"))
                {
                    _ServerSysTags.Add(new TagItem()
                    {
                        Id       = Guid.NewGuid().ToString(),
                        ServerId = bl.GetID(),
                        Name     = bl.Name,
                    });
                }
            }

            foreach (var item in bl.Children)
            {
                GetServerSysTag(item);
            }
        }
Exemplo n.º 3
0
        private void GetItem(string node, BLModal bl, FildType type)
        {
            List <string> branch = this.GetBranch(node);
            List <string> leafs  = GetLeafs(node);

            //具体变量
            for (int i = 0; i < leafs.Count; i++)
            {
                if (type == FildType.User)
                {
                    if (!leafs[i].StartsWith("_"))
                    {
                        BLModal tmpBl = new BLModal()
                        {
                            Name = leafs[i], Parent = bl, ItemType = ItemType.Tag
                        };
                        bl.Children.Add(tmpBl);
                    }
                }
                else if (type == FildType.Sys)
                {
                    if (leafs[i].StartsWith("_"))
                    {
                        BLModal tmpBl = new BLModal()
                        {
                            Name = leafs[i], Parent = bl, ItemType = ItemType.Tag
                        };
                        bl.Children.Add(tmpBl);
                    }
                }
                else if (type == FildType.All)
                {
                    BLModal tmpBl = new BLModal()
                    {
                        Name = leafs[i], Parent = bl, ItemType = ItemType.Tag
                    };
                    bl.Children.Add(tmpBl);
                }
            }

            //导航元素
            for (int i = 0; i < branch.Count; i++)
            {
                if (type == FildType.User)
                {
                    if (!branch[i].StartsWith("_"))
                    {
                        BLModal tmpBl = new BLModal()
                        {
                            Name = branch[i], Parent = bl, ItemType = ItemType.Nav
                        };
                        bl.Children.Add(tmpBl);
                        GetItem(tmpBl.GetID(), tmpBl, FildType.User);
                    }
                }
                else if (type == FildType.Sys)
                {
                    if (branch[i].StartsWith("_"))
                    {
                        BLModal tmpBl = new BLModal()
                        {
                            Name = branch[i], Parent = bl, ItemType = ItemType.Nav
                        };
                        bl.Children.Add(tmpBl);
                        GetItem(tmpBl.GetID(), tmpBl, FildType.Sys);
                    }
                }
                else if (type == FildType.All)
                {
                    BLModal tmpBl = new BLModal()
                    {
                        Name = branch[i], Parent = bl, ItemType = ItemType.Nav
                    };
                    bl.Children.Add(tmpBl);
                    GetItem(tmpBl.GetID(), tmpBl, FildType.All);
                }
            }
        }