static private async Task LoadAssetAsync(string filePath, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); string assetPath = Path.GetFileNameWithoutExtension(filePath); // Get uncached asset to determine content type IAsset <object> uncachedAsset = _rawContentLibrary.GetAsset <object>(assetPath); object content = await uncachedAsset.GetContentAsync(cancellationToken); await uncachedAsset.ReleaseAsync(); switch (content) { case Texture2D _: _spriteLoader.AssetPath = assetPath; break; case SoundEffect _: const string key = nameof(key); _soundLoader.Remove(key); _soundLoader.Add(key, assetPath); await _soundLoader.LoadContent(_game.Engine.ContentLibrary); _soundEmitter.Play(key); break; case Song _: _songPlayer.AssetPath = assetPath; break; } }