Esempio n. 1
0
        /// <summary>
        /// Inspect a URI and determine the correct root and display URIs
        /// </summary>
        protected SleetUriPair GetUriPair(Uri path, bool caseSensitive)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var isRoot    = UriUtility.HasRoot(Root, path, caseSensitive);
            var isDisplay = UriUtility.HasRoot(BaseURI, path, caseSensitive);

            if (!isRoot && !isDisplay)
            {
                throw new InvalidOperationException($"URI does not match the feed root or baseURI: {path.AbsoluteUri}");
            }

            var pair = new SleetUriPair()
            {
                BaseURI = path,
                Root    = path
            };

            if (!isRoot)
            {
                pair.Root = UriUtility.ChangeRoot(BaseURI, Root, path);
            }

            if (!isDisplay)
            {
                pair.BaseURI = UriUtility.ChangeRoot(Root, BaseURI, path);
            }

            return(pair);
        }
Esempio n. 2
0
        private ISleetFile CreateAmazonS3File(SleetUriPair pair)
        {
            var key = GetRelativePath(pair.Root);

            return(new AmazonS3File(this, pair.Root, pair.BaseURI, LocalCache.GetNewTempPath(), _client, _bucketName, key, _serverSideEncryptionMethod, _compress));
        }
Esempio n. 3
0
        private ISleetFile CreateAmazonS3File(SleetUriPair pair)
        {
            var key = GetRelativePath(pair.Root);

            return(new AmazonS3File(this, pair.Root, pair.BaseURI, LocalCache.GetNewTempPath(), client, bucketName, key));
        }