Skip to content

Commit bb75ca9

Browse files
committed
use default param value
1 parent 1ac8a19 commit bb75ca9

File tree

5 files changed

+14
-103
lines changed

5 files changed

+14
-103
lines changed

EzyClient.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ public interface EzyClient
2121

2222
bool reconnect();
2323

24-
void send(EzyRequest request);
24+
void send(EzyRequest request, bool encrypted = false);
2525

26-
void send(EzyRequest request, bool encrypted);
27-
28-
void send(EzyCommand cmd, EzyArray data);
29-
30-
void send(EzyCommand cmd, EzyArray data, bool encrypted);
26+
void send(EzyCommand cmd, EzyArray data, bool encrypted = false);
3127

3228
void disconnect(int reason = (int)EzyDisconnectReason.CLOSE);
3329

@@ -39,13 +35,9 @@ public interface EzyClient
3935

4036
void udpConnect(String host, int port);
4137

42-
void udpSend(EzyRequest request);
43-
44-
void udpSend(EzyRequest request, bool encrypted);
45-
46-
void udpSend(EzyCommand cmd, EzyArray data);
38+
void udpSend(EzyRequest request, bool encrypted = false);
4739

48-
void udpSend(EzyCommand cmd, EzyArray data, bool encrypted);
40+
void udpSend(EzyCommand cmd, EzyArray data, bool encrypted = false);
4941

5042
String getName();
5143

EzyTcpClient.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -153,25 +153,13 @@ public void close()
153153
disconnect((int) EzyDisconnectReason.CLOSE);
154154
}
155155

156-
public void send(EzyRequest request)
157-
{
158-
send(request, false);
159-
}
160-
161-
162156
public void send(EzyRequest request, bool encrypted)
163157
{
164158
Object cmd = request.getCommand();
165159
EzyData data = request.serialize();
166160
send((EzyCommand)cmd, (EzyArray)data, encrypted);
167161
}
168162

169-
public void send(EzyCommand cmd, EzyArray data)
170-
{
171-
send(cmd, data, false);
172-
173-
}
174-
175163
public void send(EzyCommand cmd, EzyArray data, bool encrypted)
176164
{
177165
bool shouldEncrypted = encrypted;
@@ -399,21 +387,11 @@ public virtual void udpConnect(String host, int port)
399387
throw new InvalidOperationException("only support TCP, use EzyUTClient instead");
400388
}
401389

402-
public virtual void udpSend(EzyRequest request)
403-
{
404-
throw new InvalidOperationException("only support TCP, use EzyUTClient instead");
405-
}
406-
407390
public virtual void udpSend(EzyRequest request, bool encrypted)
408391
{
409392
throw new InvalidOperationException("only support TCP, use EzyUTClient instead");
410393
}
411394

412-
public virtual void udpSend(EzyCommand cmd, EzyArray data)
413-
{
414-
throw new InvalidOperationException("only support TCP, use EzyUTClient instead");
415-
}
416-
417395
public virtual void udpSend(EzyCommand cmd, EzyArray data, bool encrypted)
418396
{
419397
throw new InvalidOperationException("only support TCP, use EzyUTClient instead");

EzyUTClient.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,13 @@ public override void udpConnect(String host, int port)
2828
((EzyUTSocketClient)socketClient).udpConnect(host, port);
2929
}
3030

31-
public override void udpSend(EzyRequest request)
32-
{
33-
udpSend(request, false);
34-
}
35-
3631
public override void udpSend(EzyRequest request, bool encrypted)
3732
{
3833
Object cmd = request.getCommand();
3934
EzyData data = request.serialize();
4035
udpSend((EzyCommand)cmd, (EzyArray)data, encrypted);
4136
}
4237

