Exemplo n.º 1
0
        public FileSystemFileReference(
            string filePath,
            string path,
            FileSystemStore store,
            bool withMetadata,
            FileExtendedProperties extendedProperties,
            IPublicUrlProvider publicUrlProvider,
            IExtendedPropertiesProvider extendedPropertiesProvider)
        {
            this.FileSystemPath             = filePath;
            this.Path                       = path.Replace('\\', '/');
            this.store                      = store;
            this.extendedPropertiesProvider = extendedPropertiesProvider;
            this.withMetadata               = withMetadata;

            this.propertiesLazy = new Lazy <IFileProperties>(() =>
            {
                if (withMetadata)
                {
                    return(new FileSystemFileProperties(this.FileSystemPath, extendedProperties));
                }

                throw new InvalidOperationException("Metadata are not loaded, please use withMetadata option");
            });

            this.publicUrlLazy = new Lazy <string>(() =>
            {
                if (publicUrlProvider != null)
                {
                    return(publicUrlProvider.GetPublicUrl(this.store.Name, this));
                }

                throw new InvalidOperationException("There is not FileSystemServer enabled.");
            });
        }
        public FileSystemStore(FileSystemStoreOptions storeOptions, IPublicUrlProvider publicUrlProvider, IExtendedPropertiesProvider extendedPropertiesProvider)
        {
            storeOptions.Validate();

            this.storeOptions = storeOptions;
            this.publicUrlProvider = publicUrlProvider;
            this.extendedPropertiesProvider = extendedPropertiesProvider;
        }
Exemplo n.º 3
0
 public FileSystemFileReference(string filePath, string path, string storeName, IPublicUrlProvider publicUrlProvider)
 {
     this.storeName         = storeName;
     this.publicUrlProvider = publicUrlProvider;
     this.filePath          = filePath;
     this.path     = path.Replace('\\', '/');
     this.fileInfo = new FileInfo(this.FileSystemPath);
 }
Exemplo n.º 4
0
        public FileSystemStore(string storeName, string path, string rootPath, IPublicUrlProvider publicUrlProvider)
        {
            this.publicUrlProvider = publicUrlProvider;
            this.Name = storeName;

            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            if (Path.IsPathRooted(path))
            {
                this.absolutePath = path;
            }
            else
            {
                this.absolutePath = Path.Combine(rootPath, path);
            }
        }
 public FileSystemStorageProvider(IOptions <FileSystemParsedOptions> options, IPublicUrlProvider publicUrlProvider = null, IExtendedPropertiesProvider extendedPropertiesProvider = null)
     : base(options)
 {
     this.publicUrlProvider          = publicUrlProvider;
     this.extendedPropertiesProvider = extendedPropertiesProvider;
 }