AcManager.Tools.Helpers.Api.IpGeoProvider.Get C# (CSharp) Метод

Get() публичный статический Метод

public static Get ( ) : IpGeoEntry
Результат IpGeoEntry
        public static IpGeoEntry Get() {
            const string requestUri = RequestUri;
            try {
                var httpRequest = WebRequest.Create(requestUri);
                httpRequest.Method = "GET";

                ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;

                using (var response = (HttpWebResponse)httpRequest.GetResponse()) {
                    return response.StatusCode != HttpStatusCode.OK
                            ? null : JsonConvert.DeserializeObject<IpGeoEntry>(response.GetResponseStream()?.ReadAsStringAndDispose());
                }
            } catch (Exception e) {
                Logging.Warning($"Cannot determine location: {requestUri}\n{e}");
                return null;
            }
        }
    }
IpGeoProvider