43-
public override void udpSend(EzyCommand cmd, EzyArray data) {
44-
udpSend(cmd, data, false);
45-
}
46-
4738
public override void udpSend(EzyCommand cmd, EzyArray data, bool encrypted)
4839
{
4940
bool shouldEncrypted = encrypted;

support/EzyAppProxy.cs

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,62 +25,32 @@ public EzyAppProxy(EzySocketProxy socketProxy, String appName)
2525
new Dictionary<String, IDictionary<Object, AppProxyDataHandler>>();
2626
}
2727

28-
public void send(EzyRequest request)
29-
{
30-
send(request, false);
31-
}
32-
33-
public void send(EzyRequest request, bool encrypted)
28+
public void send(EzyRequest request, bool encrypted = false)
3429
{
3530
app.send(request, encrypted);
3631
}
3732

38-
public void send(String cmd)
39-
{
40-
send(cmd, false);
41-
}
42-
43-
public void send(String cmd, bool encrypted)
33+
public void send(String cmd, bool encrypted = false)
4434
{
4535
app.send(cmd, encrypted);
4636
}
4737

48-
public void send(String cmd, Object data)
49-
{
50-
send(cmd, data, false);
51-
}
52-
53-
public void send(String cmd, Object data, bool encrypted)
38+
public void send(String cmd, Object data, bool encrypted = false)
5439
{
5540
app.send(cmd, binding.marshall<EzyData>(data), encrypted);
5641
}
5742

58-
public void udpSend(EzyRequest request)
59-
{
60-
udpSend(request, false);
61-
}
62-
63-
public void udpSend(EzyRequest request, bool encrypted)
43+
public void udpSend(EzyRequest request, bool encrypted = false)
6444
{
6545
app.udpSend(request, encrypted);
6646
}
6747

68-
public void udpSend(String cmd)
69-
{
70-
udpSend(cmd, false);
71-
}
72-
73-
public void udpSend(String cmd, bool encrypted)
48+
public void udpSend(String cmd, bool encrypted = false)
7449
{
7550
app.udpSend(cmd, encrypted);
7651
}
7752

78-
public void udpSend(String cmd, Object data)
79-
{
80-
udpSend(cmd, data, false);
81-
}
82-
83-
public void udpSend(String cmd, Object data, bool encrypted)
53+
public void udpSend(String cmd, Object data, bool encrypted = false)
8454
{
8555
app.udpSend(cmd, binding.marshall<EzyData>(data), encrypted);
8656
}

support/EzySocketProxy.cs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,42 +203,22 @@ private void init()
203203
}
204204
}
205205

206-
public void send(EzyRequest request)
207-
{
208-
send(request, false);
209-
}
210-
211-
public void send(EzyRequest request, bool encrypted)
206+
public void send(EzyRequest request, bool encrypted = false)
212207
{
213208
client.send(request, encrypted);
214209
}
215210

216-
public void send(EzyCommand cmd, Object data)
217-
{
218-
send(cmd, data, false);
219-
}
220-
221-
public void send(EzyCommand cmd, Object data, bool encrypted)
211+
public void send(EzyCommand cmd, Object data, bool encrypted = false)
222212
{
223213
client.send(cmd, binding.marshall<EzyArray>(data), encrypted);
224214
}
225215

226-
public void udpSend(EzyRequest request)
227-
{
228-
udpSend(request, false);
229-
}
230-
231-
public void udpSend(EzyRequest request, bool encrypted)
216+
public void udpSend(EzyRequest request, bool encrypted = false)
232217
{
233218
client.udpSend(request, encrypted);
234219
}
235220

236-
public void udpSend(EzyCommand cmd, EzyArray data)
237-
{
238-
udpSend(cmd, data, false);
239-
}
240-
241-
public void udpSend(EzyCommand cmd, EzyArray data, bool encrypted)
221+
public void udpSend(EzyCommand cmd, EzyArray data, bool encrypted = false)
242222
{
243223
client.udpSend(cmd, binding.marshall<EzyArray>(data), encrypted);
244224
}

0 commit comments

Comments
 (0)