IEmulatorServiceProvider - add an AvailableServices property, Service Provider - don't register type object
This commit is contained in:
parent
82fcd0bc5e
commit
5c768b1dc4
|
@ -31,6 +31,11 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
Services.Add(coreType, core);
|
Services.Add(coreType, core);
|
||||||
coreType = coreType.BaseType;
|
coreType = coreType.BaseType;
|
||||||
|
|
||||||
|
if (coreType == typeof(object)) // Don't register object
|
||||||
|
{
|
||||||
|
coreType = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,5 +74,13 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
return Services.ContainsKey(t);
|
return Services.ContainsKey(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Type> AvailableServices
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Services.Select(d => d.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Common
|
namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
|
@ -25,5 +26,10 @@ namespace BizHawk.Emulation.Common
|
||||||
/// Else returns null
|
/// Else returns null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object GetService(Type t);
|
object GetService(Type t);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of all cuurently registered services available to be called
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<Type> AvailableServices { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue