Skip to content

Commit

Permalink
use default param value
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed Jul 9, 2023
1 parent 1ac8a19 commit bb75ca9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 103 deletions.
16 changes: 4 additions & 12 deletions EzyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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();

Expand Down
22 changes: 0 additions & 22 deletions EzyTcpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,13 @@ 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();
EzyData data = request.serialize();
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;
Expand Down Expand Up @@ -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");
Expand Down
9 changes: 0 additions & 9 deletions EzyUTClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,13 @@ 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();
EzyData data = request.serialize();
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;
Expand Down
42 changes: 6 additions & 36 deletions support/EzyAppProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,62 +25,32 @@ public EzyAppProxy(EzySocketProxy socketProxy, String appName)
new Dictionary<String, IDictionary<Object, AppProxyDataHandler>>();
}

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<EzyData>(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<EzyData>(data), encrypted);
}
Expand Down
28 changes: 4 additions & 24 deletions support/EzySocketProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EzyArray>(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<EzyArray>(data), encrypted);
}
Expand Down

0 comments on commit bb75ca9

Please sign in to comment.