Example #1
0
        internal InterceptChannel(string source, JObject interceptBlob, IShimCache cache)
        {
            _resolverBaseAddress = interceptBlob["resolverBaseAddress"].ToString().TrimEnd('/');
            _searchAddress = interceptBlob["searchAddress"].ToString().TrimEnd('/');
            _passThroughAddress = interceptBlob["passThroughAddress"].ToString().TrimEnd('/');
            _listAvailableLatestStableIndex = interceptBlob["isLatestStable"].ToString();
            _listAvailableAllIndex = interceptBlob["allVersions"].ToString();
            _listAvailableLatestPrereleaseIndex = interceptBlob["isLatest"].ToString();

            if (interceptBlob["metricAddress"] != null)
            {
                _metricService = new MetricService(new Uri(interceptBlob["metricAddress"].ToString()));
            }
            else
            {
                // TODO: Remove this once it has been added to intercept.json
                _metricService = new MetricService(new Uri("http://api-metrics.nuget.org"));
            }

            _source = source.TrimEnd('/');
            _cache = cache;
        }
        internal InterceptChannel(string source, JObject interceptBlob, IShimCache cache)
        {
            _resolverBaseAddress                = interceptBlob["resolverBaseAddress"].ToString().TrimEnd('/');
            _searchAddress                      = interceptBlob["searchAddress"].ToString().TrimEnd('/');
            _passThroughAddress                 = interceptBlob["passThroughAddress"].ToString().TrimEnd('/');
            _listAvailableLatestStableIndex     = interceptBlob["isLatestStable"].ToString();
            _listAvailableAllIndex              = interceptBlob["allVersions"].ToString();
            _listAvailableLatestPrereleaseIndex = interceptBlob["isLatest"].ToString();

            if (interceptBlob["metricAddress"] != null)
            {
                _metricService = new MetricService(new Uri(interceptBlob["metricAddress"].ToString()));
            }
            else
            {
                // TODO: Remove this once it has been added to intercept.json
                _metricService = new MetricService(new Uri("http://api-metrics.nuget.org"));
            }

            _source = source.TrimEnd('/');
            _cache  = cache;
        }