/// <summary>
        /// 自动选择项目
        /// </summary>
        /// <param name="isB1">b1平台</param>
        /// <param name="dbType">数据库类型</param>
        /// <param name="dsItems">待选择的项目</param>
        /// <returns></returns>
        public IList <DataStructureItem> AutoSelected(bool isB1, emDatabaseType dbType, IList <DataStructureItem> dsItems)
        {
            if (dsItems == null)
            {
                return(dsItems);
            }
            //清理历史选择
            foreach (var item in dsItems)
            {
                item.Selected = false;
            }
            dsItems = dsItems.Where(c => c.FileName.IndexOf(".manual.", StringComparison.InvariantCultureIgnoreCase) < 0).ToList(); //手工选择项,不自动选择。
            var b1List = new List <string>();                                                                                       //B1组

            if (isB1)
            {
                //先选择 b1 平台结构
                foreach (var item in dsItems)
                {
                    if (item.Platform == emPlatform.ibas)
                    {
                        if (item.Group.IndexOf(@"\B1", StringComparison.InvariantCultureIgnoreCase) >= 0)
                        {
                            //仅选择B1文件夹中
                            //ibas平台项目
                            if (item.ItemType == emDSItemType.data_structure)
                            {
                                //数据项目
                                item.Selected = true;
                                if (!b1List.Contains(item.Group))
                                {
                                    b1List.Add(item.Group);
                                }
                            }
                            if (item.ItemType == emDSItemType.sql_script)
                            {
                                //脚本项目
                                if (item.DatabaseType == dbType ||
                                    item.DatabaseType == emDatabaseType.all)
                                {
                                    item.Selected = true;
                                }
                                if (!b1List.Contains(item.Group))
                                {
                                    b1List.Add(item.Group);
                                }
                            }
                        }
                    }
                }
            }
            //选择其他结构
            foreach (var item in dsItems)
            {
                if (item.ItemType == emDSItemType.data_structure)
                {
                    //数据结构
                    if (item.Platform == emPlatform.b1)
                    {
                        if (isB1)
                        {
                            item.Selected = true;
                        }
                    }
                    if (item.Platform == emPlatform.ibas)
                    {
                        if (item.Group.IndexOf(@"\B1", StringComparison.InvariantCultureIgnoreCase) >= 0)
                        {
                            continue;                                                                              //b1文件夹不做处理
                        }
                        var tmpItem = b1List.FirstOrDefault(c => c.IndexOf(item.Group) >= 0 ||
                                                            (c.IndexOf(item.Group) < 0 && string.Equals(this.GetGroupName(c), this.GetGroupName(item.Group), StringComparison.InvariantCultureIgnoreCase))
                                                            );
                        if (tmpItem == null)
                        {
                            item.Selected = true;
                        }
                    }
                }
                if (item.ItemType == emDSItemType.sql_script)
                {
                    //脚本
                    if (item.Platform == emPlatform.b1)
                    {
                        if (isB1)
                        {
                            if (item.DatabaseType == dbType ||
                                item.DatabaseType == emDatabaseType.all)
                            {
                                item.Selected = true;
                            }
                        }
                    }
                    if (item.Platform == emPlatform.ibas)
                    {
                        if (item.Group.IndexOf(@"\B1", StringComparison.InvariantCultureIgnoreCase) >= 0)
                        {
                            continue;                                                                              //b1文件夹不做处理
                        }
                        //var tmpItem = b1List.FirstOrDefault(c => c.IndexOf(item.Group) >= 0
                        //        || (c.IndexOf(item.Group) < 0 && string.Equals(this.GetGroupName(c), this.GetGroupName(item.Group), StringComparison.InvariantCultureIgnoreCase))
                        //    );
                        //if (tmpItem == null)
                        if (item.DatabaseType == dbType ||
                            item.DatabaseType == emDatabaseType.all)
                        {
                            item.Selected = true;
                        }
                    }
                }
            }
            return(dsItems);
        }
        /// <summary>
        /// 自动选择项目
        /// </summary>
        /// <param name="isB1">b1平台</param>
        /// <param name="dbType">数据库类型</param>
        /// <returns></returns>
        public IList <DataStructureItem> GetSelecteds(bool isB1, emDatabaseType dbType)
        {
            var dsItems = this.Get();

            return(this.AutoSelected(isB1, dbType, dsItems));
        }