HaloOnlineLib.Resources.ResourceDataManager.LoadCache C# (CSharp) Method

LoadCache() public method

Loads a resource cache from a file.
Thrown if the cache is already loaded.
public LoadCache ( ResourceLocation location, string path ) : void
location ResourceLocation The resource cache type.
path string The path to the .dat file to read.
return void
        public void LoadCache(ResourceLocation location, string path)
        {
            if (_loadedCaches.ContainsKey(location))
                throw new InvalidOperationException("A resource cache for the " + location + " location has already been loaded.");

            var file = new FileInfo(path);
            using (var stream = file.OpenRead())
            {
                _loadedCaches[location] = new LoadedCache
                {
                    Cache = new ResourceCache(stream),
                    File = file
                };
            }
        }