Пример #1
0
        public IEnumerable <ICodeAidTypeInfo> GetTypesInXmlNamespace(string xmlNamespaceString)
        {
            IProjectContext project = this.ProjectContext;

            foreach (IType type in this.AllTypesInProject())
            {
                if (CodeAidProvider.IsTypeInXmlNamespace(project, type, xmlNamespaceString))
                {
                    yield return((ICodeAidTypeInfo) new CodeAidTypeInfo(this, type));
                }
            }
        }
Пример #2
0
        private IEnumerable <IType> GetAllAttachedPropertyTypesInProject()
        {
            IProjectContext             project            = this.ProjectContext;
            IAttachedPropertiesProvider propertiesProvider = this.AttachedPropertiesProvider;

            if (propertiesProvider == null)
            {
                throw new NotSupportedException();
            }
            using (IAttachedPropertiesAccessToken token = propertiesProvider.AttachedProperties.Access())
            {
                CodeAidProvider.EnsurePreloadKnownAttachedProperties(token, project);
                return((IEnumerable <IType>)Enumerable.ToArray <IType>(Enumerable.Select(Enumerable.Where(Enumerable.Select(Enumerable.GroupBy <IAttachedPropertyMetadata, Type>((IEnumerable <IAttachedPropertyMetadata>)token.AllAttachedProperties(), (Func <IAttachedPropertyMetadata, Type>)(property => property.OwnerType)), typeGroup => new
                {
                    typeGroup = typeGroup,
                    type = project.GetType(typeGroup.Key)
                }), param0 => param0.type != null), param0 => param0.type)));
            }
        }
Пример #3
0
 public CodeAidAssemblyInfo(CodeAidProvider owner, IAssembly assembly)
     : base(owner, assembly.Name, (string)null)
 {
     this.assembly = assembly;
 }
Пример #4
0
 public CodeAidTypeInfo(CodeAidProvider owner, IType type)
     : base(owner, type.Name)
 {
     this.type = type;
 }
Пример #5
0
        private IEnumerable <IType> AllXamlRelevantTypesInAssembly(IAssembly assembly)
        {
            IProjectContext project         = this.ProjectContext;
            bool            supportInternal = assembly.Equals((object)project.ProjectAssembly);

            Type[] assemblyTypes = Type.EmptyTypes;
            try
            {
                assemblyTypes = AssemblyHelper.GetTypes(assembly);
            }
            catch (ReflectionTypeLoadException ex)
            {
                assemblyTypes = Type.EmptyTypes;
            }
            IAttachedPropertiesProvider attachedPropertiesProvider = this.AttachedPropertiesProvider;

            if (attachedPropertiesProvider == null)
            {
                throw new NotSupportedException();
            }
            Type[] allTypesWithAttachedProperties = (Type[])null;
            using (IAttachedPropertiesAccessToken token = attachedPropertiesProvider.AttachedProperties.Access())
            {
                CodeAidProvider.EnsurePreloadKnownAttachedProperties(token, project);
                allTypesWithAttachedProperties = Enumerable.ToArray <Type>(Enumerable.Select <IGrouping <Type, IAttachedPropertyMetadata>, Type>(Enumerable.GroupBy <IAttachedPropertyMetadata, Type>((IEnumerable <IAttachedPropertyMetadata>)token.AttachedPropertiesForAssembly(assembly.Name), (Func <IAttachedPropertyMetadata, Type>)(property => property.OwnerType)), (Func <IGrouping <Type, IAttachedPropertyMetadata>, Type>)(type => type.Key)));
            }
            foreach (Type type3 in assemblyTypes)
            {
                IType yieldedTypeId = (IType)null;
                try
                {
                    if (!type3.IsGenericType)
                    {
                        if (type3.IsVisible)
                        {
                            if (!type3.IsNested)
                            {
                                if (!typeof(Attribute).IsAssignableFrom(type3))
                                {
                                    if (!typeof(Exception).IsAssignableFrom(type3))
                                    {
                                        if (type3.IsPublic)
                                        {
                                            if (TypeUtilities.HasDefaultConstructor(type3, supportInternal) && TypeUtilities.CanCreateTypeInXaml((ITypeResolver)project, type3))
                                            {
                                                IType type1 = project.GetType(type3);
                                                if (JoltHelper.TypeSupported((ITypeResolver)project, (ITypeId)type1))
                                                {
                                                    yieldedTypeId = type1;
                                                }
                                            }
                                            else if (allTypesWithAttachedProperties != null)
                                            {
                                                if (OrderedListExtensions.GenericBinarySearch <Type, Type>(allTypesWithAttachedProperties, type3, (Func <Type, Type, int>)((type1, type2) => type1.Name.CompareTo(type2.Name))) >= 0)
                                                {
                                                    yieldedTypeId = project.GetType(type3);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (FileNotFoundException ex)
                {
                }
                if (yieldedTypeId != null)
                {
                    yield return(yieldedTypeId);
                }
            }
        }
Пример #6
0
 public IEnumerable <ICodeAidTypeInfo> GetAttachedPropertyTypesInXmlNamespace(string uri)
 {
     return(Enumerable.Cast <ICodeAidTypeInfo>((IEnumerable)Enumerable.Select <IType, CodeAidTypeInfo>(Enumerable.Where <IType>(this.GetAllAttachedPropertyTypesInProject(), (Func <IType, bool>)(type => CodeAidProvider.IsTypeInXmlNamespace(this.ProjectContext, type, uri))), (Func <IType, CodeAidTypeInfo>)(type => new CodeAidTypeInfo(this, type)))));
 }
Пример #7
0
 public CodeAidEventInfo(CodeAidProvider owner, IEvent eventId)
     : base(owner, eventId.Name)
 {
 }
Пример #8
0
 public CodeAidMethodInfo(CodeAidProvider owner, IMemberId memberId)
     : base(owner, memberId.Name)
 {
 }
Пример #9
0
 public CodeAidPropertyInfo(CodeAidProvider owner, IProperty property)
     : base(owner, property.Name)
 {
     this.property = property;
 }
Пример #10
0
 internal CodeAidInfoBase(CodeAidProvider owner, string name)
     : this(owner, name, (string)null)
 {
 }
Пример #11
0
 internal CodeAidInfoBase(CodeAidProvider owner, string name, string description)
 {
     this.Name            = name;
     this.DescriptionText = description;
     this.owner           = owner;
 }
 public CodeAidAttachedPropertyInfo(CodeAidProvider owner, string propertyName, Type propertyType)
     : base(owner, propertyName)
 {
     this.propertyType = propertyType;
 }