public void StartThread() { mDBConnect = new ServerFrame.DB.DBConnect(); mDBConnect.OpenConnect(); mRunning = true; mThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadLoop)); mThread.Start(); }
public void AddSystemMailAndSend(CSCommon.Data.SystemMailData data, ServerFrame.DB.DBConnect connect) { if (this.mDBConnect.mConnection == null) { this.mDBConnect = connect; } DataTable tab = connect._ExecuteSql(data.SelectSql, "roleinfo"); if (tab != null) { foreach (DataRow i in tab.Rows) { ulong id = Convert.ToUInt64(i["RoleId"]); var role = GetRole(id); if (role != null && role.PlanesConnect != null) { SendPlayerMail(id); } } } }
public void Stop() { if (mDBConnect != null) { System.Windows.Forms.MessageBox.Show("数据服务器关闭!"); mDBConnect.CloseConnect(); mDBConnect = null; } mTcpSrv.ReceiveData -= RPC.RPCNetworkMgr.Instance.ServerReceiveData; mTcpSrv.CloseConnect -= this.ServerDisConnected; mRegisterConnect.ReceiveData -= RPC.RPCNetworkMgr.Instance.ClientReceiveData; mRegisterConnect.NewConnect -= this.OnRegisterConnected; mRegisterConnect.Close(); mTcpSrv.Close(); System.Diagnostics.Debug.WriteLine("数据服务器关闭"); mLinkState = LogServerState.None; Log.FileLog.Instance.End(); }
//加载数据库中的相关静态配置信息 public static void LoadDbConfig(ServerFrame.DB.DBConnect dbConnect) { ServerFrame.DB.DBOperator dbOp = ServerFrame.DB.DBConnect.SelectData("", new CSCommon.Data.CPlanesConfig(), ""); System.Data.DataTable tab = dbConnect._ExecuteSelect(dbOp, "planesconfig"); if (tab != null) { foreach (System.Data.DataRow r in tab.Rows) { CSCommon.Data.CPlanesConfig lPlanesConfig = new CSCommon.Data.CPlanesConfig(); if (false == ServerFrame.DB.DBConnect.FillObject(lPlanesConfig, r)) { continue; } m_PlanesConfig[lPlanesConfig.PlanesServerId] = lPlanesConfig; } } else { System.Diagnostics.Debug.WriteLine("加载位面管理地图信息失败:" + dbOp.SqlCode); } }
public void Start(ILogServerParameter parameter) { Stop(); Log.FileLog.Instance.Begin("LogServer.log", false); Log.Log.Common.Print("LogServer Start!"); Log.FileLog.Instance.Flush(); mDBConnect = new ServerFrame.DB.DBConnect(); mDBConnect.OpenConnect(); Log.Log.Common.Print("DBConnect OK!"); mParameter = parameter; mTcpSrv.ReceiveData += RPC.RPCNetworkMgr.Instance.ServerReceiveData; mTcpSrv.CloseConnect += this.ServerDisConnected; mRegisterConnect.ReceiveData += RPC.RPCNetworkMgr.Instance.ClientReceiveData; mRegisterConnect.NewConnect += this.OnRegisterConnected; mRegisterConnect.Connect(parameter.RegServerIP, parameter.RegServerPort); mLinkState = LogServerState.WaitRegServer; }