Example #1
0
        private void OnMessage(object sender, ConnectionMessageEventArgs <string?> e)
        {
            if (string.IsNullOrEmpty(e.Message))
            {
                return;
            }

            var fields = e.Message?.Split(':') ?? new string[0];

            if (fields.Length != 3)
            {
                return;
            }

            if (!int.TryParse(fields[0], out var pid))
            {
                return;
            }

            switch (fields[1])
            {
            case "scanned" when bool.Parse(fields[2]):
                _clients[pid] = e.Connection.Id;

                Debug.WriteLine($"Dalamud client Id {e.Connection.Id} sig scanned");
                break;

            case "chatted" when bool.Parse(fields[2]):
                Debug.WriteLine($"Dalamud client Id {e.Connection.Id} chatted");

                break;
            }
        }
Example #2
0
 private void ServerOnMessageReceived(object?sender, ConnectionMessageEventArgs <TestCollection> args)
 {
     Trace.WriteLine($"Received collection with {args.Message.Count} items from the client");
     _actualData = args.Message;
     _actualHash = args.Message.GetHashCode();
     _barrier.Set();
 }
 private void OnMessageReceived(object sender, ConnectionMessageEventArgs e)
 {
     if (sender is WsConnection connection && connection.UniqueId == WsChannelId)
     {
         if (e.Type == MessageType.Data && !e.IsControlMessage())
         {
             ProcessWsMessage(e.Message);
         }
     }
 }
Example #4
0
 private void PipeServer_OnMessageReceived(object?_, ConnectionMessageEventArgs <string?> args)
 {
     try
     {
         OnCommandReceived(Command.Parse(args.Message ?? string.Empty));
     }
     catch (Exception exception)
     {
         OnExceptionOccurred(exception);
     }
 }
 private void OnMessageReceived(object sender, ConnectionMessageEventArgs e)
 {
     if (sender is WsConnection connection && connection.UniqueId == WsChannelId)
     {
         Task.Run(async() =>
         {
             if (e.Type == MessageType.Data && !e.IsControlMessage())
             {
                 await HandleMsgReceived(e.Message);
             }
         });
     }
Example #6
0
 private void OnConnectionErrorOccured(object source, ConnectionMessageEventArgs e)
 {
     ErrorOccured?.Invoke(source, e);
 }
Example #7
0
 private void OnConnectionMessageSent(object source, ConnectionMessageEventArgs e)
 {
     MessageSent?.Invoke(source, e);
 }
Example #8
0
 private void OnConnectionMessageReceived(object source, ConnectionMessageEventArgs e)
 {
     MessageReceived?.Invoke(source, e);
 }
Example #9
0
 private void OnMessageReceived(ConnectionMessageEventArgs <T> args)
 {
     MessageReceived?.Invoke(this, args);
 }