Browse Source

Fix GeneratedConfig.WriteSyncObject

pull/74/head
Anairkoen Schno 2 years ago
parent
commit
7b0c7f2f96
Signed by: DaNike GPG Key ID: BEFB74D5F3FC4387
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      IPA.Loader/Config/Config.cs
  2. +2
    -2
      IPA.Loader/Config/Stores/GeneratedStoreImpl/MakeCreator.cs
  3. +2
    -2
      IPA.Loader/Loader/PluginInitInjector.cs

+ 1
- 1
IPA.Loader/Config/Config.cs View File

@ -81,7 +81,7 @@ namespace IPA.Config
/// Registers a <see cref="IConfigProvider"/> to use for configs. /// Registers a <see cref="IConfigProvider"/> to use for configs.
/// </summary> /// </summary>
/// <typeparam name="T">the type to register</typeparam> /// <typeparam name="T">the type to register</typeparam>
public static void Register<T>() where T : IConfigProvider => Register(typeof(T));
public static void Register<T>() where T : IConfigProvider, new() => Register(typeof(T));
/// <summary> /// <summary>
/// Registers a <see cref="IConfigProvider"/> to use for configs. /// Registers a <see cref="IConfigProvider"/> to use for configs.


+ 2
- 2
IPA.Loader/Config/Stores/GeneratedStoreImpl/MakeCreator.cs View File

@ -436,7 +436,7 @@ namespace IPA.Config.Stores
var IConfigStore_ReadFrom = IConfigStore_t.GetMethod(nameof(IConfigStore.ReadFrom)); var IConfigStore_ReadFrom = IConfigStore_t.GetMethod(nameof(IConfigStore.ReadFrom));
#region IConfigStore.SyncObject #region IConfigStore.SyncObject
var syncObjProp = typeBuilder.DefineProperty(nameof(IConfigStore.SyncObject), PropertyAttributes.None, typeof(WaitHandle), null);
var syncObjProp = typeBuilder.DefineProperty(nameof(IConfigStore.SyncObject), PropertyAttributes.None, IConfigStore_GetSyncObject.ReturnType, null);
var syncObjPropGet = typeBuilder.DefineMethod($"<g>{nameof(IConfigStore.SyncObject)}", virtualPropertyMethodAttr, syncObjProp.PropertyType, Type.EmptyTypes); var syncObjPropGet = typeBuilder.DefineMethod($"<g>{nameof(IConfigStore.SyncObject)}", virtualPropertyMethodAttr, syncObjProp.PropertyType, Type.EmptyTypes);
syncObjProp.SetGetMethod(syncObjPropGet); syncObjProp.SetGetMethod(syncObjPropGet);
typeBuilder.DefineMethodOverride(syncObjPropGet, IConfigStore_GetSyncObject); typeBuilder.DefineMethodOverride(syncObjPropGet, IConfigStore_GetSyncObject);
@ -451,7 +451,7 @@ namespace IPA.Config.Stores
} }
#endregion #endregion
#region IConfigStore.WriteSyncObject #region IConfigStore.WriteSyncObject
var writeSyncObjProp = typeBuilder.DefineProperty(nameof(IConfigStore.WriteSyncObject), PropertyAttributes.None, typeof(WaitHandle), null);
var writeSyncObjProp = typeBuilder.DefineProperty(nameof(IConfigStore.WriteSyncObject), PropertyAttributes.None, IConfigStore_GetWriteSyncObject.ReturnType, null);
var writeSyncObjPropGet = typeBuilder.DefineMethod($"<g>{nameof(IConfigStore.WriteSyncObject)}", virtualPropertyMethodAttr, writeSyncObjProp.PropertyType, Type.EmptyTypes); var writeSyncObjPropGet = typeBuilder.DefineMethod($"<g>{nameof(IConfigStore.WriteSyncObject)}", virtualPropertyMethodAttr, writeSyncObjProp.PropertyType, Type.EmptyTypes);
writeSyncObjProp.SetGetMethod(writeSyncObjPropGet); writeSyncObjProp.SetGetMethod(writeSyncObjPropGet);
typeBuilder.DefineMethodOverride(writeSyncObjPropGet, IConfigStore_GetWriteSyncObject); typeBuilder.DefineMethodOverride(writeSyncObjPropGet, IConfigStore_GetWriteSyncObject);


+ 2
- 2
IPA.Loader/Loader/PluginInitInjector.cs View File

@ -152,10 +152,10 @@ namespace IPA.Loader
if (!target.IsAssignableFrom(source)) return null; if (!target.IsAssignableFrom(source)) return null;
if (!target.IsInterface && !source.IsSubclassOf(target)) return int.MinValue; if (!target.IsInterface && !source.IsSubclassOf(target)) return int.MinValue;
int value = 0;
int value = int.MaxValue - 1;
while (true) while (true)
{ {
if (source == null) return value;
if (source is null) return value;
if (target.IsInterface && source.GetInterfaces().Contains(target)) if (target.IsInterface && source.GetInterfaces().Contains(target))
return value; return value;
else if (target == source) else if (target == source)


Loading…
Cancel
Save