예제 #1
0
        /// <summary>
        /// Validates the user name and password combination.
        /// </summary>
        /// <param name="userName">The user name.</param>
        /// <param name="password">The password.</param>
        public override void Validate(string userName, string password)
        {
            var xiake = OnlineXiakeManager.GetOnlineXiake(userName);
            if (xiake == null || xiake.Token != password)
            {
                var rv = mMasterServiceProxy.XiakeLogin(userName);
                if(rv == null)
                {
                    throw new FaultException("你还没登录啊");
                }  
                if(rv.Token != password)
                    throw new FaultException("你是不是想干坏事啊"); 

                xiake = new LoginXiake()
                {
                    Id = rv.ID,
                    XiakeType = rv.XiakeType,
                    Name = rv.Name,
                    Token = rv.Token,
                    XiakeLevel = rv.XiakeLevel
                };

                OnlineXiakeManager.AddXiake(xiake);
                
            }

                    
             
        }
예제 #2
0
 public void AddXiake (LoginXiake xiake)
 {
     lock(LockObject)
     {
         var oldXiake = mLoginXiakes.FirstOrDefault(a => a.Id == xiake.Id );
         if (oldXiake != null)
         {
             mLoginXiakes.Remove(oldXiake);
         }
         mLoginXiakes.Add(xiake); 
     }
 }
예제 #3
0
        public void AddXiake (long id, string name, string tokenPass, XiakeType xiakeType, XiakeLevel xiakeLevel)
        {
            lock(LockObject)
            {
                var newXiake = new LoginXiake()
                {
                    Id = id,
                    Name = name,
                    Token = tokenPass,
                    XiakeType = xiakeType,
                    XiakeLevel = xiakeLevel
                };

                var oldXiake = mLoginXiakes.FirstOrDefault(a => a.Id == id);
                if(oldXiake != null)
                {
                    mLoginXiakes.Remove(oldXiake);
                }
                mLoginXiakes.Add(newXiake); 
            } 
        }
예제 #4
0
        public void Checkin (LoginXiake xk, IWcfChatClientService face)
        {
             if(face == null)
                return;

            lock(LockObject)
            {
                var xiake = mLoginXiakes.FirstOrDefault(a => a.Id == xk.Id);
                if(xiake == null)
                {

                    this.AddXiake(xiake);
                } else
                {
                
                    xiake.Id = xk.Id;
                    xiake.Name = xk.Name;
                    xiake.LoginTime = xk.LoginTime;
                    xiake.Token = xk.Token;
                    xiake.XiakeLevel = xk.XiakeLevel;
                    xiake.XiakeType = xk.XiakeType; 
                } 

                xiake.ClientFace = face;
                var client = (ICommunicationObject)xiake.ClientFace;
                if (client != null)
                {
                    client.Closed += client_Closed;
                }
            }
            
        }