Exemple #1
0
        public AmazonS3File(UnifiedDirectory directory, VirtualPathUnifiedProvider provider, string virtualPath, bool bypassAccessCheck, AmazonS3Object file)
            : base(directory, provider, virtualPath, bypassAccessCheck)
        {
            this._amazon = new AmazonS3Repository(((AmazonS3VirtualPathProvider)this.Provider).AwsAccessKey, ((AmazonS3VirtualPathProvider)this.Provider).AwsSecretKey, ((AmazonS3VirtualPathProvider)this.Provider).BucketName);
            this._summary = new AmazonS3Summary();
            this._virtualPath = virtualPath;

            if (file != null)
            {
                this._file = file;
            }
        }
        public override VirtualFile GetFile(string virtualPath)
        {
            if (virtualPath.StartsWith(this.VirtualPathRoot))
            {
                var amazonFile = new AmazonS3Repository(this.AwsAccessKey, this.AwsSecretKey, this.BucketName).GetFile(EPiServer.Url.Decode(virtualPath).Replace(VirtualPathRoot, string.Empty));
                var parent = new AmazonS3Directory(this, VirtualPathUtility.GetDirectory(virtualPath));

                if (amazonFile == null)
                {
                    return null;
                }

                return new AmazonS3File(parent, this, virtualPath, true, amazonFile);
            }

            if (string.IsNullOrEmpty(virtualPath))
            {
                return null;
            }

            return this.Previous.GetFile(virtualPath);
        }
 public AmazonS3Directory(VirtualPathUnifiedProvider provider, string virtualPath)
     : base(provider, virtualPath, null, true)
 {
     this._amazon = new AmazonS3Repository(((AmazonS3VirtualPathProvider)this.Provider).AwsAccessKey, ((AmazonS3VirtualPathProvider)this.Provider).AwsSecretKey, ((AmazonS3VirtualPathProvider)this.Provider).BucketName);
 }