diff --git a/IPA.Loader/Loader/PluginInitInjector.cs b/IPA.Loader/Loader/PluginInitInjector.cs index 7dc2679c..552f815b 100644 --- a/IPA.Loader/Loader/PluginInitInjector.cs +++ b/IPA.Loader/Loader/PluginInitInjector.cs @@ -33,7 +33,7 @@ namespace IPA.Loader /// the function to call for injection. public static void AddInjector(Type type, InjectParameter injector) { - injectors.Add(new Tuple(type, injector)); + injectors.Add(Tuple.Create(type, injector)); } private static readonly List> injectors = new List> @@ -60,14 +60,14 @@ namespace IPA.Loader var initArgs = new List(); var initParams = init.GetParameters(); - Dictionary, object> previousValues = - new Dictionary, object>(injectors.Count); + var previousValues = new Dictionary, object>(injectors.Count); foreach (var param in initParams) { var paramType = param.ParameterType; var value = paramType.GetDefault(); + // TODO: make this work on closest match foreach (var pair in injectors.Where(t => paramType.IsAssignableFrom(t.Item1))) { object prev = null; @@ -75,7 +75,7 @@ namespace IPA.Loader prev = previousValues[pair]; var val = pair.Item2?.Invoke(prev, param, meta); - + if (previousValues.ContainsKey(pair)) previousValues[pair] = val; else