IEmulatorServiceProvider - add an AvailableServices property, Service Provider - don't register type object

This commit is contained in:
adelikat 2015-01-14 22:53:08 +00:00
parent 82fcd0bc5e
commit 5c768b1dc4
2 changed files with 19 additions and 0 deletions

View File

@ -31,6 +31,11 @@ namespace BizHawk.Emulation.Common
{
Services.Add(coreType, core);
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);
}
public IEnumerable<Type> AvailableServices
{
get
{
return Services.Select(d => d.Key);
}
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Emulation.Common
{
@ -25,5 +26,10 @@ namespace BizHawk.Emulation.Common
/// Else returns null
/// </summary>
object GetService(Type t);
/// <summary>
/// A list of all cuurently registered services available to be called
/// </summary>
IEnumerable<Type> AvailableServices { get; }
}
}