示例#1
0
 public bool Remove(SharedFile sharedFile)
 {
     try
     {
         Lock();
         m_ThriceHashedFileHash.Remove(sharedFile.ThriceHashedFileHashString);
         m_TwiceHashedFileHash.Remove(sharedFile.TwiceHashedFileHashString);
         m_OnceHashedFileHash.Remove(sharedFile.OnceHashedFileHashString);
         return(m_FileHash.Remove(sharedFile.FileHashString));
     }
     finally
     {
         Unlock();
     }
 }
 public bool Remove(Download download)
 {
     try
     {
         Lock();
         m_ThriceHashedFileHash.Remove(download.ThriceHashedFileHashString);
         m_TwiceHashedFileHash.Remove(download.TwiceHashedFileHashString);
         m_OnceHashedFileHash.Remove(download.OnceHashedFileHashString);
         m_FileHash.Remove(download.FileHashString);
         return(m_DownloadID.Remove(download.DownloadIDString));
     }
     finally
     {
         Unlock();
     }
 }
示例#3
0
        public RIndexedHashtable <string, OldSearchResult> GetResults(string searchID)
        {
            RIndexedHashtable <string, OldSearchResult> results = null;

            if (m_SearchDBThread.IsAlive)
            {
                try
                {
                    m_SearchResults.Lock();

                    if (m_SearchResults.ContainsKey(searchID))
                    {
                        results = m_SearchResults[searchID];
                        m_SearchResults.Remove(searchID);
                    }
                }
                catch (Exception ex)
                {
                    m_Logger.Log(ex, "SearchDBManager: An error was thrown while returning the results of a search.", new object[] { });
                }
                finally
                {
                    m_SearchResults.Unlock();
                }
            }
            else
            {
                results = new RIndexedHashtable <string, OldSearchResult>();
            }

            return(results);
        }