private void OnExecutionFinished() { if (MyExecutionFinished != null) { MyExecutionFinished.Invoke(); } }
public void Execute() { if (CommandEvent != null) { CommandEvent.Invoke(); } }
void processClient(object obj) { var client = (TcpClient)obj; var Nw = client.GetStream(); byte[] data = new byte[4096]; int bytesRead; while (true) { bytesRead = 0; try { bytesRead = Nw.Read(data, 0, 4096); } catch { break; } if (bytesRead == 0) { } UnicodeEncoding ue = new UnicodeEncoding(); CommandEvent?.Invoke(client.Client.RemoteEndPoint.ToString(), ue.GetString(data, 0, bytesRead)); } }
public void HandleClient(object obj) { TcpClient client = (TcpClient)obj; client.ReceiveBufferSize = int.MaxValue; client.SendBufferSize = int.MaxValue; while (client.Connected) { while (client.Available <= 0) { ; } //byte[] data = Encoding.ASCII.GetBytes("Send next data: [enter 'quit' to terminate] "); //client.GetStream().Write(data, 0, data.Length); OTcpServerMessage receivedMessage = Receive(ref client); if (receivedMessage != null) { Guid commandId = new Guid(); string commandString = Commands.GetCommandFromHash(receivedMessage.Header.CommandHash); commandQueue.Add(commandId, client); issuedCommands.Add(commandId, new Tuple <string, object>(commandString, receivedMessage.Message)); CommandEvent?.Invoke(commandId, commandString); } } }
public static void Send(params object[] args) { if (CommandEvent != null) { CommandEvent.Invoke(args); } }
protected virtual async Task OnMessageEvent(object sender, IMessageBase args) { var responses = _service.ProcessMessage(args); foreach (var response in responses) { switch (response) { case CommandTwitchEventArgs c: if (CommandTwitchEvent != null) { await CommandTwitchEvent?.Invoke(sender, c); } break; case CommandDiscordEventArgs c: if (CommandDiscordEvent != null) { await CommandDiscordEvent?.Invoke(sender, c); } break; case CommandWSEventArgs c: if (CommandWebsocketEvent != null) { await CommandWebsocketEvent?.Invoke(sender, c); } break; case CommandTcpEventArgs c: if (CommandTcpEvent != null) { await CommandTcpEvent?.Invoke(sender, c); } break; default: break; } if (CommandEvent != null) { await CommandEvent?.Invoke(sender, response); } } }
private void OnButtonClick() { byte result = value; if (output != null) { string text = ""; if ((result & 128) != 0) { text += "1"; } else { text += "0"; } if ((result & 64) != 0) { text += "1"; } else { text += "0"; } if ((result & 32) != 0) { text += "1"; } else { text += "0"; } if ((result & 16) != 0) { text += "1"; } else { text += "0"; } if ((result & 8) != 0) { text += "1"; } else { text += "0"; } if ((result & 4) != 0) { text += "1"; } else { text += "0"; } if ((result & 2) != 0) { text += "1"; } else { text += "0"; } if ((result & 1) != 0) { text += "1"; } else { text += "0"; } output.text = text; } if (OnCommandSend != null) { OnCommandSend.Invoke(this, result); } }
// The command callback implementation - used by MfdSupport void IMfdSupport.Command(MfdInstance mfd, string commandArgument, bool pressed) { // just send it to the Owner Form - no local processing in the UC CommandEvent?.Invoke(this, new UC_MFD_CmdEventArgs(mfd, commandArgument, pressed)); }
private void CommandPassed(Command command, ParsedCommand parsedCommand) { TerminalTimePast(command.GetTerminalTimePast(parsedCommand)); onCommand.Invoke(command, parsedCommand); }
public string InvokeWithArgs(string[] args) { return(commandFunc?.Invoke(args)); }
protected void OnCommand(Command command, ParsedCommand parsedCommand) { ModifyCharacters(parsedCommand.GetCommandString()); onCommand.Invoke(command, parsedCommand); }