mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 13:57:43 +01:00
Merge branch 'apiX' into feature/itextureprovider-updates
This commit is contained in:
commit
8c7771bf7d
2213 changed files with 10372 additions and 1088868 deletions
|
|
@ -25,11 +25,12 @@ namespace Dalamud.Storage.Assets;
|
|||
/// A concrete class for <see cref="IDalamudAssetManager"/>.
|
||||
/// </summary>
|
||||
[PluginInterface]
|
||||
[ServiceManager.BlockingEarlyLoadedService]
|
||||
[ServiceManager.BlockingEarlyLoadedService(
|
||||
"Ensuring that it is worth continuing loading Dalamud, by checking if all required assets are properly available.")]
|
||||
#pragma warning disable SA1015
|
||||
[ResolveVia<IDalamudAssetManager>]
|
||||
#pragma warning restore SA1015
|
||||
internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudAssetManager
|
||||
internal sealed class DalamudAssetManager : IInternalDisposableService, IDalamudAssetManager
|
||||
{
|
||||
private const int DownloadAttemptCount = 10;
|
||||
private const int RenameAttemptCount = 10;
|
||||
|
|
@ -69,7 +70,13 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
|||
.Where(x => x.GetAttribute<DalamudAssetAttribute>()?.Required is true)
|
||||
.Select(this.CreateStreamAsync)
|
||||
.Select(x => x.ToContentDisposedTask()))
|
||||
.ContinueWith(_ => loadTimings.Dispose()),
|
||||
.ContinueWith(
|
||||
r =>
|
||||
{
|
||||
loadTimings.Dispose();
|
||||
return r;
|
||||
})
|
||||
.Unwrap(),
|
||||
"Prevent Dalamud from loading more stuff, until we've ensured that all required assets are available.");
|
||||
|
||||
Task.WhenAll(
|
||||
|
|
@ -88,7 +95,7 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
|||
public IDalamudTextureWrap White4X4 => this.GetDalamudTextureWrap(DalamudAsset.White4X4);
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
void IInternalDisposableService.DisposeService()
|
||||
{
|
||||
lock (this.syncRoot)
|
||||
{
|
||||
|
|
@ -104,6 +111,7 @@ internal sealed class DalamudAssetManager : IServiceType, IDisposable, IDalamudA
|
|||
.Concat(this.fileStreams.Values)
|
||||
.Concat(this.textureWraps.Values)
|
||||
.Where(x => x is not null)
|
||||
.Select(x => x.ContinueWith(r => { _ = r.Exception; }))
|
||||
.ToArray());
|
||||
this.scopedFinalizer.Dispose();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@ namespace Dalamud.Storage;
|
|||
/// This is not an early-loaded service, as it is needed before they are initialized.
|
||||
/// </remarks>
|
||||
[ServiceManager.ProvidedService]
|
||||
public class ReliableFileStorage : IServiceType, IDisposable
|
||||
internal class ReliableFileStorage : IInternalDisposableService
|
||||
{
|
||||
private static readonly ModuleLog Log = new("VFS");
|
||||
|
||||
private readonly object syncRoot = new();
|
||||
|
||||
private SQLiteConnection? db;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -60,7 +61,7 @@ public class ReliableFileStorage : IServiceType, IDisposable
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Check if a file exists.
|
||||
/// This will return true if the file does not exist on the filesystem, but in the transparent backup.
|
||||
|
|
@ -286,9 +287,9 @@ public class ReliableFileStorage : IServiceType, IDisposable
|
|||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
void IInternalDisposableService.DisposeService()
|
||||
{
|
||||
this.db?.Dispose();
|
||||
this.DisposeCore();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -312,6 +313,8 @@ public class ReliableFileStorage : IServiceType, IDisposable
|
|||
this.db.CreateTable<DbFile>();
|
||||
}
|
||||
|
||||
private void DisposeCore() => this.db?.Dispose();
|
||||
|
||||
private class DbFile
|
||||
{
|
||||
[PrimaryKey]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue