diff --git a/EzyClient.cs b/EzyClient.cs index 1ecd340..e84c8c2 100644 --- a/EzyClient.cs +++ b/EzyClient.cs @@ -21,13 +21,9 @@ public interface EzyClient bool reconnect(); - void send(EzyRequest request); + void send(EzyRequest request, bool encrypted = false); - void send(EzyRequest request, bool encrypted); - - void send(EzyCommand cmd, EzyArray data); - - void send(EzyCommand cmd, EzyArray data, bool encrypted); + void send(EzyCommand cmd, EzyArray data, bool encrypted = false); void disconnect(int reason = (int)EzyDisconnectReason.CLOSE); @@ -39,13 +35,9 @@ public interface EzyClient void udpConnect(String host, int port); - void udpSend(EzyRequest request); - - void udpSend(EzyRequest request, bool encrypted); - - void udpSend(EzyCommand cmd, EzyArray data); + void udpSend(EzyRequest request, bool encrypted = false); - void udpSend(EzyCommand cmd, EzyArray data, bool encrypted); + void udpSend(EzyCommand cmd, EzyArray data, bool encrypted = false); String getName(); diff --git a/EzyTcpClient.cs b/EzyTcpClient.cs index 06cd1be..d66571b 100644 --- a/EzyTcpClient.cs +++ b/EzyTcpClient.cs @@ -153,12 +153,6 @@ public void close() disconnect((int) EzyDisconnectReason.CLOSE); } - public void send(EzyRequest request) - { - send(request, false); - } - - public void send(EzyRequest request, bool encrypted) { Object cmd = request.getCommand(); @@ -166,12 +160,6 @@ public void send(EzyRequest request, bool encrypted) send((EzyCommand)cmd, (EzyArray)data, encrypted); } - public void send(EzyCommand cmd, EzyArray data) - { - send(cmd, data, false); - - } - public void send(EzyCommand cmd, EzyArray data, bool encrypted) { bool shouldEncrypted = encrypted; @@ -399,21 +387,11 @@ public virtual void udpConnect(String host, int port) throw new InvalidOperationException("only support TCP, use EzyUTClient instead"); } - public virtual void udpSend(EzyRequest request) - { - throw new InvalidOperationException("only support TCP, use EzyUTClient instead"); - } - public virtual void udpSend(EzyRequest request, bool encrypted) { throw new InvalidOperationException("only support TCP, use EzyUTClient instead"); } - public virtual void udpSend(EzyCommand cmd, EzyArray data) - { - throw new InvalidOperationException("only support TCP, use EzyUTClient instead"); - } - public virtual void udpSend(EzyCommand cmd, EzyArray data, bool encrypted) { throw new InvalidOperationException("only support TCP, use EzyUTClient instead"); diff --git a/EzyUTClient.cs b/EzyUTClient.cs index d0c6473..0513750 100644 --- a/EzyUTClient.cs +++ b/EzyUTClient.cs @@ -28,11 +28,6 @@ public override void udpConnect(String host, int port) ((EzyUTSocketClient)socketClient).udpConnect(host, port); } - public override void udpSend(EzyRequest request) - { - udpSend(request, false); - } - public override void udpSend(EzyRequest request, bool encrypted) { Object cmd = request.getCommand(); @@ -40,10 +35,6 @@ public override void udpSend(EzyRequest request, bool encrypted) udpSend((EzyCommand)cmd, (EzyArray)data, encrypted); } - public override void udpSend(EzyCommand cmd, EzyArray data) { - udpSend(cmd, data, false); - } - public override void udpSend(EzyCommand cmd, EzyArray data, bool encrypted) { bool shouldEncrypted = encrypted; diff --git a/support/EzyAppProxy.cs b/support/EzyAppProxy.cs index bc5f214..95d543f 100644 --- a/support/EzyAppProxy.cs +++ b/support/EzyAppProxy.cs @@ -25,62 +25,32 @@ public EzyAppProxy(EzySocketProxy socketProxy, String appName) new Dictionary>(); } - public void send(EzyRequest request) - { - send(request, false); - } - - public void send(EzyRequest request, bool encrypted) + public void send(EzyRequest request, bool encrypted = false) { app.send(request, encrypted); } - public void send(String cmd) - { - send(cmd, false); - } - - public void send(String cmd, bool encrypted) + public void send(String cmd, bool encrypted = false) { app.send(cmd, encrypted); } - public void send(String cmd, Object data) - { - send(cmd, data, false); - } - - public void send(String cmd, Object data, bool encrypted) + public void send(String cmd, Object data, bool encrypted = false) { app.send(cmd, binding.marshall(data), encrypted); } - public void udpSend(EzyRequest request) - { - udpSend(request, false); - } - - public void udpSend(EzyRequest request, bool encrypted) + public void udpSend(EzyRequest request, bool encrypted = false) { app.udpSend(request, encrypted); } - public void udpSend(String cmd) - { - udpSend(cmd, false); - } - - public void udpSend(String cmd, bool encrypted) + public void udpSend(String cmd, bool encrypted = false) { app.udpSend(cmd, encrypted); } - public void udpSend(String cmd, Object data) - { - udpSend(cmd, data, false); - } - - public void udpSend(String cmd, Object data, bool encrypted) + public void udpSend(String cmd, Object data, bool encrypted = false) { app.udpSend(cmd, binding.marshall(data), encrypted); } diff --git a/support/EzySocketProxy.cs b/support/EzySocketProxy.cs index e4baa94..f22d740 100644 --- a/support/EzySocketProxy.cs +++ b/support/EzySocketProxy.cs @@ -203,42 +203,22 @@ private void init() } } - public void send(EzyRequest request) - { - send(request, false); - } - - public void send(EzyRequest request, bool encrypted) + public void send(EzyRequest request, bool encrypted = false) { client.send(request, encrypted); } - public void send(EzyCommand cmd, Object data) - { - send(cmd, data, false); - } - - public void send(EzyCommand cmd, Object data, bool encrypted) + public void send(EzyCommand cmd, Object data, bool encrypted = false) { client.send(cmd, binding.marshall(data), encrypted); } - public void udpSend(EzyRequest request) - { - udpSend(request, false); - } - - public void udpSend(EzyRequest request, bool encrypted) + public void udpSend(EzyRequest request, bool encrypted = false) { client.udpSend(request, encrypted); } - public void udpSend(EzyCommand cmd, EzyArray data) - { - udpSend(cmd, data, false); - } - - public void udpSend(EzyCommand cmd, EzyArray data, bool encrypted) + public void udpSend(EzyCommand cmd, EzyArray data, bool encrypted = false) { client.udpSend(cmd, binding.marshall(data), encrypted); }