/// <summary> /// Loads a resource cache from a file. /// </summary> /// <param name="location">The resource cache type.</param> /// <param name="path">The path to the .dat file to read.</param> /// <exception cref="System.InvalidOperationException">Thrown if the cache is already loaded.</exception> 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 }; } }
/// <summary> /// Loads a resource cache from a file. /// </summary> /// <param name="location">The resource cache type.</param> /// <param name="path">The path to the .dat file to read.</param> /// <exception cref="System.InvalidOperationException">Thrown if the cache is already loaded.</exception> 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 }; } }