internal static async Task <ResourceType> CreateAsync(PortableExecutableImage image, ResourceCollection resources, ResourceDirectoryEntry entry) { ResourceId id; if (entry.NameType == NameType.ID) { id = entry.GetId(); } else { id = await entry.GetNameAsync().ConfigureAwait(false); } var type = new ResourceType(resources, entry, id); await type.LoadResourcesAsync(image).ConfigureAwait(false); return(type); }
internal static async Task <Resource> CreateAsync(PortableExecutableImage image, ResourceType type, ResourceDirectoryEntry entry, Type resourceType) { ResourceId id; if (entry.NameType == NameType.ID) { id = entry.GetId(); } else { id = await entry.GetNameAsync().ConfigureAwait(false); } var ctors = resourceType.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); var ctor = ctors.First(); var resource = (Resource)ctor.Invoke(new object[] { image, type, entry, id }); return(resource); }