private static void ProcessClass(CodeClass cc, CodeClass baseClass, List <IntellisenseObject> list, HashSet <CodeClass> underProcess)
        {
            string                       baseNs        = null;
            string                       baseClassName = null;
            string                       ns            = GetNamespace(cc);
            string                       className     = GetClassName(cc);
            HashSet <string>             references    = new HashSet <string>();
            IList <IntellisenseProperty> properties    = GetProperties(cc.Members, new HashSet <string>(), references).ToList();

            foreach (CodeElement member in cc.Members)
            {
                if (ShouldProcess(member))
                {
                    ProcessElement(member, list, underProcess);
                }
            }

            if (baseClass != null)
            {
                baseClassName = GetClassName(baseClass);
                baseNs        = GetNamespace(baseClass);
            }

            var intellisenseObject = new IntellisenseObject(properties.ToList(), references)
            {
                Namespace     = ns,
                Name          = className,
                BaseNamespace = baseNs,
                BaseName      = baseClassName,
                FullName      = cc.FullName,
                Summary       = GetSummary(cc)
            };

            list.Add(intellisenseObject);
        }
Beispiel #2
0
        private static void ProcessEnum(CodeEnum element, List <IntellisenseObject> list)
        {
            IntellisenseObject data = new IntellisenseObject
            {
                Name      = element.Name,
                IsEnum    = element.Kind == vsCMElement.vsCMElementEnum,
                IsPublic  = element.Access == vsCMAccess.vsCMAccessPublic,
                FullName  = element.FullName,
                Namespace = GetNamespace(element),
                Summary   = GetSummary(element)
            };

            foreach (var codeEnum in element.Members.OfType <CodeVariable>())
            {
                var prop = new IntellisenseProperty
                {
                    Name           = codeEnum.Name,
                    Summary        = GetSummary(codeEnum),
                    InitExpression = GetInitializer(codeEnum.InitExpression)
                };

                data.Properties.Add(prop);
            }

            if (data.Properties.Count > 0)
            {
                list.Add(data);
            }
        }
Beispiel #3
0
        private static void ProcessClass(ProjectItem projectItem, DefinitionMapData definitionMapData, CodeClass cc, CodeClass baseClass, List <IntellisenseObject> list, HashSet <CodeClass> underProcess)
        {
            string                       baseNs        = null;
            string                       baseClassName = null;
            string                       ns            = GetNamespace(cc);
            string                       className     = GetClassName(cc);
            HashSet <string>             references    = new HashSet <string>();
            IList <IntellisenseProperty> properties    = GetProperties(projectItem, definitionMapData, cc.Members, new HashSet <string>(), references).ToList();

            foreach (CodeElement member in cc.Members)
            {
                if (ShouldProcess(member))
                {
                    ProcessElement(projectItem, definitionMapData, member, list, underProcess);
                }
            }

            if (baseClass != null)
            {
                baseClassName = GetClassName(baseClass);
                baseNs        = GetNamespace(baseClass);

                // Some definitions may be defined inside of another project
                if (baseClass.InfoLocation == vsCMInfoLocation.vsCMInfoLocationExternal)
                {
                    // Try retrieving the external codeclass by walking all references the current project has
                    if (TryGetExternalType(projectItem, definitionMapData, baseClass.FullName, out CodeClass2 codeClass, out CodeEnum codeEnum))
                    {
                        if (codeClass != null)
                        {
                            HasIntellisense(codeClass.ProjectItem, references);
                        }

                        if (codeEnum != null)
                        {
                            HasIntellisense(codeEnum.ProjectItem, references);
                        }
                    }
                }
                else
                {
                    HasIntellisense(baseClass.ProjectItem, references);
                }
            }

            var intellisenseObject = new IntellisenseObject(properties.ToList(), references)
            {
                Namespace     = ns,
                Name          = className,
                BaseNamespace = baseNs,
                BaseName      = baseClassName,
                FullName      = cc.FullName,
                Summary       = GetSummary(cc)
            };

            list.Add(intellisenseObject);
        }