MonoGame.Extended
MonoGame.Extended copied to clipboard
Change ExtendedContentManager method accessors
Hi. I’m not sure if it would be possible to change the accessor to protected in the following methods of the ExtendedContentManager class.
private FileStream GetStream(string path)
{
if (Path.IsPathRooted(path))
{
return File.OpenRead(path);
}
return (FileStream)TitleContainer.OpenStream(path);
}
private void CacheAsset(string name, object obj)
{
LoadedAssets.Add(name, obj);
if (obj is IDisposable disposable)
{
DisposeableAssets.Add(disposable);
}
}
private bool NoExtension(string name) => string.IsNullOrEmpty(Path.GetExtension(name));
private bool TryGetCachedAsset<T>(string name, out T asset)
{
asset = default;
if (LoadedAssets.TryGetValue(name, out object value))
{
if (value is T)
{
asset = (T)value;
return true;
}
}
return false;
}
This would help in creating derived classes without unnecessary code duplication.