Ejemplo 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.");
            });
        }
Ejemplo n.º 2
0
        public FileSystemStore(FileSystemStoreOptions storeOptions, IPublicUrlProvider publicUrlProvider, IExtendedPropertiesProvider extendedPropertiesProvider)
        {
            storeOptions.Validate();

            this.storeOptions = storeOptions;
            this.publicUrlProvider = publicUrlProvider;
            this.extendedPropertiesProvider = extendedPropertiesProvider;
        }
 public FileSystemStorageProvider(IOptions <FileSystemParsedOptions> options, IPublicUrlProvider publicUrlProvider = null, IExtendedPropertiesProvider extendedPropertiesProvider = null)
     : base(options)
 {
     this.publicUrlProvider          = publicUrlProvider;
     this.extendedPropertiesProvider = extendedPropertiesProvider;
 }