private LoadedCache GetCache(ResourceReference resource) { LoadedCache cache; if (!_loadedCaches.TryGetValue(resource.GetLocation(), out cache)) throw new InvalidOperationException("The requested resource is located in " + resource.GetLocation() + ", but the corresponding cache file has not been loaded."); return cache; }