Exemple #1
0
        internal static String Hint(int uniqueId, int dbIndex, String toPar)
        {
            try
            {
                var url = $"{WebApisRequest.webapisdomain}/euLinksChecker.php?hint=1&unqiueId={uniqueId}&db_index={dbIndex}";
                if (String.IsNullOrEmpty(toPar) == false)
                {
                    url = $"{url}&toPar={toPar}";
                }

                var content = GetAsString(url);

                // use anonymous template for deserializtion purpouse. the result does not fit well in 'link_wrapper_json_friendly'
                var template = new { links = new List <link_json_friendly>() };

                var jsonWrapper = JsonConvert.DeserializeAnonymousType(content, template);

                var result = jsonWrapper.links?.FirstOrDefault()?.title;

                result = WebApisHelper.SimplifyHtml(result);

                return(result);
            }
            catch (Exception e)
            {
                return(String.Empty);
            }
        }
Exemple #2
0
        internal static String Hint(String code, String @base, String toPar)
        {
            try
            {
                var url = $"{WebApisRequest.webapisdomain}/euLinksChecker.php?hint=1";
                if (@base.IgnoreCaseEquals("apev"))
                {
                    url = $"{url}&celex={code}";
                }
                else
                {
                    url = $"{url}&code={code}&base={@base}";
                }

                if (String.IsNullOrEmpty(toPar) == false)
                {
                    url = $"{url}&toPar={toPar}";
                }

                var content = GetAsString(url);

                // use anonymous template for deserializtion purpouse. the result does not fit well in 'link_wrapper_json_friendly'
                var template = new { links = new List <link_json_friendly>() };

                var jsonWrapper = JsonConvert.DeserializeAnonymousType(content, template);

                var result = jsonWrapper.links?.FirstOrDefault()?.title;

                result = WebApisHelper.SimplifyHtml(result);

                return(result);
            }
            catch (Exception e)
            {
                return(String.Empty);
            }
        }