1
yangle
昨天 6d0bfe2160e06a4502dc3052c43fab9813341db3
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
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using Taobao.Top.Link.Endpoints;
 
namespace Top.Tmc
{
    /// <summary>消息服务客户端标识</summary>
    public class TmcClientIdentity : Identity
    {
        /// <summary>获取appKey
        /// </summary>
        public string AppKey { get; private set; }
        /// <summary>获取groupName
        /// </summary>
        public string GroupName { get; private set; }
 
        public TmcClientIdentity(string appKey, string groupName)
        {
            this.AppKey = appKey;
            this.GroupName = groupName;
        }
 
        public bool Equals(Identity id)
        {
            var tmcId = id as TmcClientIdentity;
            return tmcId != null
                && this.AppKey == tmcId.AppKey
                && this.GroupName == tmcId.GroupName;
        }
 
        public Identity Parse(object data)
        {
            throw new NotImplementedException();
        }
 
        public void Render(object to)
        {
 
        }
 
        public override string ToString()
        {
            return this.AppKey + "-" + this.GroupName;
        }
 
        public override int GetHashCode()
        {
            return (this.AppKey + this.GroupName).GetHashCode();
        }
    }
 
    /// <summary>TMC服务端标识
    /// </summary>
    public class TmcServerIdentity : Identity
    {
        public bool Equals(Identity id)
        {
            return id is TmcServerIdentity;
        }
 
        public Identity Parse(object data)
        {
            throw new NotImplementedException();
        }
 
        public void Render(object to)
        {
            throw new NotImplementedException();
        }
 
        public override string ToString()
        {
            return "tmc-server";
        }
    }
}