Esempio n. 1
0
        async Task IGangController.SendCommandAsync(
            string type, object data, IEnumerable <byte[]> memberIds, uint?replySequence)
        {
            var bytes = _serializer.SerializeCommandData(
                type, data,
                replySequence
                );
            var audit = new GangAudit(_gangId, ++_commandSequence, Member.Id, Member.Session?.User.Id);

            await _sendAsync(GangMessageTypes.Command, bytes, audit, memberIds);
        }
Esempio n. 2
0
        public static byte[] SerializeCommandData(
            this IGangSerializationService service,
            object data,
            uint?replySequence = null)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            return(service.SerializeCommandData(
                       data.GetType().GetCommandTypeName(), data,
                       replySequence
                       ));
        }
Esempio n. 3
0
        public static byte[] SerializeCommand(
            this IGangSerializationService service,
            uint sequence,
            string type, object data,
            uint?replySequence = null)
        {
            if (data is null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            return(BitConverter.GetBytes(sequence)
                   .Concat(service.SerializeCommandData(
                               type,
                               data,
                               replySequence
                               ))
                   .ToArray());
        }