コード例 #1
0
        public string GetMatchedCurrency(string text)
        {
            EductionResponse _eductionResponse = EduceFromTextAsync(text);

            // Line bellow is most likely cause for null exception
            return(CleanCurrency(_eductionResponse.autnresponse.responsedata.hit[0].matched_text).TrimEnd());
        }
コード例 #2
0
        public EductionResponse EduceFromTextAsync(string text)
        {
            string url      = $"http://{_settings.Hostname}:{_settings.Port}/Action=EduceFromText&Text={text}&responseFormat=simplejson";
            var    response = _httpClient.GetAsync(url).GetAwaiter().GetResult();

            response.EnsureSuccessStatusCode();
            string           jsonString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            EductionResponse retval     = JsonSerializer.Deserialize <EductionResponse>(jsonString);

            return(retval);
        }