Repository navigation
Expand file tree
/
Copy pathAuthenticateExecutor.cs
More file actions
executable file
·63 lines (57 loc) · 1.72 KB
/
Copy pathAuthenticateExecutor.cs
File metadata and controls
executable file
·63 lines (57 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Command;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RemoteControl
{
public class AuthenticateExecutor:IExecutor
{
private string[] _commandText;
public string[] CommandText
{
get { return _commandText; }
}
public string AuthenticationString { get; set; }
public AuthenticateExecutor()
{
_commandText = new string[] { "connect"};
}
public AuthenticateExecutor(string astr):this()
{
AuthenticationString = astr;
}
public void Excute(AsyncParameters parameters, string cmd)
{
try
{
if (string.IsNullOrEmpty(AuthenticationString))
{
parameters.Client.Send(Encoding.UTF8.GetBytes("ok"));
}
else
{
string[] parms = cmd.Split('|');
if (parms != null && parms.Length > 1)
{
if (parms[1] == AuthenticationString)
{
parameters.Client.Send(Encoding.UTF8.GetBytes("ok"));
}
else
{
parameters.Client.Send(Encoding.UTF8.GetBytes("failed"));
}
}
else
{
parameters.Client.Send(Encoding.UTF8.GetBytes("key"));
}
}
}
catch
{
}
}
}
}