mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
DAssetM cleanup
This commit is contained in:
parent
c27422384f
commit
da969dec5c
1 changed files with 9 additions and 9 deletions
|
|
@ -194,12 +194,14 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await using var tempPathStream = File.Open(tempPath, FileMode.Create, FileAccess.Write);
|
await using (var tempPathStream = File.Open(tempPath, FileMode.Create, FileAccess.Write))
|
||||||
await url.DownloadAsync(
|
{
|
||||||
this.httpClient.SharedHttpClient,
|
await url.DownloadAsync(
|
||||||
tempPathStream,
|
this.httpClient.SharedHttpClient,
|
||||||
this.cancellationTokenSource.Token);
|
tempPathStream,
|
||||||
tempPathStream.Dispose();
|
this.cancellationTokenSource.Token);
|
||||||
|
}
|
||||||
|
|
||||||
for (var j = RenameAttemptCount; ; j--)
|
for (var j = RenameAttemptCount; ; j--)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -265,7 +267,7 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
[Pure]
|
[Pure]
|
||||||
public IDalamudTextureWrap GetDalamudTextureWrap(DalamudAsset asset) =>
|
public IDalamudTextureWrap GetDalamudTextureWrap(DalamudAsset asset) =>
|
||||||
ExtractResult(this.GetDalamudTextureWrapAsync(asset));
|
this.GetDalamudTextureWrapAsync(asset).Result;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
[Pure]
|
[Pure]
|
||||||
|
|
@ -332,8 +334,6 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static T ExtractResult<T>(Task<T> t) => t.IsCompleted ? t.Result : t.GetAwaiter().GetResult();
|
|
||||||
|
|
||||||
private Task<TOut> TransformImmediate<TIn, TOut>(Task<TIn> task, Func<TIn, TOut> transformer)
|
private Task<TOut> TransformImmediate<TIn, TOut>(Task<TIn> task, Func<TIn, TOut> transformer)
|
||||||
{
|
{
|
||||||
if (task.IsCompletedSuccessfully)
|
if (task.IsCompletedSuccessfully)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue