using StardewValley; namespace StardewModdingAPI.Framework { /// A minimal content manager which defers to SMAPI's main content manager. internal class ContentManagerShim : LocalizedContentManager { /********* ** Properties *********/ /// SMAPI's underlying content manager. private readonly SContentManager ContentManager; /********* ** Accessors *********/ /// The content manager's name for logs (if any). public string Name { get; } /********* ** Public methods *********/ /// Construct an instance. /// SMAPI's underlying content manager. /// The content manager's name for logs (if any). public ContentManagerShim(SContentManager contentManager, string name) : base(contentManager.ServiceProvider, contentManager.RootDirectory, contentManager.CurrentCulture, contentManager.LanguageCodeOverride) { this.ContentManager = contentManager; this.Name = name; } /// Load an asset that has been processed by the content pipeline. /// The type of asset to load. /// The asset path relative to the loader root directory, not including the .xnb extension. public override T Load(string assetName) { return this.ContentManager.LoadFor(assetName, this); } /// Dispose held resources. /// Whether the content manager is disposing (rather than finalising). protected override void Dispose(bool disposing) { this.ContentManager.DisposeFor(this); } } }