示例#1
0
        private void Initialize()
        {
            root.ReadOriginalValue = () =>
            {
                if (rsrcReader == null)
                {
                    return(null);    // It's disposed
                }
                long oldPos = rsrcReader.Position;
                rsrcReader.Position = 0;
                var dir = new ResourceDirectoryPE(0, new ResourceName("root"), this, rsrcReader);
                rsrcReader.Position = oldPos;
                return(dir);
            };
#if THREAD_SAFE
            root.Lock = theLock;
#endif
        }
        private ResourceDirectory ReadResourceDirectory(int i)
        {
#if THREAD_SAFE
            resources.theLock.EnterWriteLock(); try {
#endif
            var info   = dirInfos[i];
            var reader = resources.ResourceReader;
            var oldPos = reader.Position;
            reader.Position = info.offset;

            var dir = new ResourceDirectoryPE(depth + 1, info.name, resources, reader);

            reader.Position = oldPos;
            return(dir);

#if THREAD_SAFE
        }
        finally { resources.theLock.ExitWriteLock(); }
#endif
        }