public void doorNeedProof(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
                try
                {
                        String saction = ServerAction.hasProof;

                        //回复
                        session.Write(
                            XmlInstruction.DBfengBao(saction, "<proof>" + getGameLogicServer().RCConnector.getProof() + "</proof>")
                            );

                        //
                        Log.WriteStrBySend(saction, session.getRemoteEndPoint().ToString());
                }
                catch (Exception exd)
                {
                        Log.WriteStrByException(CLASS_NAME(), "doorNeedProof", exd.Message,exd.StackTrace);
                }

        }
Example #2
0
        public override void doorLogOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
            try
            {
                    XmlNode node = doc.SelectSingleNode("/msg/body");

                    String userStrIpPort = node.ChildNodes[0].InnerText;
                    String usersex     = node.ChildNodes[1].InnerText;
                    String username = node.ChildNodes[2].InnerText;
                    String userpwd = node.ChildNodes[3].InnerText;
                    String useremail   = node.ChildNodes[4].InnerText;
                    String bbs = node.ChildNodes[5].InnerText;
                    String hico = node.ChildNodes[6].InnerText;
                    String sid = node.ChildNodes[7].InnerText;
                    int id_sql = Integer.valueOf(node.ChildNodes[8].InnerText);

                    String id = node.ChildNodes[9].InnerText;
                    String status = node.ChildNodes[10].InnerText;


                    //
                    String saction = ServerAction.logOK;
                    StringBuilder contentXml = new StringBuilder();

                    //回复
                    //注意这里的session是上面的usersession,要判断是否还在线
                    AppSession userSession = DdzLogic.getInstance().CLIENTAcceptor.getSession(userStrIpPort);

                    //判断重复登录,如果这里发生异常,可能就需要多登录几次才能挤掉对方,并成功登录
                    AppSession outSession = DdzLogic.getInstance().CLIENTAcceptor.getSessionByAccountName(username);

                    if (null != outSession)
                    {
                            //发一个通知,您与服务器的连接断开,原因:您的帐号在另一处登录
                            //然后触发ClearSession
                            String logoutAction = ServerAction.logout;
                            String logoutCode = "1";
                            StringBuilder logoutXml = new StringBuilder();

                            logoutXml.Append("<session>").Append(userSession.getRemoteEndPoint().ToString()).Append("</session>");
                            logoutXml.Append("<session>").Append(outSession.getRemoteEndPoint().ToString()).Append("</session>");
                            logoutXml.Append("<code>").Append(logoutCode).Append("</code>");
                            logoutXml.Append("<u></u>");

                            DdzLogic.getInstance().Send(outSession, XmlInstruction.fengBao(logoutAction, logoutXml.ToString()));

                            //
                            Log.WriteStrBySend(logoutAction, outSession.getRemoteEndPoint().ToString());

                            //
                            DdzLogic.getInstance().CLIENTAcceptor.trigClearSession(outSession, outSession.getRemoteEndPoint().ToString());
                    }

                    //如果不在线则略过发送
                    if (null != userSession)
                    {
                            //超过在线人数
                                    if (DdzLogic.getInstance().CLIENTAcceptor.getUserCount() >= DdzLogic.getInstance().CLIENTAcceptor.getMaxOnlineUserConfig())
                                    {
                                            //调整saction
                                            saction = ServerAction.logKO;
                                            //调整status
                                            status = "12"; //来自MembershipLoginStatus2.PeopleFull12

                                            contentXml.Append("<session>").Append(userStrIpPort).Append("</session>");
                                            contentXml.Append("<status>").Append(status).Append("</status>");
                                            contentXml.Append("<u></u>");

                                            DdzLogic.getInstance().Send(userSession, XmlInstruction.fengBao(saction, contentXml.ToString()));

                                            //
                                            Log.WriteStrBySend(saction, userStrIpPort);
                                    }
                                    else
                                    {
                                            IUserModel user = UserModelFactory.Create(userStrIpPort, id, id_sql, usersex, username, username, bbs, hico);

                                            //加入在线用户列表
                                            //CLIENTAcceptor.addUser(userSession.getRemoteEndPoint().ToString(), user);
                                            DdzLogic.getInstance().CLIENTAcceptor.addUser(userStrIpPort, user);

                                            contentXml.Append("<session>").Append(userStrIpPort).Append("</session>");
                                            contentXml.Append("<status>").Append(status).Append("</status>");
                                            contentXml.Append(user.toXMLString());

                                            DdzLogic.getInstance().Send(userSession, XmlInstruction.fengBao(saction, contentXml.ToString()));

                                            //
                                            Log.WriteStrBySend(saction, userStrIpPort);

                                            //
                                            Log.WriteFileByLoginSuccess(username, userStrIpPort);
                                            Log.WriteFileByOnlineUserCount(DdzLogic.getInstance().CLIENTAcceptor.getUserCount());

                                    } //end if

                    } //end if



            }
            catch (Exception exd)
            {
                    Log.WriteStrByException(CLASS_NAME(), "doorLogOK", exd.Message,exd.StackTrace);
            }
    }    
