mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
add ITextureProvider.GetFromFile(FileInfo)
This commit is contained in:
parent
df5c1bfead
commit
a3a7acc45e
3 changed files with 29 additions and 3 deletions
|
|
@ -26,6 +26,10 @@ internal sealed partial class TextureManager
|
|||
/// <inheritdoc/>
|
||||
ISharedImmediateTexture ITextureProvider.GetFromFile(string path) =>
|
||||
this.Shared.GetFromFile(path);
|
||||
|
||||
/// <inheritdoc/>
|
||||
ISharedImmediateTexture ITextureProvider.GetFromFile(FileInfo file) =>
|
||||
this.Shared.GetFromFile(file);
|
||||
|
||||
/// <inheritdoc/>
|
||||
ISharedImmediateTexture ITextureProvider.GetFromManifestResource(Assembly assembly, string name) =>
|
||||
|
|
@ -97,13 +101,18 @@ internal sealed partial class TextureManager
|
|||
this.gameDict.GetOrAdd(path, GamePathSharedImmediateTexture.CreatePlaceholder)
|
||||
.PublicUseInstance;
|
||||
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromFile"/>
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromFile(string)"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SharedImmediateTexture.PureImpl GetFromFile(string path) =>
|
||||
this.fileDict.GetOrAdd(path, FileSystemSharedImmediateTexture.CreatePlaceholder)
|
||||
this.GetFromFile(new FileInfo(path));
|
||||
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromFile(FileInfo)"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SharedImmediateTexture.PureImpl GetFromFile(FileInfo file) =>
|
||||
this.fileDict.GetOrAdd(file.FullName, FileSystemSharedImmediateTexture.CreatePlaceholder)
|
||||
.PublicUseInstance;
|
||||
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromFile"/>
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromManifestResource"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SharedImmediateTexture.PureImpl GetFromManifestResource(Assembly assembly, string name) =>
|
||||
this.manifestResourceDict.GetOrAdd(
|
||||
|
|
|
|||
|
|
@ -289,6 +289,14 @@ internal sealed class TextureManagerPluginScoped
|
|||
shared.AddOwnerPlugin(this.plugin);
|
||||
return shared;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ISharedImmediateTexture GetFromFile(FileInfo file)
|
||||
{
|
||||
var shared = this.ManagerOrThrow.Shared.GetFromFile(file);
|
||||
shared.AddOwnerPlugin(this.plugin);
|
||||
return shared;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ISharedImmediateTexture GetFromManifestResource(Assembly assembly, string name)
|
||||
|
|
|
|||
|
|
@ -212,6 +212,15 @@ public interface ITextureProvider
|
|||
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
|
||||
/// </remarks>
|
||||
ISharedImmediateTexture GetFromFile(string path);
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given file on the filesystem.</summary>
|
||||
/// <param name="file">The file on the filesystem to load.</param>
|
||||
/// <returns>The shared texture that you may use to obtain the loaded texture wrap and load states.</returns>
|
||||
/// <remarks>
|
||||
/// <para>This function does not throw exceptions.</para>
|
||||
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
|
||||
/// </remarks>
|
||||
ISharedImmediateTexture GetFromFile(FileInfo file);
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given file of the assembly manifest resources.</summary>
|
||||
/// <param name="assembly">The assembly containing manifest resources.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue