Ejemplo n.º 1
0
        private ResourceType(ResourceCollection resources, ResourceDirectoryEntry entry, ResourceId id)
        {
            _resources = new Resource[0];

            Resources = resources;
            Entry     = entry;
            Id        = id;
            Count     = 0;
        }
Ejemplo n.º 2
0
        protected Resource(PortableExecutableImage image, ResourceType type, ResourceDirectoryEntry entry, ResourceId id)
        {
            _languages = BuildLanguages(entry);

            Type      = type;
            Entry     = entry;
            Id        = id;
            Languages = _languages.Keys.OrderBy(k => k).ToArray();
            Image     = image;
        }
Ejemplo n.º 3
0
        internal ResourceDataEntry(DataDirectory dataDirectory, Location dataLocation, ResourceDirectoryEntry directoryEntry)
            : base(dataDirectory,dataLocation)
        {
            Stream stream = directoryEntry.Directory.DataDirectory.Directories.Image.GetStream();

            stream.Seek(dataLocation.FileOffset.ToInt64(),SeekOrigin.Begin);

            directory_entry = directoryEntry;
            entry = Utils.Read<IMAGE_RESOURCE_DATA_ENTRY>(stream);
            data = GetData();
        }
Ejemplo n.º 4
0
        private Dictionary <ResourceLanguage, ResourceDirectoryEntry> BuildLanguages(ResourceDirectoryEntry parentEntry)
        {
            var results   = new Dictionary <ResourceLanguage, ResourceDirectoryEntry>();
            var directory = parentEntry.GetDirectory();

            foreach (var entry in directory)
            {
                results.Add(entry.GetId(), entry);
            }

            return(results);
        }
Ejemplo n.º 5
0
 public CursorResource(ResourceType owningType, ResourceDirectoryEntry directoryEntry)
     : base(owningType, directoryEntry)
 {
 }
Ejemplo n.º 6
0
 public BitmapResource(ResourceType owningType, ResourceDirectoryEntry directoryEntry)
     : base(owningType, directoryEntry)
 {
 }
Ejemplo n.º 7
0
 public VersionResource(ResourceType owningType, ResourceDirectoryEntry directoryEntry)
     : base(owningType, directoryEntry)
 {
 }
Ejemplo n.º 8
0
        internal ResourceDataEntry(PortableExecutableImage image, DataDirectory dataDirectory, Location location, ResourceDirectoryEntry directoryEntry) : base(image, dataDirectory, location)
        {
            _data = null;

            DirectoryEntry = directoryEntry;
        }
Ejemplo n.º 9
0
 public DialogResource(ResourceType owningType, ResourceDirectoryEntry directoryEntry)
     : base(owningType, directoryEntry)
 {
 }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }