forked from tmoonlight/NSmartProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClientIdAppId.cs
More file actions
29 lines (28 loc) · 808 Bytes
/
ClientIdAppId.cs
File metadata and controls
29 lines (28 loc) · 808 Bytes
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
namespace NSmartProxy.Data
{
/// <summary>
/// 客户端和appid的组合
/// </summary>
public class ClientIdAppId : ByteSerializeableObject
{
public int ClientId; //2
public int AppId; //1
public override byte[] ToBytes()
{
byte[] bytes = new byte[3];
byte[] clientIdBytres = IntTo2Bytes(ClientId);
bytes[0] = clientIdBytres[0];
bytes[1] = clientIdBytres[1];
bytes[2] = (byte)AppId;
return bytes;
}
public static ClientIdAppId GetFromBytes(byte[] bytes)
{
return new ClientIdAppId
{
ClientId = DoubleBytesToInt(bytes[0], bytes[1]),
AppId = bytes[2]
};
}
}
}