/// <summary> /// Register a service /// </summary> /// <param name="svsId">A service id</param> /// <param name="ta">Thread apartment for windows default to tagThreadApartment.taNone. It is ignored on non-windows platforms</param> /// <returns>True if successful. Otherwise false if failed</returns> public virtual bool AddMe(uint svsId, tagThreadApartment ta) { m_sc.m_OnBaseRequestCame = new DOnBaseRequestCame(OnBaseCame); m_sc.m_OnChatRequestCame = new DOnChatRequestCame(OnChatCame); m_sc.m_OnChatRequestComing = new DOnChatRequestComing(OnChatComing); m_sc.m_OnClose = new DOnClose(OnClose); m_sc.m_OnFastRequestArrive = new DOnFastRequestArrive(OnFast); m_sc.m_OnHttpAuthentication = new DOnHttpAuthentication(OnHttpAuthentication); m_sc.m_OnRequestArrive = new DOnRequestArrive(OnReqArrive); m_sc.m_OnRequestProcessed = new DOnRequestProcessed(OnSRProcessed); m_sc.m_OnSwitchTo = new DOnSwitchTo(OnSwitch); m_sc.m_SlowProcess = new DSLOW_PROCESS(OnSlow); m_sc.m_OnResultsSent = new DOnResultsSent(OnResultsSent); m_sc.m_ta = ta; if (svsId > 0 && ServerCoreLoader.AddSvsContext(svsId, m_sc)) { m_svsId = svsId; lock (m_csService) { if (!m_bRegEvent) { ServerCoreLoader.SetThreadEvent(CSocketProServer.te); m_bRegEvent = true; } m_lstService.Add(this); } return(true); } return(false); }