public PalBot(IPacketSerializer packetSerializer,
                      IPacketDeserializer packetDeserializer,
                      IPacketMapper packetMapper,
                      IPacketWatcher packetWatcher,
                      IPacketTemplates packetTemplates,
                      IZLibCompression compression,
                      IAuthenticationUtility authentication,
                      IPacketHandlerHub handlerHub,
                      ISubProfiling subProfiling,
                      IPluginManager pluginManager,
                      IRoleManager roleManager,
                      IBroadcastUtility broadcast)
        {
            this.packetSerializer   = packetSerializer;
            this.packetDeserializer = packetDeserializer;
            this.packetMapper       = packetMapper;
            this.packetWatcher      = packetWatcher;
            this.packetTemplates    = packetTemplates;
            this.compression        = compression;
            this.authentication     = authentication;
            this.handlerHub         = handlerHub;
            this.SubProfiling       = subProfiling;
            this.pluginManager      = pluginManager;
            this.RoleManager        = roleManager;
            this.On        = broadcast;
            this.broadcast = (BroadcastUtility)broadcast;

            _client = new NetworkClient(DefaultHost, DefaultPort);
            _client.OnDisconnected += (c) => _disconnected?.Invoke();
            _client.OnDisconnected += (c) => ((BroadcastUtility)On).BroadcastDisconnected();
            _client.OnException    += (e, n) => _error?.Invoke(e, n);
            _client.OnException    += (e, n) => ((BroadcastUtility)On).BroadcastException(e, n);
            _client.OnDataReceived += (c, b) => this.packetDeserializer.ReadPacket(c, b);

            On.Exception += (e, n) => _error?.Invoke(e, n);
            On.Message   += (b, m) => _message?.Invoke(b, m);
            this.broadcast.PacketParsed += (c, p) => PacketReceived(p);
        }
 public PacketHandlerHub(IReflectionUtility reflection, IBroadcastUtility broadcast)
 {
     this.reflection = reflection;
     this.broadcast  = (BroadcastUtility)broadcast;
 }
Example #3
0
 public PluginManager(IReflectionUtility reflection, IRoleManager roleManager, IBroadcastUtility broadcast)
 {
     this.reflection  = reflection;
     this.roleManager = roleManager;
     this.broadcast   = (BroadcastUtility)broadcast;
     comparitors      = new List <IComparitorProfile> {
         new LanguageComparitor(), new CommandComparitor()
     };
 }
Example #4
0
 public BasicHandlers(IPacketTemplates templates, IPluginManager pluginManager, IBroadcastUtility broadcast)
 {
     this.templates     = templates;
     this.pluginManager = pluginManager;
     this.broadcast     = (BroadcastUtility)broadcast;
 }
Example #5
0
 public PacketWatcher(IBroadcastUtility broadcast)
 {
     this.broadcast = (BroadcastUtility)broadcast;
 }
Example #6
0
 public PacketDeserializer(IBroadcastUtility broadcast)
 {
     this.broadcast = (BroadcastUtility)broadcast;
 }
Example #7
0
 public SubProfiling(IBroadcastUtility broadcast)
 {
     this.broadcast = (BroadcastUtility)broadcast;
 }
Example #8
0
 public PacketMapper(IReflectionUtility reflection, IBroadcastUtility broadcast)
 {
     this.reflection = reflection;
     this.broadcast  = (BroadcastUtility)broadcast;
 }