ALFAIRCBot.ALFAIRCBot.IngameCommand_Srd C# (CSharp) Метод

IngameCommand_Srd() приватный Метод

Search the D20 SRD.
private IngameCommand_Srd ( int PlayerId, int CharacterServerId, string Text ) : void
PlayerId int Supplies the requesting player ID.
CharacterServerId int Supplies the server ID to send the /// response information to.
Text string
Результат void
        private void IngameCommand_Srd(int PlayerId, int CharacterServerId, string Text)
        {
            Text = Text.Trim();

            try
            {
                Bing.BingSearchContainer SearchService = new Bing.BingSearchContainer(new Uri(BingAzureBaseURL));
                SearchService.Credentials = new NetworkCredential(BingApplicationKey, BingApplicationKey);
                DataServiceQuery<Bing.WebResult> ServiceQuery = SearchService.Web("site:d20srd.org " + Text, "en-US", "Moderate", null, null, null);
                Bing.WebResult Result = ServiceQuery.Execute().FirstOrDefault();

                if (Result == null)
                    SendMessageToPlayer(PlayerId, CharacterServerId, "No results.");
                else
                    SendMessageToPlayer(PlayerId, CharacterServerId, String.Format("{0}: {1} - {2}", Result.Title, Result.Url, Result.Description));

                IncrementStatistic("IRC_COMMAND_SRD");
            }
            catch (Exception)
            {
                SendMessageToPlayer(PlayerId, CharacterServerId, String.Format("Unable to retrieve search results for {0}.", Text));
            }
        }