Exemplo n.º 1
0
        private void ReadResourceTable()
        {
            _resources = new Dictionary <uint, List <ResourceInfo> >();
            using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader))
            {
                long numRead = 0;
                while (numRead < s.Length)
                {
                    byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size);
                    numRead += ResourceInfo.Size;

                    ResourceInfo info = new ResourceInfo();
                    info.Read(resBuffer, 0);

                    uint hashHash = Utilities.ToUInt32LittleEndian(info.Hash, 0);

                    if (!_resources.ContainsKey(hashHash))
                    {
                        _resources[hashHash] = new List <ResourceInfo>(1);
                    }

                    _resources[hashHash].Add(info);
                }
            }
        }
Exemplo n.º 2
0
        internal ShortResourceHeader LocateImage(int index)
        {
            int i = 0;

            using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader))
            {
                long numRead = 0;
                while (numRead < s.Length)
                {
                    byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size);
                    numRead += ResourceInfo.Size;

                    ResourceInfo info = new ResourceInfo();
                    info.Read(resBuffer, 0);

                    if ((info.Header.Flags & ResourceFlags.MetaData) != 0)
                    {
                        if (i == index)
                        {
                            return(info.Header);
                        }

                        ++i;
                    }
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        private void ReadResourceTable()
        {
            _resources = new Dictionary<uint, List<ResourceInfo>>();
            using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader))
            {
                long numRead = 0;
                while (numRead < s.Length)
                {
                    byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size);
                    numRead += ResourceInfo.Size;

                    ResourceInfo info = new ResourceInfo();
                    info.Read(resBuffer, 0);

                    uint hashHash = Utilities.ToUInt32LittleEndian(info.Hash, 0);

                    if (!_resources.ContainsKey(hashHash))
                    {
                        _resources[hashHash] = new List<ResourceInfo>(1);
                    }

                    _resources[hashHash].Add(info);
                }
            }
        }
Exemplo n.º 4
0
        internal ShortResourceHeader LocateImage(int index)
        {
            int i = 0;

            using (Stream s = OpenResourceStream(_fileHeader.OffsetTableHeader))
            {
                long numRead = 0;
                while (numRead < s.Length)
                {
                    byte[] resBuffer = Utilities.ReadFully(s, ResourceInfo.Size);
                    numRead += ResourceInfo.Size;

                    ResourceInfo info = new ResourceInfo();
                    info.Read(resBuffer, 0);

                    if ((info.Header.Flags & ResourceFlags.MetaData) != 0)
                    {
                        if (i == index)
                        {
                            return info.Header;
                        }

                        ++i;
                    }
                }
            }

            return null;
        }