public async Task SendCommandAsync(string command, string parameters) { if (this.NetworkStream == null) { throw new InvalidOperationException( "Can't send message before connecting. Did you call APIClient.ConnectAsync()?"); } ISCPPacket Packet = new ISCPPacket(new ISCPMessage(command, parameters)); byte[] WriteBytes = Packet.Serialize(); await this.NetworkStream.WriteAsync(WriteBytes, 0, WriteBytes.Length); }