Example #3
0
        static void Main(string[] args)
        {
            try
            {
                //设置控制台的显示样式
                Console.ForegroundColor = ConsoleColor.Green;
                //Console.ResetColor();
                //Console.Clear();

                //copy right
                Console.WriteLine("wdmir.com   2003-2015");
                Console.WriteLine("www.silverFoxServer.net 2009-2015");

                //语言
                //mono不支持Culture 
                //"zh-CN";
                GameGlobals.lang = System.Globalization.CultureInfo.InstalledUICulture.Name;

                //test
                //GameGlobals.lang = "zh-HK";

                SR.init(GameGlobals.lang);
                
                //3.1版本 - 澳门风云
                Console.Title = SR.GetString(SR.Win_Title, SR.Ddz_displayName, "3.2", "2015/8/28");//"2014/2/10");

                if (args.Length > 0 && args[0] == "nowin")
                {
                    IntPtr ParenthWnd = new IntPtr(0);
                    IntPtr et = new IntPtr(0);
                    ParenthWnd = FindWindow(null, Console.Title);

                    ShowWindow(ParenthWnd, 0);//隐藏本dos窗体, 0: 后台执行;1:正常启动;2:最小化到任务栏;3:最大化

                }                        

                //
                GameGlobals.GAME_NAME = GAME_NAME;
               
                //Console.WriteLine("[Boot] " + Globals.svrName + " Server");

                Console.WriteLine(

                    SR.GetString(SR.BootSvr, SR.Ddz_displayName)
                    
                    );

                //读取xml配置
                XmlDocument configDoc = new XmlDocument();

                //获取和设置当前目录(即该进程从中启动的目录)的完全限定路径。
                //string str = System.Environment.CurrentDirectory;
                //该程序如果由另一程序启动,则会有问题,获得的是另一程序的启动路径

                //
                string appFileName = System.AppDomain.CurrentDomain.FriendlyName.ToLower();
                //Console.WriteLine(appName);

                string configFileName = string.Empty;

                configFileName = "DdzServerConfig.xml";

                //if (appFileName.IndexOf(".vshost.exe") >= 0)
                //{
                //    configFileName = "DdzServerConfig.xml";

                //}
                //else if (appFileName == "ddzserver.exe")
                //{
                //    configFileName = "DdzServerConfig.xml";

                //}
                //else if (appFileName == "ddzserver2.exe")
                //{
                //    configFileName = "DdzServerConfig2.xml";

                //}
                //else if (appFileName == "ddzserver3.exe")
                //{
                //    configFileName = "DdzServerConfig3.xml";

                //}

                //
                //Console.WriteLine("[Load File] " + System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + configFileName);

                Console.WriteLine(

                    SR.GetString(SR.LoadFile,
                    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + configFileName)
                    
                 );


                configDoc.Load(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + configFileName);
                                

                //IP信息
                XmlNode node = configDoc.SelectSingleNode("/www.wdmir.net/group/main-server");

                if (null == node)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(SR.GetString(SR.Can_not_find_node,"/www.wdmir.net/group/main-server"));
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                string ipAdr = node.ChildNodes[0].InnerText;

                int port = int.Parse(node.ChildNodes[1].InnerText);

                //房间信息
                XmlNode tabNode = configDoc.SelectSingleNode("/www.wdmir.net/group/main-server/tabList");

                 //
                int tabNum = tabNode.ChildNodes.Count;
                List<ITabModel> tabList = new List<ITabModel>();


                int k = 0;
                //房间名字
                int j = 0;

                //ChildNodes
                int index = 0;

                for (k = 0;k < tabNum;k++)
                {

                        TabModelByDdz Tab = (TabModelByDdz)TabModelFactory.Create(k);

                        //房间数量负数没有意义
                        XmlNode e = tabNode.ChildNodes[index];                        
                                           
                        Tab.setTabName(e.Attributes["n"].Value);

                        int size = e.ChildNodes.Count;//e.getChildren().size();

                        Tab.setRoomCount(size);

                        //房间底分

                        Tab.setRoomG(Convert.ToInt32(e.Attributes["g"].Value));

                        //最少携带不需要警告
                        Tab.setRoomCarryG(Convert.ToInt32(e.Attributes["carryG"].Value));

                        //每局花费
                        Tab.setRoomCostG(float.Parse(e.Attributes["costG"].Value));

                        //自动匹配模式开启
                        Tab.setTabAutoMatchMode(Convert.ToInt32(e.Attributes["autoMatchMode"].Value));

                        //快速场模式开启
                        Tab.setQuickMode(Convert.ToInt32(e.Attributes["quickMode"].Value));

                        //自动匹配根据Logic设计规则,至少需要2个房间,
                        //否则只有1个房间,换房间时会进入无限等待
                        if (1 == Tab.getTabAutoMatchMode() && 1 == Tab.getRoomCount())
                        {
                                Console.WriteLine(SR.GetString(SR.getRoom_auto_match_mode_and_room_num_less_2(), "Tab " + index.ToString()));
                        }

                        int roomCount = Tab.getRoomCount();
                        for (j = 0; j < roomCount; j++)
                        {
                            Tab.getRoomName()[j] = e.ChildNodes[j].Attributes["n"].Value;
                                                    
                                //e.getChildren().get(j).getAttributeValue("n");

                        }

                        //check
                        //
                        if (0 >= Tab.getRoomCount())
                        {
                                Console.WriteLine(SR.GetString(SR.getRoom_num_zero(), "Tab " + index.ToString()));
                        }

                        if (1 <= Tab.getRoomCostG())
                        {
                            Console.WriteLine(SR.GetString(SR.getRoom_costG_more_than_1(), "Tab " + index.ToString()));
                                Tab.setRoomCostG(0.0f);
                        }

                        //
                        tabList.Add(Tab);

                        index++;

                }





                
                //安全域
                string allowAccessFromDomain = node.ChildNodes[4].InnerText;

                if ("" == allowAccessFromDomain)
                {
                    allowAccessFromDomain = "*";
                }

                //是否允许负分
                string allowPlayerGlessThanZeroOnGameOverStr = node.ChildNodes[5].InnerText;

                bool allowPlayerGlessThanZeroOnGameOver = false;

                if ("no" == allowPlayerGlessThanZeroOnGameOverStr.ToLower())
                {
                    allowPlayerGlessThanZeroOnGameOver = false;
                    //Console.WriteLine("提示:游戏扣分时会出现负分已关闭");

                    Console.WriteLine(SR.GetString(SR.Allow_playerG_less_than_zero_on_game_over));

                }
                else
                {
                    allowPlayerGlessThanZeroOnGameOver = true;
                }

                //打印级别
                int logLevel = int.Parse(node.ChildNodes[6].InnerText);

                if (0 == logLevel)
                {
                    GameGlobals.logLvl = LoggerLvl.CLOSE0;

                }
                else if (1 == logLevel)
                {
                    GameGlobals.logLvl = LoggerLvl.NORMAL1;

                }
                else
                {
                    logLevel = 2;
                    GameGlobals.logLvl = LoggerLvl.ALL2;
                }

                //
                Log.init(GameGlobals.GAME_NAME, GameGlobals.logLvl);
                
                //cost扣下来的钱存入指定帐号
                string costUser = node.ChildNodes[7].InnerText;

                if ("" == costUser)
                {
                    
                        costUser = "******";
                        //Console.WriteLine("提示:未指定每局花费的存入帐号,默认设为admin");
                        Console.WriteLine(
                            SR.GetString(SR.Cost_default_set_to_admin)
                        );
                    
                }

                //
                string payUser = GameGlobals.payUser = node.ChildNodes[8].InnerText;
                 
                //
                int runAwayMultiG = Convert.ToInt32(node.ChildNodes[9].InnerText);

                int reconnectionTime = Convert.ToInt32(node.ChildNodes[10].InnerText);

                //15秒是快牌场的的出牌时间
                if (reconnectionTime < 30)
                {                    
                    Console.WriteLine(SR.Room_reconnection_time_less_than_15);
                    reconnectionTime = 30;
                }

                int everyDayLogin = Convert.ToInt32(node.ChildNodes[11].InnerText);

                //其它模块
                XmlNode omNode = configDoc.SelectSingleNode("/www.wdmir.net/group/main-server/other-modules/turn-over-a-card");

                if (null == omNode)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(SR.GetString(SR.Can_not_find_node, "/www.wdmir.net/group/main-server/other-modules/turn-over-a-card"));
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                int turnOver_a_Card_module_run = Convert.ToInt32(omNode.Attributes["run"].Value);

                Int64 turnOver_a_Card_module_g1 = Convert.ToInt64(omNode.Attributes["g1"].Value);
                Int64 turnOver_a_Card_module_g2 = Convert.ToInt64(omNode.Attributes["g2"].Value);
                Int64 turnOver_a_Card_module_g3 = Convert.ToInt64(omNode.Attributes["g3"].Value);

                float turnOver_a_Card_costG = float.Parse(omNode.Attributes["costG"].Value);

                if (0 == turnOver_a_Card_module_run)
                {
                    
                    //关闭
                
                }else
                {

                    Console.WriteLine(

                    SR.GetString(SR.LoadModulesAndStart,
                    SR.TurnOver_a_Card_module_displayName
                    )

                    );
                }

                //
                if (0 >= turnOver_a_Card_module_g1)
                {
                    Console.WriteLine(SR.GetString(SR.TurnOver_a_Card_module_g_zero, "g1"));
                }

                if (0 >= turnOver_a_Card_module_g2)
                {
                    Console.WriteLine(SR.GetString(SR.TurnOver_a_Card_module_g_zero, "g2"));
                }

                if (0 >= turnOver_a_Card_module_g3)
                {
                    Console.WriteLine(SR.GetString(SR.TurnOver_a_Card_module_g_zero, "g3"));
                }

                //
                XmlNode rcNode = configDoc.SelectSingleNode("/www.wdmir.net/group/main-server/record-server");

                if (null == rcNode)
                {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(SR.GetString(SR.getCan_not_find_node(),"/www.wdmir.net/group/main-server/record-server"));
                        Console.ForegroundColor = ConsoleColor.Green;
                }

                String connect_ipAdr2 = rcNode.ChildNodes[0].InnerText;
                int connect_port2 = Convert.ToInt32(rcNode.ChildNodes[1].InnerText);
                String proof = rcNode.ChildNodes[2].InnerText;

                //Console.WriteLine("[Load File] OK");

                Console.WriteLine(SR.GetString(SR.getLoadFileSuccess()));

                //读取聊天过滤字符配置
                XmlDocument filterWordDoc = new XmlDocument();

                //Console.WriteLine("[Load File] " + System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "FilterWordConfig.xml");

                Console.WriteLine(

                    SR.GetString(SR.LoadFile,
                    System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "FilterWordConfig.xml")

                 );


                filterWordDoc.Load(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "FilterWordConfig.xml");

                XmlNode filterLvl = filterWordDoc.SelectSingleNode("/www.wdmir.net/pubmsg-filter-level");

                if (null == filterLvl)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(SR.GetString(SR.getCan_not_find_node(), "/www.wdmir.net/pubmsg-filter-level"));
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                XmlNode filterNode = filterWordDoc.SelectSingleNode("/www.wdmir.net/pubmsg-filter-word");

                if (null == filterNode)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(SR.GetString(SR.getCan_not_find_node(), "/www.wdmir.net/pubmsg-filter-word"));
                    Console.ForegroundColor = ConsoleColor.Green;
                }

                XmlNode filterMakeupNode = filterWordDoc.SelectSingleNode("/www.wdmir.net/pubmsg-filter-makeup-word");

                if (null == filterNode)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(SR.GetString(SR.getCan_not_find_node(), "/www.wdmir.net/pubmsg-filter-makeup-word"));
                    Console.ForegroundColor = ConsoleColor.Green;
                }


                FilterWordManager.init(
                    filterLvl.ChildNodes[0].InnerText,
                    filterNode.ChildNodes[0].InnerText,
                    filterMakeupNode.ChildNodes[0].InnerText);


                Console.WriteLine(
                    SR.GetString(SR.LoadFileSuccess)
                );

                //处理类初始化
                //处理类初始化
                DdzLogic.getInstance().init(tabNode, tabList, costUser, allowPlayerGlessThanZeroOnGameOver, runAwayMultiG, reconnectionTime, everyDayLogin);
                //模块初始化
                DdzLogic.getInstance().init_modules(costUser, turnOver_a_Card_module_run, turnOver_a_Card_module_g1, turnOver_a_Card_module_g2, turnOver_a_Card_module_g3, turnOver_a_Card_costG);

                DdzRCLogic.getInstance().init(DdzLogic.getInstance());

                //
                DdzLPU.init();

                //如果是连接DB的Connector,可能需要设置证书
                SocketConnector connector = new SocketConnector(proof);

                connector.setHandler(new DdzRCClientHandler());

                //与数据库的连接bufSize要大点
                //默认的1024 * 8
                connector.getSessionConfig().setReadBufferSize(1024 * 4);

                
                //使用了reuse,现半小时调为0
                connector.getSessionConfig().setReceiveTimeout(0);
                         

                //
                SocketAcceptor acceptor = new SocketAcceptor(payUser, GAME_NAME, allowAccessFromDomain, true);

                acceptor.setHandler(new DdzGameClientHandler());

               
                //处理类引用connector
                //只可调用connector的send方法
                DdzLogic.getInstance().setRCConnector(connector);
                DdzLogic.getInstance().setClientAcceptor(acceptor);

                //首先启动对内网的数据库服务的连接
                connector.connect("127.0.0.1", 9500);

                //最后启动外网侦听
                acceptor.bind("Any", port,false);

                //对于post builder,这里要加ReadLine
                string line;
                while ((line = Console.ReadLine()) != SR.Shutdown)
                {
                    if (null == line)
                    {
                        //break;
                    }
                    else if (line == "shutdown")
                    {
                        break;

                    }
                    else if (line == "clear")
                    {
                        Console.Clear();

                    }
                    else if (line == "port")
                    {
                        Console.WriteLine(port);

                    }
                    else
                    {
                        Console.WriteLine("unknow command");
                    }

                    //Console.WriteLine("run command:" + line);
                }

                //Console.ReadLine();

               
            }
            catch (Exception exd)
            {
                Console.ForegroundColor = ConsoleColor.Red;

                Console.WriteLine(SR.GetString(SR.Game_svr_start_failed, exd.Message));
                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine(SR.GetString(SR.Game_svr_failed_help));

                Console.WriteLine("email:[email protected]");
               
                Console.ReadLine();
            }
            
        }
        public void doorHasRegOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
        
               try
               {

                        XmlNode node = doc.SelectSingleNode("/msg/body");

                        String userStrIpPort = node.ChildNodes[0].InnerText;//InnerText;
                    
                        AppSession userSession = getGameLogicServer().CLIENTAcceptor.getSession(userStrIpPort);
                    
                        //
                        String saction = ServerAction.hasRegOK;
                    
                        String contentXml = "";                        

                        //如果不在线则略过发送
                        getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, contentXml));

                        //
                        Log.WriteStrBySend(saction, userSession.getRemoteEndPoint().ToString());
            
                }
               catch (Exception exd)
                {
                        Log.WriteStrByException(CLASS_NAME(), "doorHasRegOK", exd.Message, exd.StackTrace);
                }
    
        }
        public void doorProofKO(SocketConnector session, XmlDocument doc, SessionMessage item)
        {

            Log.WriteStr(SR.GetString(SR.getcert_vali_ko(), session.getRemoteEndPoint().ToString()));

        }
        /**
         * 
         * 
         * @param session
         * @param doc
         * @param item 
         */
        public void doorLoadTopListOK(SocketConnector session, XmlDocument doc, SessionMessage item) 
        {
            try
            {

                 //<session>127.0.0.1:64828</session><chart total_add="0" total_sub="0"></chart>
                 XmlNode node = doc.SelectSingleNode("/msg/body");

                 String userStrIpPort = node.ChildNodes[0].InnerText;//InnerText;


                 String topListXml = node.ChildNodes[1].OuterXml;//(new XMLOutputter()).outputString(node.ChildNodes()[1]);

                 //
                 String saction = ServerAction.topList;

                 //回复
                 //注意这里的session是上面的usersession,要判断是否还在线
                 
                 AppSession userSession = this.getGameLogicServer().CLIENTAcceptor.getSession(userStrIpPort);

                 //
                 this.getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, topListXml));

             }
            catch (Exception exd)
             {
                     Log.WriteStrByException(CLASS_NAME(), "doorLoadTopListOK", exd.Message,exd.StackTrace);
             }
        }
        public void doorLoadGOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
                try
                {
                        XmlNode node = doc.SelectSingleNode("/msg/body");

                        String userStrIpPort = node.ChildNodes[0].InnerText;//InnerText;

                        String g = node.ChildNodes[1].InnerText;//InnerText;

                        String id_sql = node.ChildNodes[1].Attributes["id_sql"].Value;
                        //
                        String saction = ServerAction.gOK;

                        //回复
                        //注意这里的session是上面的usersession,要判断是否还在线
                        AppSession userSession = getGameLogicServer().netGetSession(userStrIpPort);

                        //如果不在线则略过发送
                        if (null != userSession)
                        {
                            IUserModel u = getGameLogicServer().CLIENTAcceptor.getUser(userStrIpPort);

                            //以免引发不必要的异常,方便测试
                            if (!(g == ""))
                            {
                                 u.setG(parseInt(g));
                            }
										
                            getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, 
                                    "<g " + "id_sql='" + id_sql + "'" + ">" + g + "</g>"));

                            //
                            Log.WriteStrBySend(saction, userSession.getRemoteEndPoint().ToString());


                        }
                        else
                        {
                                Log.WriteStrBySendFailed(saction, userSession.getRemoteEndPoint().ToString());
                        } //end if

                }
                catch (Exception exd)
                {
                        Log.WriteStrByException(CLASS_NAME(), "doorLoadGOK", exd.Message);
                }
        }
        /**
         * 每日登陆(至少玩一把)
         * 
         * @param session
         * @param doc
         * @param item 
         */
        public void doorChkEveryDayLoginAndGetOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
            try
            {

                    XmlNode gameNode = doc.SelectSingleNode("/msg/body/game");

                    //具体奖励数额
                    String gv = gameNode.Attributes["v"].Value;

                    //
                    XmlNode node = doc.SelectSingleNode("/msg/body/game");

                    int len = node.ChildNodes.Count;

                    for (int i = 0; i < len; i++)
                    {
                            String edlValue = node.ChildNodes[i].Attributes["edl"].Value;

                            String id = node.ChildNodes[i].Attributes["id"].Value;
                        
                            IUserModel u = getGameLogicServer().CLIENTAcceptor.getUserById(id);
                        
                            if(u == null)
                            {
                                continue;
                            }
                        
                            String userStrIpPort = u.getstrIpPort();//node.ChildNodes()[i].getAttributeValue("session");

                            String saction = "";

                            saction = ServerAction.everyDayLoginVarsUpdate;

                            //

                            //回复
                            //注意这里的session是上面的usersession,要判断是否还在线
                            if (getGameLogicServer().CLIENTAcceptor.hasSession(userStrIpPort))
                            {
                                    AppSession userSession = getGameLogicServer().CLIENTAcceptor.getSession(userStrIpPort);

                                    getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, "<edl v='" + gv + "'>" + edlValue + "</edl>"));

                                    //
                                    Log.WriteStrBySend(saction, userStrIpPort);
                            }

                    } //end for

            }
            catch (Exception exd)
            {
                    Log.WriteStrByException(CLASS_NAME(), "doorChkEveryDayLoginAndGetOK",exd.Message);
            }

        }
        /**
         * 
         * 
         * 
         * @param session
         * @param doc
         * @param item 
         */
        public void doorLoadDBTypeOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
            //<msg t='DBS'><body action='loadDBTypeOK'>
            //<session>127.0.0.1:57107</session>
            //<DBTypeModel><mode>dz</mode><ver>X2.0</ver><sql>MySql</sql></DBTypeModel></body></msg>

            try{
            
                //trace(doc.ToString());
        
                getGameLogicServer().selectDB = DBTypeModel.fromXML(doc);
            
            
                XmlNode c = doc.SelectSingleNode("/msg/body/session");
            
                String userIpPort = c.InnerText;
            
                AppSession userSession = getGameLogicServer().netGetSession(userIpPort);
            
                String sAction = ServerAction.loadDBTypeOK;
            
                if(null != userSession){
                
                    getGameLogicServer().Send(userSession,XmlInstruction.fengBao(sAction, 
                        getGameLogicServer().selectDB.toXMLString(true)));
                
                     Log.WriteStrBySend(sAction, userSession.getRemoteEndPoint().ToString());
                }
            }
            catch (Exception exd)
            {
                    Log.WriteStrByException(CLASS_NAME(), "doorLoadDBTypeOK", exd.Message);
            }
        }
        public void doorLogKO(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
            try
            {
                    XmlNode node = doc.SelectSingleNode("/msg/body");

                    String userStrIpPort = node.ChildNodes[0].InnerText;

                    String loginStatus = node.ChildNodes[10].InnerText;

                    //String param = node.ChildNodes()[2].InnerText;

                    //
                    String saction = ServerAction.logKO;

                    //回复
                    //注意这里的session是上面的usersession,要判断是否还在线
                    AppSession userSession = getGameLogicServer().CLIENTAcceptor.getSession(userStrIpPort);

                    //如果不在线则略过发送
                    if (null != userSession)
                    {
                            getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, "<sta>" + loginStatus + "</sta>"));

                            //
                            Log.WriteStrBySend(saction, userSession.getRemoteEndPoint().ToString());


                    }
                    else
                    {
                            Log.WriteStrBySendFailed(saction, userSession.getRemoteEndPoint().ToString());
                    } //end if
            }
            catch (Exception exd)
            {
                    Log.WriteStrByException(CLASS_NAME(), "doorLogKO", exd.Message);
            }
        }
 public virtual void doorLogOK(SocketConnector session, XmlDocument doc, SessionMessage item)
 {
     //need override
 }
        public void doorRegOK(SocketConnector session, XmlDocument doc, SessionMessage item)
        {
                try
                {

                        XmlNode node = doc.SelectSingleNode("/msg/body");

                        String userStrIpPort = node.ChildNodes[0].InnerText;//InnerText;

                        String usersex = node.ChildNodes[1].InnerText;
                        String username = node.ChildNodes[2].InnerText;
                        String userpwd = node.ChildNodes[3].InnerText;
                        String useremail = node.ChildNodes[4].InnerText; //这里的mail是email

                        String bbs = node.ChildNodes[5].InnerText;
                        String sid = node.ChildNodes[6].InnerText;
                        int id_sql = parseInt(node.ChildNodes[7].InnerText);

                        //
                        String saction = ServerAction.regOK;

                        //回复
                        //注意这里的session是上面的usersession,要判断是否还在线                    
                        AppSession userSession = getGameLogicServer().CLIENTAcceptor.getSession(userStrIpPort);
                    
                        String contentXml = "<session>" + userStrIpPort + "</session><sex>" + 
                                    usersex + "</sex><nick><![CDATA[" + 
                                    username + "]]></nick><pwd><![CDATA[" + 
                                    userpwd + "]]></pwd><bbs><![CDATA[" + 
                                    bbs + "]]></bbs>" + 
                                    //"<hico><![CDATA[" + hico + "]]></hico>" + 
                                    //"<sid><![CDATA[" + sid + "]]></sid>" + 
                                    "<id_sql>" +
                                    id_sql.ToString() + "</id_sql>" + 
                                    "<mail>" + 
                                    useremail +"</mail>";
                        

                        //如果不在线则略过发送
                        getGameLogicServer().Send(userSession, XmlInstruction.fengBao(saction, contentXml));

                        //
                        Log.WriteStrBySend(saction, userSession.getRemoteEndPoint().ToString());

                }
                catch (Exception exd)
                {
                        Log.WriteStrByException(CLASS_NAME(), "doorRegOK", exd.Message);
                }
        }
 public void setRCConnector(SocketConnector connector)
 {
     RCConnector = connector;
 }