Example #1
0
        public ProxyApi(string url)
        {
            _api          = new ApiObject();
            _url          = url;
            _baseUrlProxy = $"http://{_url}:32006/proxy";
            using (var response = _api.MakeRequest(_baseUrlProxy, "POST"))
            {
                var responseStream = response.GetResponseStream();
                if (responseStream == null)
                {
                    throw new Exception("No response from proxy");
                }

                using (var responseStreamReader = new StreamReader(responseStream))
                {
                    var jsonReader = new JsonTextReader(responseStreamReader);
                    var token      = JToken.ReadFrom(jsonReader);
                    var portToken  = token.SelectToken("port");
                    if (portToken == null)
                    {
                        throw new Exception("No port number returned from proxy");
                    }

                    _port = (Int16)portToken;
                }
            }

            _proxy = _url.TrimStart('/') + ":" + _port;
        }
Example #2
0
 public JsonHelper(string language, int team, string brand, string valueToSearch)
 {
     _api           = new ApiObject();
     _apiConfig     = Base._config.ApiConfig;
     _url           = _apiConfig.GetFeedUrlOtherBrand(language, brand, team);
     _valueToSearch = valueToSearch;
 }
Example #3
0
 public JsonHelper(Leagues league, string valueToSearch)
 {
     _api           = new ApiObject();
     _apiConfig     = Base._config.ApiConfig;
     _url           = _apiConfig.GetLeagueUrl(league);
     _valueToSearch = valueToSearch;
 }
Example #4
0
 public JsonHelper(string category, string valueToSearch)
 {
     _api           = new ApiObject();
     _apiConfig     = Base._config.ApiConfig;
     _url           = _apiConfig.GetCategoryUrl(category);
     _valueToSearch = valueToSearch;
 }
Example #5
0
 public JsonHelper(int team, string valueToSearch)
 {
     _api           = new ApiObject();
     _apiConfig     = Base._config.ApiConfig;
     _url           = _apiConfig.GetFeedUrl(team);
     _valueToSearch = valueToSearch;
 }