Esempio n. 1
0
        private static void APIConnection_OutputData(object sender, OutputEventArgs e)
        {
            if (e.Data == null)
            {
                return;
            }

            if (e.Data.IndexOf(chatTag) == 0)
            {
                ChatData?.Invoke(sender, new OutputEventArgs(e.Data.Substring(chatTag.Length)));
            }
            else if (e.Data.IndexOf(srvDataTagPlayer) == 0)
            {
                String             result = e.Data.Substring(srvDataTagPlayer.Length);
                PlayerActivityEnum act    = PlayerActivityEnum.Join;

                if (Regex.Match(result, "[A-Za-z0-9\\-]+" + srvPlayerJoin).Success)
                {
                    act    = PlayerActivityEnum.Join;
                    result = result.Remove(result.Length - srvPlayerJoin.Length, srvPlayerJoin.Length);
                }
                if (Regex.Match(result, "[A-Za-z0-9\\-]+" + srvPlayerLeave).Success)
                {
                    act    = PlayerActivityEnum.Leave;
                    result = result.Remove(result.Length - srvPlayerLeave.Length, srvPlayerLeave.Length);
                }

                PlayerData?.Invoke(sender, new PlayerEventArgs(result, act));
            }


            ConsoleData?.Invoke(sender, e);
        }
Esempio n. 2
0
        public void EscribirMensaje(string contenido)
        {   //Funcion que escribe el mensaje que le entra en el chat
            EscribirChat delegadoChat = new EscribirChat(EscribirMensajeDelegado);

            ChatData.Invoke(delegadoChat, new object[] { contenido });
            string[] Message = contenido.Split(';');
        }