public void RegisterFactory(IEnumerable <Type> suppliers, ModSessionComponentRegistry.CreateComponent component) { foreach (var k in suppliers) { _factories.Add(k, component); } }
public bool UnregisterFactory(ModSessionComponentRegistry.CreateComponent component) { var supplies = new HashSet <Type>(); foreach (var kv in _factories) { if (kv.Value == component) { supplies.Add(kv.Key); } } if (supplies.Count == 0) { return(false); } foreach (var key in supplies) { _factories.Remove(key); } return(true); }