mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
fix: wrong parameters for IoC
This commit is contained in:
parent
6fb19c1c81
commit
5f19abd979
3 changed files with 7 additions and 14 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Logging;
|
||||
|
|
@ -25,7 +26,7 @@ namespace Dalamud.CorePlugin
|
|||
/// Initializes a new instance of the <see cref="PluginImpl"/> class.
|
||||
/// </summary>
|
||||
/// <param name="pluginInterface">Dalamud plugin interface.</param>
|
||||
public PluginImpl(DalamudPluginInterface pluginInterface)
|
||||
public PluginImpl(DalamudPluginInterface pluginInterface, ChatGui chatGui)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ namespace Dalamud.IoC.Internal
|
|||
|
||||
var instance = FormatterServices.GetUninitializedObject(objectType);
|
||||
|
||||
if (!this.InjectProperties(instance, scopedObjects))
|
||||
if (!this.InjectProperties(instance, resolvedParams))
|
||||
{
|
||||
Log.Error("Failed to create {TypeName}, a requested property service type could not be satisfied", objectType.FullName);
|
||||
return null;
|
||||
}
|
||||
|
||||
ctor.Invoke(instance, scopedObjects);
|
||||
ctor.Invoke(instance, resolvedParams);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
|
@ -109,8 +109,6 @@ namespace Dalamud.IoC.Internal
|
|||
{
|
||||
var objectType = instance.GetType();
|
||||
|
||||
Log.Information($"Injecting props into {objectType.FullName}");
|
||||
|
||||
var props = objectType.GetProperties(BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public |
|
||||
BindingFlags.NonPublic).Where(x => x.GetCustomAttributes(typeof(PluginServiceAttribute)).Any()).Select(
|
||||
propertyInfo =>
|
||||
|
|
@ -129,8 +127,6 @@ namespace Dalamud.IoC.Internal
|
|||
|
||||
foreach (var prop in props)
|
||||
{
|
||||
Log.Information($"Injecting {prop.propertyInfo.Name} for type {prop.propertyInfo.PropertyType.GetType().FullName}");
|
||||
|
||||
var service = this.GetService(prop.propertyInfo.PropertyType, scopedObjects);
|
||||
|
||||
if (service == null)
|
||||
|
|
@ -142,8 +138,6 @@ namespace Dalamud.IoC.Internal
|
|||
prop.propertyInfo.SetValue(instance, service);
|
||||
}
|
||||
|
||||
Log.Information("Injected");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ using Dalamud.Game.Text.Sanitizer;
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using ServiceContainer = Dalamud.IoC.Internal.ServiceContainer;
|
||||
|
||||
namespace Dalamud.Plugin
|
||||
{
|
||||
|
|
@ -319,7 +317,7 @@ namespace Dalamud.Plugin
|
|||
/// <returns>The created and initialized type.</returns>
|
||||
public T? Create<T>(params object[] scopedObjects) where T : class
|
||||
{
|
||||
var svcContainer = Service<ServiceContainer>.Get();
|
||||
var svcContainer = Service<IoC.Internal.ServiceContainer>.Get();
|
||||
|
||||
var realScopedObjects = new object[scopedObjects.Length + 1];
|
||||
realScopedObjects[0] = this;
|
||||
|
|
@ -336,7 +334,7 @@ namespace Dalamud.Plugin
|
|||
/// <returns>Whether or not the injection succeeded.</returns>
|
||||
public bool Inject(object instance, params object[] scopedObjects)
|
||||
{
|
||||
var svcContainer = Service<ServiceContainer>.Get();
|
||||
var svcContainer = Service<IoC.Internal.ServiceContainer>.Get();
|
||||
|
||||
var realScopedObjects = new object[scopedObjects.Length + 1];
|
||||
realScopedObjects[0] = this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue