Browse Source

Fix GeneratedConfig.WriteSyncObject

pull/74/head
Anairkoen Schno 3 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.
/// </summary>
/// <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>
/// 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));
#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);
syncObjProp.SetGetMethod(syncObjPropGet);
typeBuilder.DefineMethodOverride(syncObjPropGet, IConfigStore_GetSyncObject);
@ -451,7 +451,7 @@ namespace IPA.Config.Stores
}
#endregion
#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);
writeSyncObjProp.SetGetMethod(writeSyncObjPropGet);
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.IsInterface && !source.IsSubclassOf(target)) return int.MinValue;
int value = 0;
int value = int.MaxValue - 1;
while (true)
{
if (source == null) return value;
if (source is null) return value;
if (target.IsInterface && source.GetInterfaces().Contains(target))
return value;
else if (target == source)


Loading…
Cancel
Save