ResourceDirectory ReadResourceDirectory(int i)
        {
            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);
        }
 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);
     };
 }
        private void Initialize()
        {
            root.ReadOriginalValue = () =>
            {
                if (rsrcReader == null)
                {
                    return(null); // It's disposed
                }
                var 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
        }
Esempio n. 4
0
        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
        }
		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;
			};
		}
		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
		}
		ResourceDirectory ReadResourceDirectory(int i) {
			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;
		}