mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
fix: Create() => CreateAsync(), fix custom plugin IoC
This commit is contained in:
parent
1a2365a676
commit
ff42892240
3 changed files with 3 additions and 3 deletions
|
|
@ -45,7 +45,7 @@ namespace Dalamud.IoC.Internal
|
||||||
/// <param name="objectType">The type of object to create.</param>
|
/// <param name="objectType">The type of object to create.</param>
|
||||||
/// <param name="scopedObjects">Scoped objects to be included in the constructor.</param>
|
/// <param name="scopedObjects">Scoped objects to be included in the constructor.</param>
|
||||||
/// <returns>The created object.</returns>
|
/// <returns>The created object.</returns>
|
||||||
public async Task<object?> Create(Type objectType, params object[] scopedObjects)
|
public async Task<object?> CreateAsync(Type objectType, params object[] scopedObjects)
|
||||||
{
|
{
|
||||||
var ctor = this.FindApplicableCtor(objectType, scopedObjects);
|
var ctor = this.FindApplicableCtor(objectType, scopedObjects);
|
||||||
if (ctor == null)
|
if (ctor == null)
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@ namespace Dalamud.Plugin
|
||||||
realScopedObjects[0] = this;
|
realScopedObjects[0] = this;
|
||||||
Array.Copy(scopedObjects, 0, realScopedObjects, 1, scopedObjects.Length);
|
Array.Copy(scopedObjects, 0, realScopedObjects, 1, scopedObjects.Length);
|
||||||
|
|
||||||
return svcContainer.Create(typeof(T), realScopedObjects) as T;
|
return (T)svcContainer.CreateAsync(typeof(T), realScopedObjects).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ internal class LocalPlugin : IDisposable
|
||||||
this.DalamudInterface = new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev);
|
this.DalamudInterface = new DalamudPluginInterface(this.pluginAssembly.GetName().Name!, this.DllFile, reason, this.IsDev);
|
||||||
|
|
||||||
var ioc = Service<ServiceContainer>.Get();
|
var ioc = Service<ServiceContainer>.Get();
|
||||||
this.instance = ioc.Create(this.pluginType, this.DalamudInterface).GetAwaiter().GetResult() as IDalamudPlugin;
|
this.instance = ioc.CreateAsync(this.pluginType, this.DalamudInterface).GetAwaiter().GetResult() as IDalamudPlugin;
|
||||||
if (this.instance == null)
|
if (this.instance == null)
|
||||||
{
|
{
|
||||||
this.State = PluginState.LoadError;
|
this.State = PluginState.LoadError;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue