/// <summary>Dispose assets for the given content manager shim.</summary> /// <param name="shim">The content manager whose assets to dispose.</param> internal void DisposeFor(ContentManagerShim shim) { this.Monitor.Log($"Content manager '{shim.Name}' disposed, disposing assets that aren't needed by any other asset loader.", LogLevel.Trace); foreach (var entry in this.AssetLoaders) { entry.Value.Remove(shim); } this.InvalidateCache((key, type) => !this.AssetLoaders[key].Any(), dispose: true); }
/**** ** Disposal ****/ /// <summary>Dispose assets for the given content manager shim.</summary> /// <param name="shim">The content manager whose assets to dispose.</param> internal void DisposeFor(ContentManagerShim shim) { this.Monitor.Log($"Content manager '{shim.Name}' disposed, disposing assets that aren't needed by any other asset loader.", LogLevel.Trace); this.WithWriteLock(() => { foreach (var entry in this.ContentManagersByAssetKey) { entry.Value.Remove(shim); } this.InvalidateCache((key, type) => !this.ContentManagersByAssetKey.TryGetValue(key, out var managers) || !managers.Any(), dispose: true); }); }