Пример #1
0
        /// <summary>
        /// Remove compiled-created types and re-order
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        internal static ArchList <ArchitectType> Clean(this ArchList <ArchitectType> list)
        {
            ArchList <ArchitectType> alist = new ArchList <ArchitectType>();

            list.FindAll(a => !a.FullName.Contains("<>c") && !a.FullName.Contains("b__"))
            .OrderBy(a => a.FullName).ToList().ForEach(a => alist.Add(a));
            return(alist);
        }
        /// <summary>
        /// Post-initialization Architech Types Referenced
        /// </summary>
        /// <param name="includingSelf"></param>
        /// <returns></returns>
        public ArchList <ArchitectType> ReferencedTypes(bool includingSelf)
        {
            ArchList <ArchitectType> alist = new ArchList <ArchitectType>();

            if (referencedTypes == null)
            {
                DirectRefTypes.ForEach(a => alist.Add(DeclaringType.Architecture.Types.Find(A => A.Class == a)));
                referencedTypes = alist;
            }
            else
            {
                referencedTypes.ForEach(M => alist.Add(M));
            }

            if (!includingSelf)
            {
                alist.RemoveAll(A => A.FullName.Contains(DeclaringType.Name));
            }
            return(alist.Clean());
        }
        /// <summary>
        /// Post-initialization Architech Types Referenced
        /// </summary>
        /// <param name="includingSelf"></param>
        /// <returns></returns>
        public ArchList <ArchitectType> ReferentTypes(bool includingSelf)
        {
            ArchList <ArchitectType> alist = new ArchList <ArchitectType>();

            if (referentTypes == null)
            {
                DeclaringType.Architecture.Types.ForEach(A =>
                                                         { A.Members.FindAll(M => M.ReferencedTypes(includingSelf).Contains(DeclaringType)).ForEach(M => alist.Add(M.DeclaringType)); });
                referentTypes = alist;
            }
            else
            {
                referentTypes.ForEach(M => alist.Add(M));
            }

            if (!includingSelf)
            {
                alist.RemoveAll(A => A.FullName.Contains(DeclaringType.Name));
            }
            return(alist.Clean());
        }
        /// <summary>
        /// Post-initialization Architech Members Referenced
        /// </summary>
        /// <param name="includingSelf"></param>
        /// <returns></returns>
        public ArchList <ArchitectMember> ReferentMembers(bool includingSelf)
        {
            ArchList <ArchitectMember> alist = new ArchList <ArchitectMember>();

            if (referentMembers == null)
            {
                DeclaringType.Architecture.Types.ForEach(A =>
                                                         { alist.AddRange(A.Members.FindAll(M => M.ReferencedMembers(includingSelf).Contains(this))); });
                referentMembers = alist;
            }
            else
            {
                referentMembers.ForEach(M => alist.Add(M));
            }

            if (!includingSelf)
            {
                alist.RemoveAll(M => M.DeclaringType == DeclaringType);
            }
            return(alist.Clean());
        }