Beispiel #1
0
        private string GetPathRelativeToBucket(Uri uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            string baseUri = BaseURI.ToString();
            string path    = uri.AbsoluteUri;

            if (!path.StartsWith(baseUri, StringComparison.Ordinal))
            {
                throw new InvalidOperationException($"Unable to make '{uri.AbsoluteUri}' relative to '{baseUri}'");
            }

            string key = path.Replace(baseUri, string.Empty);

            if (!string.IsNullOrEmpty(FeedSubPath))
            {
                key = FeedSubPath[FeedSubPath.Length - 1] == '/'
                    ? FeedSubPath + key
                    : FeedSubPath + "/" + key;
            }

            return(key);
        }
Beispiel #2
0
        public void Configure(Settings settings)
        {
            Protocol   protocol = settings.protocol != null ? settings.protocol.Value : Protocol.HTTP;
            UriBuilder builder  = new UriBuilder(protocol.ToString().ToLower(), settings.hostName);

            if (settings.port != null)
            {
                builder.Port = settings.port.Value;
            }
            BaseURI = builder.Uri;
            Log("Configured", settings.ToString() + " - " + BaseURI.ToString());
        }