コード例 #1
0
ファイル: RestTests.cs プロジェクト: cs-util-com/cscore
        public async Task AskStackOverflowCom1()
        {
            string answer = await StackOverflowCom.CheckError("How to sort a list", new List <string>() { "C#", "list" }, maxResults : 2);

            Log.d(answer);
            Assert.True(answer.Length > 600, "answer.Length=" + answer.Length);
        }
コード例 #2
0
ファイル: RestTests.cs プロジェクト: cs-util-com/cscore
        public async Task AskStackOverflowCom2()
        {
            string answer = await StackOverflowCom.CheckError("Sequence contains no elements", new List <string>() { "C#" }, maxResults : 2);

            Log.d(answer);
            Assert.True(answer.Length > 600, "answer.Length=" + answer.Length);
        }
コード例 #3
0
        private async Task CheckStackOverflowForError(string errorMsg)
        {
            try {
                var question = StackOverflowCom.ExtractRelevantWords(errorMsg);
                if (lastKey == question)
                {
                    return;
                }                                    // Cancel if new error is same as last one
                lastKey = question;
                if (!cache.ContainsKey(question))
                {
                    var summary = await StackOverflowCom.Ask(question, tags, maxResults : 2);

                    cache.Add(question, summary);
                    Log.w("<color=#89FF84> >> Found a possible fix for error:</color>" + summary);
                }
            }
            catch (Exception e) { Log.d("" + e); }
        }