Ejemplo n.º 1
0
        public virtual PlayerInfo CreateLogin(string name, string password, ref string message, ref int isFirst, string IP, ref bool isError, bool firstValidate, ref bool isActive, string site, string nickname)
        {
            try
            {
                using (PlayerBussiness playerBussiness = new PlayerBussiness())
                {
                    bool       flag       = true;
                    DateTime   now        = DateTime.Now;
                    PlayerInfo playerInfo = playerBussiness.LoginGame(name, ref isFirst, ref flag, ref isError, firstValidate, ref now, nickname, IP);
                    if (playerInfo == null)
                    {
                        if (!playerBussiness.ActivePlayer(ref playerInfo, name, password, true, this.ActiveGold, this.ActiveMoney, IP, site))
                        {
                            playerInfo = null;
                            message    = LanguageMgr.GetTranslation("BaseInterface.LoginAndUpdate.Fail", new object[0]);
                            goto IL_11B;
                        }
                        isActive = true;
                        using (CenterServiceClient centerServiceClient = new CenterServiceClient())
                        {
                            centerServiceClient.ActivePlayer(true);
                            goto IL_11B;
                        }
                    }
                    if (flag)
                    {
                        using (CenterServiceClient centerServiceClient2 = new CenterServiceClient())
                        {
                            centerServiceClient2.CreatePlayer(playerInfo.ID, name, password, isFirst == 0);
                            goto IL_11B;
                        }
                    }
                    message = LanguageMgr.GetTranslation("ManageBussiness.Forbid1", new object[]
                    {
                        now.Year,
                        now.Month,
                        now.Day,
                        now.Hour,
                        now.Minute
                    });
                    PlayerInfo result = null;
                    return(result);

IL_11B:
                    result = playerInfo;
                    return(result);
                }
            }
            catch (Exception exception)
            {
                BaseInterface.log.Error("LoginAndUpdate", exception);
            }
            return(null);
        }
Ejemplo n.º 2
0
 public virtual PlayerInfo CreateLogin(string name, string password, ref string message, ref int isFirst, string IP, ref bool isError, bool firstValidate, ref bool isActive, string site, string nickname)
 {
     try
     {
         using (PlayerBussiness db = new PlayerBussiness())
         {
             bool       isExist    = true;
             DateTime   forbidDate = DateTime.Now;
             PlayerInfo info       = db.LoginGame(name, ref isFirst, ref isExist, ref isError, firstValidate, ref forbidDate, nickname);
             if (info == null)
             {
                 if (!db.ActivePlayer(ref info, name, password, true, ActiveGold, ActiveMoney, IP, site))
                 {
                     info = null;
                     // message = "Active is fail!";
                     message = LanguageMgr.GetTranslation("BaseInterface.LoginAndUpdate.Fail");
                 }
                 else
                 {
                     isActive = true;
                     using (CenterServiceClient client = new CenterServiceClient())
                     {
                         client.ActivePlayer(true);
                     }
                 }
             }
             else
             {
                 if (isExist)
                 {
                     using (CenterServiceClient client = new CenterServiceClient())
                     {
                         client.CreatePlayer(info.ID, name, password, isFirst == 0);
                     }
                 }
                 else
                 {
                     message = LanguageMgr.GetTranslation("ManageBussiness.Forbid1", forbidDate.Year, forbidDate.Month, forbidDate.Day, forbidDate.Hour, forbidDate.Minute);
                     return(null);
                 }
             }
             return(info);
         }
     }
     catch (Exception ex)
     {
         log.Error("LoginAndUpdate", ex);
     }
     return(null);
 }
Ejemplo n.º 3
0
 public virtual PlayerInfo CreateLogin(string name, string password, ref string message, ref int isFirst, string IP, ref bool isError, bool firstValidate, ref bool isActive, string site, string nickname)
 {
     try
     {
         using (PlayerBussiness playerBussiness = new PlayerBussiness())
         {
             bool       isExist = true;
             DateTime   now     = DateTime.Now;
             PlayerInfo player  = playerBussiness.LoginGame(name, ref isFirst, ref isExist, ref isError, firstValidate, ref now, nickname, IP);
             if (player == null)
             {
                 if (!playerBussiness.ActivePlayer(ref player, name, password, true, this.ActiveGold, this.ActiveMoney, IP, site))
                 {
                     player  = (PlayerInfo)null;
                     message = LanguageMgr.GetTranslation("BaseInterface.LoginAndUpdate.Fail", new object[0]);
                 }
                 else
                 {
                     isActive = true;
                     using (CenterServiceClient centerServiceClient = new CenterServiceClient())
                         centerServiceClient.ActivePlayer(true);
                 }
             }
             else if (isExist)
             {
                 using (CenterServiceClient centerServiceClient = new CenterServiceClient())
                     centerServiceClient.CreatePlayer(player.ID, name, password, isFirst == 0);
             }
             else
             {
                 message = LanguageMgr.GetTranslation("ManageBussiness.Forbid1", (object)now.Year, (object)now.Month, (object)now.Day, (object)now.Hour, (object)now.Minute);
                 return((PlayerInfo)null);
             }
             return(player);
         }
     }
     catch (Exception ex)
     {
         BaseInterface.log.Error((object)"LoginAndUpdate", ex);
     }
     return((PlayerInfo)null);
 }
Ejemplo n.º 4
0
        public virtual PlayerInfo CreateLogin(string name, string password, ref string message, ref int isFirst, string IP, ref bool isError, bool firstValidate, ref bool isActive, string site, string nickname)
        {
            try
            {
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    bool isExist = true;
                    DateTime forbidDate = DateTime.Now;
                    PlayerInfo info = db.LoginGame(name, ref isFirst, ref isExist, ref isError, firstValidate, ref forbidDate, nickname);
                    if (info == null)
                    {
                        if (!db.ActivePlayer(ref info, name, password, true, ActiveGold, ActiveMoney, IP, site))
                        {
                            info = null;
                            // message = "Active is fail!";
                            message = LanguageMgr.GetTranslation("BaseInterface.LoginAndUpdate.Fail");
                        }
                        else
                        {
                            isActive = true;
                            using (CenterServiceClient client = new CenterServiceClient())
                            {
                                client.ActivePlayer(true);
                            }
                        }
                    }
                    else
                    {
                        if (isExist)
                        {
                            using (CenterServiceClient client = new CenterServiceClient())
                            {
                                client.CreatePlayer(info.ID, name, password, isFirst == 0);
                            }
                        }
                        else
                        {
                            message = LanguageMgr.GetTranslation("ManageBussiness.Forbid1", forbidDate.Year, forbidDate.Month, forbidDate.Day, forbidDate.Hour, forbidDate.Minute);
                            return null;
                        }
                    }
                    return info;
                }

            }
            catch (Exception ex)
            {
                log.Error("LoginAndUpdate", ex);
            }
            return null;
        }