mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
GetFromFile without FileInfo (#1913)
* GetFromFile without FileInfo * Implement missing interface member
This commit is contained in:
parent
426eaec0f2
commit
def28b37c7
3 changed files with 28 additions and 2 deletions
|
|
@ -45,6 +45,10 @@ internal sealed partial class TextureManager
|
|||
ISharedImmediateTexture ITextureProvider.GetFromFile(FileInfo file) =>
|
||||
this.Shared.GetFromFile(file);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ISharedImmediateTexture GetFromFileAbsolute(string fullPath) =>
|
||||
this.Shared.GetFromFileAbsolute(fullPath);
|
||||
|
||||
/// <inheritdoc/>
|
||||
ISharedImmediateTexture ITextureProvider.GetFromManifestResource(Assembly assembly, string name) =>
|
||||
this.Shared.GetFromManifestResource(assembly, name);
|
||||
|
|
@ -141,7 +145,12 @@ internal sealed partial class TextureManager
|
|||
/// <inheritdoc cref="ITextureProvider.GetFromFile(FileInfo)"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SharedImmediateTexture.PureImpl GetFromFile(FileInfo file) =>
|
||||
this.fileDict.GetOrAdd(file.FullName, FileSystemSharedImmediateTexture.CreatePlaceholder)
|
||||
this.GetFromFileAbsolute(file.FullName);
|
||||
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromFileAbsolute(string)"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SharedImmediateTexture.PureImpl GetFromFileAbsolute(string fullPath) =>
|
||||
this.fileDict.GetOrAdd(fullPath, FileSystemSharedImmediateTexture.CreatePlaceholder)
|
||||
.PublicUseInstance;
|
||||
|
||||
/// <inheritdoc cref="ITextureProvider.GetFromManifestResource"/>
|
||||
|
|
|
|||
|
|
@ -313,6 +313,14 @@ internal sealed class TextureManagerPluginScoped
|
|||
return shared;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ISharedImmediateTexture GetFromFileAbsolute(string fullPath)
|
||||
{
|
||||
var shared = this.ManagerOrThrow.Shared.GetFromFileAbsolute(fullPath);
|
||||
shared.AddOwnerPlugin(this.plugin);
|
||||
return shared;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public ISharedImmediateTexture GetFromManifestResource(Assembly assembly, string name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
|
@ -232,6 +232,15 @@ public interface ITextureProvider
|
|||
/// </remarks>
|
||||
ISharedImmediateTexture GetFromFile(FileInfo file);
|
||||
|
||||
/// <summary>Gets a shared texture corresponding to the given file on the filesystem.</summary>
|
||||
/// <param name="fullPath">The file on the filesystem to load. Requires a full path.</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 GetFromFileAbsolute(string fullPath);
|
||||
|
||||
/// <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>
|
||||
/// <param name="name">The case-sensitive name of the manifest resource being requested.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue