Exemple #1
0
 public static MapHandler DependencyInjection()
 {
     return(ReflectionUtility.DependencyInjection()
            .Use <IPacketTemplate, PacketTemplate>()
            .Use <ICacheUtility, CacheUtility>()
            .Use <IBot, PalBot>());
 }
Exemple #2
0
        public virtual IBot GenerateBot()
        {
            var dih = ReflectionUtility.DependencyInjection()
                      .Use <IBot, BotStub>();

            var bot = (BotStub)dih.Build <IBot>();

            bot.PluginSets = PluginSet;
            bot.Prefix     = Prefix;

            return(bot);
        }
Exemple #3
0
        public static MapHandler DependencyResolution()
        {
            var bc = new BroadcastUtility();

            return(ReflectionUtility.DependencyInjection()
                   .AllOf <IPacketHandler>()
                   .AllOf <IWatch>()
                   .Use <IReflectionUtility, PalReflectionUtility>((c, i) => new PalReflectionUtility(c))
                   .Use <IBot, PalBot>()
                   .Use <IPacketSerializer, PacketSerializer>()
                   .Use <IPacketDeserializer, PacketDeserializer>()
                   .Use <IPacketMapper, PacketMapper>()
                   .Use <IPacketWatcher, PacketWatcher>()
                   .Use <IPacketTemplates, PacketTemplates>()
                   .Use <IZLibCompression, ZLibCompression>()
                   .Use <IAuthenticationUtility, AuthenticationUtility>()
                   .Use <IPacketHandlerHub, PacketHandlerHub>()
                   .Use <ISubProfiling, SubProfiling>(new SubProfiling(bc))
                   .Use <IBroadcastUtility, BroadcastUtility>(bc));
        }
Exemple #4
0
        public static IServiceProvider ConfigureSparkBot(this IServiceCollection services, Config config, Action <MapHandler> handler = null)
        {
            try
            {
                var map = ReflectionUtility.DependencyInjection()
                          .Use <IBot, SparkBot>()
                          .Config(c =>
                {
                    c.ForSingletonOf <IBot>();
                })
                          .Use <IPluginManager, PluginManager>()
                          .Use <IConfig, Config>(config);

                handler?.Invoke(map);

                var container = map.Create();
                return(ConfigureSparkBot(services, container));
            }
            catch (Exception ex)
            {
                Log(ex);
                throw;
            }
        }
Exemple #5
0
 public static MapHandler DependencyResolution()
 {
     return(ReflectionUtility.DependencyInjection()
            .Use <IBot, RedditBot>());
 }