/// <summary> /// WinMD reference info /// </summary> /// <param name="InWindMDSourcePath"></param> /// <param name="InPackageRelativeDllPath"></param> public WinMDRegistrationInfo(FileReference InWindMDSourcePath, string InPackageRelativeDllPath) { PackageRelativeDllPath = InPackageRelativeDllPath; ResolveSearchPaths.Add(InWindMDSourcePath.Directory.FullName); if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64) { ActivatableTypesList = new List <ActivatableType>(); Assembly DependsOn = Assembly.ReflectionOnlyLoadFrom(InWindMDSourcePath.FullName); foreach (Type WinMDType in DependsOn.GetExportedTypes()) { bool IsActivatable = false; string ThreadingModelName = "both"; foreach (CustomAttributeData Attr in WinMDType.CustomAttributes) { if (Attr.AttributeType.FullName == "Windows.Foundation.Metadata.ActivatableAttribute" || Attr.AttributeType.FullName == "Windows.Foundation.Metadata.StaticAttribute") { IsActivatable = true; } else if (Attr.AttributeType.FullName == "Windows.Foundation.Metadata.ThreadingAttribute") { CustomAttributeTypedArgument Argument = Attr.ConstructorArguments[0]; ThreadingModelName = Enum.GetName(Argument.ArgumentType, Argument.Value).ToLowerInvariant(); } } if (IsActivatable) { ActivatableTypesList.Add(new ActivatableType(WinMDType.FullName, ThreadingModelName)); } } } }
/// <summary> /// WinMD reference info /// </summary> /// <param name="InWindMDSourcePath"></param> /// <param name="InPackageRelativeDllPath"></param> public WinMDRegistrationInfo(FileReference InWindMDSourcePath, string InPackageRelativeDllPath) { PackageRelativeDllPath = InPackageRelativeDllPath; ResolveSearchPaths.Add(InWindMDSourcePath.Directory.FullName); if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64) { ActivatableTypesList = new List <ActivatableType>(); #if !__MonoCS__ && !MONO var DependsOn = Assembly.ReflectionOnlyLoadFrom(InWindMDSourcePath.FullName); foreach (var WinMDType in DependsOn.GetExportedTypes()) { bool IsActivatable = false; object ThreadingModel = Windows.Foundation.Metadata.ThreadingModel.Both; foreach (var Attr in WinMDType.CustomAttributes) { if (Attr.AttributeType.AssemblyQualifiedName == typeof(Windows.Foundation.Metadata.ActivatableAttribute).AssemblyQualifiedName || Attr.AttributeType.AssemblyQualifiedName == typeof(Windows.Foundation.Metadata.StaticAttribute).AssemblyQualifiedName) { IsActivatable = true; } else if (Attr.AttributeType.AssemblyQualifiedName == typeof(Windows.Foundation.Metadata.ThreadingAttribute).AssemblyQualifiedName) { ThreadingModel = Attr.ConstructorArguments[0].Value; } } if (IsActivatable) { ActivatableTypesList.Add(new ActivatableType(WinMDType.FullName, ThreadingModel)); } } #endif } }