Exemplo n.º 1
0
        public void CheckMessage(ServerMessage aMsg)
        {
            Console.WriteLine($"Got a message back with Id {aMsg.Id}");
            // We'll never match a system message, those are server -> client only.
            if (aMsg.Id == 0)
            {
                throw new ButtplugMessageException("Cannot sort message with System ID");
            }

            // If we haven't gotten a system message and we're not currently waiting for the message
            // id, throw.
            if (!_waitingMsgs.TryRemove(aMsg.Id, out var queued))
            {
                throw new ButtplugMessageException("Message with non-matching ID received.");
            }

            if (aMsg.MessageType is ServerMessageType.Error)
            {
                queued.SetException(ButtplugException.FromError(aMsg));
                return;
            }

            queued.SetResult(aMsg);
        }
Exemplo n.º 2
0
 public ButtplugExceptionEventArgs(ButtplugException ex)
 {
     Exception = ex;
 }