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); }
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 )); }
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()); }