Exemplo n.º 1
0
        public void OnTCPSearchEnded()
        {
            if ((CKernel.Preferences.GetBool("AutoExtendSearch")) &&
                (m_sources < Protocol.MaxSearchResults) &&
                (!m_IsClientSearch) && (m_Searching))
            {
                Debug.Write("Autoextending search\n");

                m_ServerIndex = 0;
                for (uint i = 0; i < CKernel.ServersList.Count; i++)
                {
                    if ((m_sources > Protocol.MaxSearchResults) || (m_SearchCanceled))
                    {
                        break;
                    }

                    ExtendSearch();
                    Thread.Sleep(250);
                    CKernel.NewSearchProgress((int)(((float)i / (float)CKernel.ServersList.Count) * 100.0F), (int)CKernel.Searchs.GetKey(CKernel.Searchs.IndexOfValue(this)));
                }
                //m_UDPPacket.Close();
                //m_UDPPacket=null;
                if (m_ServerIndex >= CKernel.ServersList.Count)
                {
                    m_ServerIndex = 0;
                }
            }
//			else
//			{
//				if ((!m_IsClientSearch)&&(m_Searching)&&(CKernel.ServersList.ActiveServer!=null))
//					CKernel.ServersList.ActiveServer.QueryMoreResults();
//
//			}
            m_Searching = false;
            if (CKernel.Searchs.IndexOfValue(this) >= 0)
            {
                CKernel.SearchEnded((int)CKernel.Searchs.GetKey(CKernel.Searchs.IndexOfValue(this)));
            }
        }