コード例 #1
0
 private void OnExecutionFinished()
 {
     if (MyExecutionFinished != null)
     {
         MyExecutionFinished.Invoke();
     }
 }
コード例 #2
0
 public void Execute()
 {
     if (CommandEvent != null)
     {
         CommandEvent.Invoke();
     }
 }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
ファイル: OTCPServer.cs プロジェクト: karusb/ObjectTCP
        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);
                }
            }
        }
コード例 #5
0
 public static void Send(params object[] args)
 {
     if (CommandEvent != null)
     {
         CommandEvent.Invoke(args);
     }
 }
コード例 #6
0
        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);
                }
            }
        }
コード例 #7
0
    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);
        }
    }
コード例 #8
0
 // 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));
 }
コード例 #9
0
 private void CommandPassed(Command command, ParsedCommand parsedCommand)
 {
     TerminalTimePast(command.GetTerminalTimePast(parsedCommand));
     onCommand.Invoke(command, parsedCommand);
 }
コード例 #10
0
 public string InvokeWithArgs(string[] args)
 {
     return(commandFunc?.Invoke(args));
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: gustavnilsson14/ldjam48
 protected void OnCommand(Command command, ParsedCommand parsedCommand)
 {
     ModifyCharacters(parsedCommand.GetCommandString());
     onCommand.Invoke(command, parsedCommand);
 }