/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public System.Collections.Generic.List <string> GetMethodNames()
        {
            System.Collections.Generic.List <string> M = new List <string>();

            EnvDTE80.FileCodeModel2 FileCodeModel = this.Application.ActiveDocument.ProjectItem.FileCodeModel as EnvDTE80.FileCodeModel2;
            EnvDTE.CodeElements     elements      = FileCodeModel.CodeElements;

            foreach (EnvDTE.CodeElement element in elements)
            {
                if (element.Kind == EnvDTE.vsCMElement.vsCMElementNamespace)
                {
                    foreach (EnvDTE.CodeElement element2 in element.Children)
                    {
                        if (element2.Kind == EnvDTE.vsCMElement.vsCMElementClass)
                        {
                            EnvDTE80.CodeClass2 CurrentClass = element2 as EnvDTE80.CodeClass2;

                            foreach (EnvDTE.CodeElement element3 in element2.Children)
                            {
                                if (element3.Kind == EnvDTE.vsCMElement.vsCMElementFunction)
                                {
                                    EnvDTE80.CodeFunction2 CurrentFunction = element3 as EnvDTE80.CodeFunction2;
                                    M.Add(CurrentFunction.Name);
                                }
                            }
                        }
                    }
                }
            }
            return(M);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public string GetCurrentClassName()
        {
            EnvDTE80.FileCodeModel2 FileCodeModel = this.Application.ActiveDocument.ProjectItem.FileCodeModel as EnvDTE80.FileCodeModel2;
            EnvDTE.CodeElements     elements      = FileCodeModel.CodeElements;

            foreach (EnvDTE.CodeElement element in elements)
            {
                if (element.Kind == EnvDTE.vsCMElement.vsCMElementNamespace)
                {
                    foreach (EnvDTE.CodeElement element2 in element.Children)
                    {
                        if (element2.Kind == EnvDTE.vsCMElement.vsCMElementClass)
                        {
                            EnvDTE80.CodeClass2 CurrentClass = element2 as EnvDTE80.CodeClass2;
                            return(CurrentClass.Name);
                        }
                    }
                }
            }
            return(null);
        }
예제 #3
0
 public static TypeCache ByName(EnvDTE80.CodeClass2 cc)
 {
     return(TypeCacheList.ByName(cc));
 }