public override bool TryDispatch(INetworkMessageReceiver reciever)
		{
			if (GeneratedStatusMessage == null)
				return false;

			reciever.OnNetworkMessageReceive(GeneratedStatusMessage, this); //pass to the reciever the message and this (message parameters)

			return true;
		}
        public override bool TryDispatch(INetworkMessageReceiver reciever)
        {
            if (reciever == null)
            {
                throw new ArgumentNullException(nameof(reciever));
            }
            if (GeneratedStatusMessage == null)
            {
                return(false);
            }

            reciever.OnNetworkMessageReceive(GeneratedStatusMessage, this);             //pass to the reciever the message and this (message parameters)

            return(true);
        }
		public GladNetOutboundS2SPeer(GladNetAppBase appBase, INetworkMessageReceiver reciever, IDeserializerStrategy deserializationStrat, 
			IDisconnectionServiceHandler disconnectionService)
				: base(appBase)
		{
			Throw<ArgumentNullException>.If.IsNull(appBase)?.Now(nameof(appBase));
			Throw<ArgumentNullException>.If.IsNull(reciever)?.Now(nameof(reciever));
			Throw<ArgumentNullException>.If.IsNull(deserializationStrat)?.Now(nameof(deserializationStrat));
			Throw<ArgumentNullException>.If.IsNull(disconnectionService)?.Now(nameof(disconnectionService));

			disconnectionServiceHandler = disconnectionService;
			networkReciever = reciever;
			deserializer = deserializationStrat;

			//Publish that we are connecting
			networkReciever.OnNetworkMessageReceive(new PhotonStatusMessageAdapter(NetStatus.Connecting), null);
		}
예제 #4
0
        public GladNetOutboundS2SPeer(GladNetAppBase appBase, INetworkMessageReceiver reciever, IDeserializerStrategy deserializationStrat,
                                      IDisconnectionServiceHandler disconnectionService)
            : base(appBase)
        {
            Throw <ArgumentNullException> .If.IsNull(appBase)?.Now(nameof(appBase));

            Throw <ArgumentNullException> .If.IsNull(reciever)?.Now(nameof(reciever));

            Throw <ArgumentNullException> .If.IsNull(deserializationStrat)?.Now(nameof(deserializationStrat));

            Throw <ArgumentNullException> .If.IsNull(disconnectionService)?.Now(nameof(disconnectionService));

            disconnectionServiceHandler = disconnectionService;
            networkReciever             = reciever;
            deserializer = deserializationStrat;

            //Publish that we are connecting
            networkReciever.OnNetworkMessageReceive(new PhotonStatusMessageAdapter(NetStatus.Connecting), null);
        }
예제 #5
0
		/// <summary>
		/// Dispatches the <see cref="RequestMessage"/> (this) to the supplied <see cref="INetworkMessageReceiver"/>.
		/// </summary>
		/// <param name="receiver">The target <see cref="INetworkMessageReceiver"/>.</param>
		/// <exception cref="ArgumentNullException">Throws if either parameters are null.</exception>
		/// <param name="parameters">The <see cref="IMessageParameters"/> of the <see cref="RequestMessage"/>.</param>
		public override void Dispatch(INetworkMessageReceiver receiver, IMessageParameters parameters)
		{
			Throw<ArgumentNullException>.If.IsNull(receiver)
				?.Now(nameof(receiver), $"{nameof(INetworkMessageReceiver)} parameter is null in {this.GetType().Name}");

			Throw<ArgumentNullException>.If.IsNull(parameters)
				?.Now(nameof(parameters), $"{nameof(IMessageParameters)} parameter is null in {this.GetType().Name}");

			receiver.OnNetworkMessageReceive(this, parameters);
		}