public Message CreateSearchReplyMessage(Node To, SearchResultInfo result) { Message p = new Message(network, MessageType.SearchResult); p.To = To.NodeID; p.Content = result; return p; }
public SearchResultInfoEventArgs(Node node, SearchResultInfo info) { this.node = node; this.info = info; }
public void AppendResults(Node node, SearchResultInfo resultInfo) { List<SearchResult> newResults = new List<SearchResult>(); if (resultInfo.SearchId != id) { throw new ArgumentException("Results are for a different search."); } foreach (string dir in resultInfo.Directories) { SearchResult directoryResult = new SearchResult(this, node, dir); results.Add(directoryResult); newResults.Add(directoryResult); } foreach (SharedFileListing file in resultInfo.Files) { SearchResult result = new SearchResult(this, node, file); results.Add(result); newResults.Add(result); if (!allFileResults.ContainsKey(file.InfoHash)) { allFileResults[file.InfoHash] = new List<SearchResult>(); } allFileResults[file.InfoHash].Add(result); } if (NewResults != null) { NewResults(this, newResults.ToArray()); } }
internal void SendSearchReply(Node node, SearchResultInfo reply) { this.SendRoutedMessage(this.MessageBuilder.CreateSearchReplyMessage(node, reply)); }
internal void RaiseReceivedSearchResult(Node node, SearchResultInfo result) { if (ReceivedSearchResult != null) { ReceivedSearchResult(this, new SearchResultInfoEventArgs(node, result)); } }
internal void ProcessSearchResultMessage(Node messageFrom, SearchResultInfo result) { network.RaiseReceivedSearchResult (messageFrom, result); }