Esempio n. 1
0
        internal NetsyChannel(AtomChannel atomChannel, IPackageSerializer packageSerializer, NetsyConnectionHelper.HandlerRegistry handlerRegistry)
        {
            Guard.NotNull(atomChannel, nameof(atomChannel));
            Guard.NotNull(packageSerializer, nameof(packageSerializer));
            Guard.NotNull(handlerRegistry, nameof(handlerRegistry));

            this._atomChannel = atomChannel;
            this._atomChannel.MessageReceived += this.AtomChannelOnMessageReceived;
            this._connectionHelper             = new NetsyConnectionHelper(packageSerializer, atomChannel.SendMessageAsync, handlerRegistry);

            this.Data = new Dictionary <string, object>();
        }
Esempio n. 2
0
        public NetsyClient(IPEndPoint address, IPackageSerializer packageSerializer, IAtomClientPlugin plugin = null)
        {
            Guard.NotNull(address, nameof(address));
            Guard.NotNull(packageSerializer, nameof(packageSerializer));

            this.Data = new Dictionary <string, object>();

            this._atomClient        = new AtomClient(address, plugin);
            this._packageSerializer = packageSerializer;

            this._handlerRegistry  = new NetsyConnectionHelper.HandlerRegistry();
            this._connectionHelper = new NetsyConnectionHelper(packageSerializer, f => this._atomClient.SendMessageAsync(f), this._handlerRegistry);

            this._atomClient.MessageReceived += this.AtomClientOnMessageReceived;
        }