コード例 #1
0
        public ServerLoginUserInfo GetLoginUserInfo(OperationContext context)
        {
            var imp = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            ServerLoginUserInfo user = GetLoginUserInfo(String.Format("{0}:{1}", imp.Address, imp.Port));

            if (user != null)
            {
                user.RegisterOperationContext(context);
                return(user);
            }
            return(null);
        }
コード例 #2
0
        public ServerLoginUserInfo RegisterService(OperationContext context, int linkPort)
        {
            var    imp               = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string ipport1           = String.Format("{0}:{1}", imp.Address, linkPort);
            ServerLoginUserInfo user = GetLoginUserInfo(ipport1);

            if (user != null)
            {
                string ipport2 = String.Format("{0}:{1}", imp.Address, imp.Port);
                OnlineSessions[ipport2] = user.AccountID;
                user.RegisterOperationContext(context);
                return(user);
            }
            return(null);
        }