Пример #1
0
        /// <summary>
        /// Finds a <see cref="ProjectItem"/> by name.
        /// The comparison is not case sensitive.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="name">The name.</param>
        /// <param name="recursive">if set to <c>true</c> [recursive].</param>
        /// <returns></returns>
        public static ProjectItem FindItemByName(ProjectItems collection, string name, bool recursive)
        {
            Guard.ArgumentNotNull(name, "name");

            if (collection != null)
            {
                foreach (ProjectItem item1 in collection)
                {
                    if (item1.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(item1);
                    }
                    if (recursive)
                    {
                        ProjectItem item2 = DteHelperEx.FindItemByName(item1.ProjectItems, name, recursive);
                        if (item2 != null)
                        {
                            return(item2);
                        }
                    }
                }
            }

            return(null);
        }
Пример #2
0
        public static bool IsCSharpOrVbProject(EnvDTE.Project project, bool excludeWebProjects)
        {
            if (project == null)
            {
                return(false);
            }

            return(ReferenceUtil.IsCSharpProject(project) ||
                   (!excludeWebProjects && DteHelperEx.IsWebCSharpProject(project)) ||
                   IsVBProject(project) ||
                   (!excludeWebProjects && IsWebVBProject(project)));
        }