Exemple #1
0
        public async Task Send <TCommand>(TCommand command, CancellationToken cancellationToken) where TCommand : ICommand
        {
            var handler = _lifetimeScope.Resolve <IHandleCommand <TCommand> >();
            await handler.Handle(command, cancellationToken);

            CommandSent?.Invoke(this, new CommandSentEventArgs(command));
        }
Exemple #2
0
        private FTPResponse SendCommand(string command, bool checkConnection)
        {
            // make sure we're connected
            if (checkConnection)
            {
                CheckConnect();
            }

            // encode the command
            byte[] bytes = Encoding.ASCII.GetBytes((command + "\r\n").ToCharArray());

            // send it
            m_cmdsocket.Send(bytes, bytes.Length, 0);

            if (CommandSent != null)
            {
                foreach (FTPCommandHandler ch in CommandSent.GetInvocationList())
                {
                    ch(this, command);
                }
            }

            ReadResponse();

            return(m_response);
        }
Exemple #3
0
 protected virtual void OnCommandSent(SerialEventArgs info)
 {
     if (CommandSent != null)
     {
         Task.Run(() => CommandSent?.Invoke(this, info));
     }
 }
 public override void SendCommand(string command)
 {
     if (!Port.IsOpen)
     {
         return;
     }
     Port.Write(command);
     CommandSent?.Invoke(this, command);
     Thread.Sleep(Delay);
 }
Exemple #5
0
        public override void SendCommand(string command)
        {
            if (!IsConnected)
            {
                return;
            }
            var stream = Client.GetStream();
            var data   = Encoding.ASCII.GetBytes(command);

            stream.Write(data, 0, data.Length);
            CommandSent?.Invoke(this, command);
            Thread.Sleep(Delay);
        }
Exemple #6
0
        /// <summary>
        /// ボナンザへの書き込みを行います。
        /// </summary>
        private void WriteMain(object arg)
        {
            var writer = (StreamWriter)arg;

            while (!this.aborted)
            {
                var command = GetWriteCommand();
                if (command == null)
                {
                    continue;
                }

                writer.WriteLine(command + "\n");
                writer.Flush();

                CommandSent.SafeRaiseEvent(this,
                                           new BonanzaReceivedCommandEventArgs(command));
            }
        }
Exemple #7
0
 private void OnCommandSent(string command)
 {
     CommandSent?.Invoke(this, new PortCommandSentEventArgs(command));
 }
Exemple #8
0
 internal static void InvokeCommandSent(CommandSentArgs args)
 {
     CommandSent?.Invoke(null, args);
 }
 protected virtual void OnCommandSent(ICommand command) =>
 CommandSent?.Invoke(this, command);
Exemple #10
0
 public void RaiseCommand(BaseCommand <TGame, TPlayer, TRoom, TContainer, TThing> cmd) => CommandSent?.Invoke(this, cmd);
Exemple #11
0
 /// <summary>
 /// Raises the <see cref="CommandSent"/> event with passed data.
 /// </summary>
 /// <param name="message">NMDC-message that represents the <paramref name="command"/>.</param>
 /// <param name="command">Sent command.</param>
 private void OnCommandSent(string message, NmdcCommand command)
 {
     CommandSent?.Invoke(this, new NmdcCommandTransferredArgs(DateTime.Now, message, command));
 }
Exemple #12
0
 private void OnCommandSent(string command)
 {
     CommandSent?.Invoke(this, command);
 }