public void Post() { graph.DoOnAttribute <ResourceProcessorAttribute>((attribute, type) => { var processor = (IResourceProcessor)graph.Construct(type); Console.WriteLine(processor.GetType().Name); for (var i = 0; i < attribute.FileTypes.Length; i++) { var extension = attribute.FileTypes[i]; processors.Add(extension, processor); } }); }
public void Post() { objectGraph.DoOnAttribute <SubscribeAttribute>((attribute, type) => { if (type.Implements <CollisionSubscriber>() && attribute.MessageName.Equals("collision", StringComparison.CurrentCultureIgnoreCase)) { var subscriber = (CollisionSubscriber)objectGraph.Construct(type); if (!channels.ContainsKey(subscriber.GetChannel())) { channels.Add(subscriber.GetChannel(), new CollisionMessageChannel(subscriber.GetChannel())); } channels[subscriber.GetChannel()].Subscribe(subscriber, subscriber.Collide); } }); }