public async Task UnsafeSendCommand(Command command, WriterCall writerCall)
        {
            if (command.Identifier > 1000)
            {
                if (!await PreparePlugin(command.Identifier))
                {
                    return;
                }
            }

            Sender.UnsafeSendCommand(ClientInformation.Id, command.Identifier, writerCall);

            PackageSent?.Invoke(this, new PackageInformation
            {
                Description = $"UnsafeSendCommand ({command} / ID: {command.Identifier})",
                IsReceived  = false,
                Size        = writerCall.Size,
                Timestamp   = DateTime.Now
            });
        }
        public async Task SendCommand(Command command, byte[] data,
                                      PackageCompression packageCompression = PackageCompression.Auto)
        {
            if (command.Identifier > 1000)
            {
                if (!await PreparePlugin(command.Identifier))
                {
                    return;
                }
            }

            var commandSettings = _commander.GetCommandSettings(command);

            if (commandSettings.Libraries.Count > 0)
            {
                PortableLibrary libraries = commandSettings.Libraries[0];
                for (int i = 1; i < commandSettings.Libraries.Count; i++)
                {
                    libraries |= commandSettings.Libraries[i];
                }

                if (!await LoadLibraries(libraries))
                {
                    return;
                }
            }

            Sender.UnsafeSendCommand(ClientInformation.Id, command.Identifier, new WriterCall(data));

            PackageSent?.Invoke(this, new PackageInformation
            {
                IsReceived  = false,
                Size        = data.Length + 9,
                Timestamp   = DateTime.Now,
                Description = "SendCommand " + Commander.GetCommandDescription(command, data, false)
            });
        }
 public Task SendCommand(Command command, IDataInfo dataInfo)
 {
     return(UnsafeSendCommand(command, new WriterCall(dataInfo)));
 }
 public Task SendCommand(Command command, byte data)
 {
     return(SendCommand(command, new[] { data }, PackageCompression.DoNotCompress));
 }
 public Task UnsafeSendCommand(Command command, int length, Action <BinaryWriter> writerCall)
 {
     return(UnsafeSendCommand(command, new WriterCall(length, writerCall)));
 }