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))); } }
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); } } }