예제 #1
0
        private void LoadResourceValues(ResourceReader.ResourceCacheItem[] store)
        {
            object obj = this.readerLock;

            lock (obj)
            {
                for (int i = 0; i < this.resourceCount; i++)
                {
                    ResourceReader.ResourceInfo resourceInfo = this.infos[i];
                    if (resourceInfo.TypeIndex == -1)
                    {
                        store[i] = new ResourceReader.ResourceCacheItem(resourceInfo.ResourceName, null);
                    }
                    else
                    {
                        this.reader.BaseStream.Seek(resourceInfo.ValuePosition, SeekOrigin.Begin);
                        object value;
                        if (this.resource_ver == 2)
                        {
                            value = this.ReadValueVer2(resourceInfo.TypeIndex);
                        }
                        else
                        {
                            value = this.ReadValueVer1(Type.GetType(this.typeNames[resourceInfo.TypeIndex], true));
                        }
                        store[i] = new ResourceReader.ResourceCacheItem(resourceInfo.ResourceName, value);
                    }
                }
            }
        }
예제 #2
0
            private void FillCache()
            {
                if (this.reader.cache != null)
                {
                    return;
                }
                object cache_lock = this.reader.cache_lock;

                lock (cache_lock)
                {
                    if (this.reader.cache == null)
                    {
                        ResourceReader.ResourceCacheItem[] array = new ResourceReader.ResourceCacheItem[this.reader.resourceCount];
                        this.reader.LoadResourceValues(array);
                        this.reader.cache = array;
                    }
                }
            }