mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Remove InitialiationTask from interface
This commit is contained in:
parent
da969dec5c
commit
a3217bb86d
2 changed files with 11 additions and 17 deletions
|
|
@ -81,7 +81,9 @@ internal sealed class GameConfig : IServiceType, IGameConfig, IDisposable
|
|||
public event EventHandler<ConfigChangeEvent>? UiControlChanged;
|
||||
#pragma warning restore 67
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <summary>
|
||||
/// Gets a task representing the initialization state of this class.
|
||||
/// </summary>
|
||||
public Task InitializationTask => this.tcsInitialization.Task;
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -251,13 +253,15 @@ internal class GameConfigPluginScoped : IDisposable, IServiceType, IGameConfig
|
|||
[ServiceManager.ServiceDependency]
|
||||
private readonly GameConfig gameConfigService = Service<GameConfig>.Get();
|
||||
|
||||
private readonly Task initializationTask;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GameConfigPluginScoped"/> class.
|
||||
/// </summary>
|
||||
internal GameConfigPluginScoped()
|
||||
{
|
||||
this.gameConfigService.Changed += this.ConfigChangedForward;
|
||||
this.InitializationTask = this.gameConfigService.InitializationTask.ContinueWith(
|
||||
this.initializationTask = this.gameConfigService.InitializationTask.ContinueWith(
|
||||
r =>
|
||||
{
|
||||
if (!r.IsCompletedSuccessfully)
|
||||
|
|
@ -281,9 +285,6 @@ internal class GameConfigPluginScoped : IDisposable, IServiceType, IGameConfig
|
|||
/// <inheritdoc/>
|
||||
public event EventHandler<ConfigChangeEvent>? UiControlChanged;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public Task InitializationTask { get; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public GameConfigSection System => this.gameConfigService.System;
|
||||
|
||||
|
|
@ -297,7 +298,7 @@ internal class GameConfigPluginScoped : IDisposable, IServiceType, IGameConfig
|
|||
public void Dispose()
|
||||
{
|
||||
this.gameConfigService.Changed -= this.ConfigChangedForward;
|
||||
this.InitializationTask.ContinueWith(
|
||||
this.initializationTask.ContinueWith(
|
||||
r =>
|
||||
{
|
||||
if (!r.IsCompletedSuccessfully)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ namespace Dalamud.Plugin.Services;
|
|||
/// This class represents the game's configuration.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Avoid accessing configuration from your plugin constructor, especially if your plugin sets
|
||||
/// Accessing <see cref="GameConfigSection"/>-typed properties such as <see cref="System"/>, directly or indirectly
|
||||
/// via <see cref="TryGet(Game.Config.SystemConfigOption,out bool)"/>,
|
||||
/// <see cref="Set(Game.Config.SystemConfigOption,bool)"/>, or alike will block, if the game is not done loading.<br />
|
||||
/// Therefore, avoid accessing configuration from your plugin constructor, especially if your plugin sets
|
||||
/// <see cref="PluginManifest.LoadRequiredState"/> to <c>2</c> and <see cref="PluginManifest.LoadSync"/> to <c>true</c>.
|
||||
/// If property access from the plugin constructor is desired, do the value retrieval asynchronously via
|
||||
/// <see cref="IFramework.RunOnFrameworkThread{T}(Func{T})"/>; do not wait for the result right away.
|
||||
|
|
@ -37,16 +40,6 @@ public interface IGameConfig
|
|||
/// </summary>
|
||||
public event EventHandler<ConfigChangeEvent> UiControlChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a task representing the initialization state of this instance of <see cref="IGameConfig"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Accessing <see cref="GameConfigSection"/>-typed properties such as <see cref="System"/>, directly or indirectly
|
||||
/// via <see cref="TryGet(Game.Config.SystemConfigOption,out bool)"/>,
|
||||
/// <see cref="Set(Game.Config.SystemConfigOption,bool)"/>, or alike will block, if this task is incomplete.
|
||||
/// </remarks>
|
||||
public Task InitializationTask { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the collection of config options that persist between characters.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue