public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options) { var address = LayeredNodeAddress.Parse(uri); if (address.Port >= 0 || address.UserName != "" || address.Password != "" || address.ServerName != "") { throw new MalformedUriException(uri, "Network & Authentication information not permitted"); } if (nodeType.Is(typeof(IFile))) { var uri2 = address.InnerUri; if (StringUriUtils.ContainsQuery(uri2)) { uri2 += "&shadow=true"; } else { uri2 += "?shadow=true"; } return resolver.Resolve(uri2, nodeType); } return resolver.Resolve(address.InnerUri); }
public override INode Resolve(string uri, NodeType nodeType, AddressScope scope, FileSystemOptions options) { bool success; IFileSystem fileSystem; var address = LayeredNodeAddress.Parse(uri); lock (this.fileSystemCache) { success = this.fileSystemCache.TryGetValue(address.RootUri, out fileSystem); } if (!success) { var networkUri = String.Format("netvfs://{0}[" + uri + "]/", this.ipAddress); fileSystem = FileSystemManager.GetManager().ResolveDirectory(networkUri).FileSystem; lock (this.fileSystemCache) { this.fileSystemCache.Add(address.RootUri, fileSystem); } } return fileSystem.Resolve(address.PathAndQuery); }
public virtual IFileSystem CreateNewFileSystem(string scheme, IFile destination, FileSystemOptions options) { throw new NotSupportedException ( new System.Diagnostics.StackFrame().GetMethod().Name + "|NotSupported" ); }
protected override IFileSystem NewFileSystem(INodeAddress rootAddress, FileSystemOptions options, out bool cache) { var backingFile = this.Manager.ResolveFile(((LayeredNodeAddress)rootAddress).InnerUri); cache = options.ReadOnly; return new ZipFileSystem(rootAddress, backingFile, options); }
protected override IFileSystem NewFileSystem(INodeAddress rootAddress, FileSystemOptions options, out bool cache) { var backingFile = this.Manager.ResolveFile(((LayeredNodeAddress)rootAddress).InnerUri); cache = true; return new ZipFileSystem(rootAddress, backingFile, this.AmmendOptionsFromAddress(backingFile.Address, options)); }
protected override IFileSystem NewFileSystem(INodeAddress rootAddress, FileSystemOptions options, out bool cache) { var layeredAddress = (LayeredNodeAddress)rootAddress; var components = layeredAddress.InnerUri.Split(';'); var fileSystems = components.Select(s => this.Manager.Resolve(s).FileSystem).ToList(); cache = true; return new OverlayedFileSystem(fileSystems, options); }
public SevenZipFileSystem(IInArchive archive, IFileName rootName, IFileObject parentLayer, FileSystemOptions fileSystemOptions) : base(rootName, parentLayer, fileSystemOptions) { this.archive = archive; if (parentLayer.FileSystem is LocalFileSystem || parentLayer.Content.Size > 1048576) { file = parentLayer.FileSystem.replicateFile(parentLayer, Selectors.SELECT_SELF); } }
public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options) { Pair<string, string> result; result = uri.SplitOnFirst("://"); if (result.Left != this.imaginaryFileSystem.RootDirectory.Address.Scheme) { throw new NotSupportedException(result.Left); } return this.imaginaryFileSystem.Resolve(TextConversion.FromEscapedHexString(result.Right), nodeType); }
protected override IFileSystem NewFileSystem(INodeAddress rootAddress, FileSystemOptions options, out bool cache) { FileSystemOptions modifiedOptions; if (!modifiedFileSystemOptions.TryGetValue(options, out modifiedOptions)) { modifiedOptions = options.CreateWithAdditionalConfig(this.configuration); modifiedFileSystemOptions[options] = modifiedOptions; } cache = true; return new LocalFileSystem(rootAddress, modifiedOptions); }
protected virtual FileSystemOptions AmmendOptionsFromAddress(INodeAddress address, FileSystemOptions options) { NameValueCollection variables = null; foreach (var key in address.QueryValues.Keys.Cast<string>().Where(key => this.SupportedUriSchemas.Any(c => key.StartsWith(c, StringComparison.InvariantCultureIgnoreCase)))) { if (variables == null) { variables = new NameValueCollection(); } variables[key] = address.QueryValues[key]; } return options.AddVariables(variables); }
public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options) { var node = base.Find(resolver, uri, nodeType, options); if (node.Equals(this.ImaginaryFileSystem.RootDirectory)) { var dir = (ImaginaryDirectory)node; dir.Refreshed += delegate { PopulateRoot(dir); }; PopulateRoot(dir); } return node; }
/// <summary> /// Initializes a new instance of the <see cref="BlobFileSystem" /> class. /// </summary> /// <param name="rootAddress">The root address.</param> /// <param name="options">The options.</param> protected internal BlobFileSystem(INodeAddress rootAddress, FileSystemOptions options) : base(rootAddress, null, options) { var nodeAddress = (StandardNodeAddress)rootAddress; if (nodeAddress.UserName != null && nodeAddress.UserName.EndsWith("==")) { var account = nodeAddress.HostName.Substring(0, nodeAddress.HostName.IndexOf('.')); var credentials = new StorageCredentials(account, nodeAddress.UserName); BlobClient = new CloudBlobClient(new Uri(rootAddress.RootUri), credentials); } else { var storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting(nodeAddress.HostName)); BlobClient = storageAccount.CreateCloudBlobClient(); } }
private static FileSystemOptions VerifyOptions(FileSystemOptions options) { options.NodeCacheType = typeof(PathKeyedNodeCache); return options; }
internal protected WebFileSystem(INodeAddress rootAddress, FileSystemOptions options) : base(rootAddress, null, options) { }
protected override IFileSystem doCreateFileSystem(String scheme, IFileObject file, FileSystemOptions fileSystemOptions) { if(!formatMap.ContainsKey(scheme)) { throw new FileSystemException(String.Format("Unknown file system scheme: {0}", scheme)); } IInArchive archive = sevenZip.CreateInArchive(SevenZipFormat.GetClassIdFromKnownFormat(formatMap[scheme])); if(archive == null) { throw new FileSystemException("This 7-zip library does not support this archive type."); } IFileName rootName = new LayeredFileName(scheme, file.Name, FileName_Fields.ROOT_PATH, FileType.FOLDER); SevenZipFileSystem fs = new SevenZipFileSystem(archive, rootName, file, fileSystemOptions); foreach (IFileSystemListener listener in defaultListeners) { fs.addListener(listener); } return fs; }
/// <summary> /// Initializes a new instance of the <see cref="PgpFileSystem"/> class. /// </summary> /// <param name="rootAddress">The root address.</param> /// <param name="parentLayer">The parent layer.</param> /// <param name="options">The options.</param> protected internal PgpFileSystem(INodeAddress rootAddress, IFile parentLayer, FileSystemOptions options) : base(rootAddress, parentLayer, options) { PgpDecrypter = InitializePgp(); }
public ViewNodeProvider(IFileSystemManager fileSystemManager, string scheme, IDirectory root, FileSystemOptions options, Configuration config) : this(fileSystemManager, CreateViewFileSystem(scheme, root, options, config)) { }
public static ZipFileSystem CreateZipFile(IFile zipFile, IDirectory zipFileContents, FileSystemOptions options) { return(CreateZipFile(zipFile, zipFileContents.Walk(NodeType.File).Select(c => (IFile)c), file => zipFileContents.Address.GetRelativePathTo(file.Address), options)); }
/// <summary> /// Called by the constructor before the file system extenders and security manager is created. /// </summary> /// <remarks> /// Override this method to perform FileSystem initialization routines that need to be performed /// before the extenders and security manager are constructed. Initialization routines that rely /// on extenders or the security manager should be created within the dervied class's constructor. /// </remarks> /// <param name="rootAddress"></param> /// <param name="parentLayer"></param> /// <param name="options"></param> protected virtual void InitializeConstruction(INodeAddress rootAddress, IFile parentLayer, FileSystemOptions options) { }
public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options) { var address = LayeredNodeAddress.Parse(uri); if (address.Port >= 0 || address.UserName != "" || address.Password != "" || address.ServerName != "") { throw new MalformedUriException(uri, "Network & Authentication information not permitted"); } if (nodeType.Is(typeof(IFile))) { var uri2 = address.InnerUri; if (StringUriUtils.ContainsQuery(uri2)) { uri2 += "&shadow=true"; } else { uri2 += "?shadow=true"; } return(resolver.Resolve(uri2, nodeType)); } return(resolver.Resolve(address.InnerUri)); }
/// <summary> /// Creates a new instance of the <see cref="AzureStorageQueueNameResolver"/> /// </summary> /// <param name="options">The <see cref="IOptions{FileSystemOptions}"/> instance injected from the DI container.</param> public FileSystemNameResolver(IOptions <FileSystemOptions> options) { _options = options.Value; }
protected override IFileSystem NewFileSystem(INodeAddress rootAddress, FileSystemOptions options, out bool cache) { cache = true; return(new NetworkFileSystem(rootAddress, options)); }
public static ZipFileSystem CreateZipFile(IFile zipFile, IEnumerable <IFile> files, Func <IFile, string> fileToFullPath, FileSystemOptions options) { var compressionLevel = 9; var zipCompressionLevel = options.Variables["ZipCompressionLevel"]; if (zipCompressionLevel != null) { compressionLevel = Convert.ToInt32(zipCompressionLevel); if (compressionLevel < 0) { compressionLevel = 0; } else if (compressionLevel > 9) { compressionLevel = 9; } } var password = options.Variables["ZipPassword"]; using (var zipOutputStream = new ZLib.ZipOutputStream(zipFile.GetContent().GetOutputStream())) { zipOutputStream.SetLevel(compressionLevel); zipOutputStream.IsStreamOwner = true; zipOutputStream.UseZip64 = ZLib.UseZip64.Dynamic; zipOutputStream.Password = password; if (files != null) { foreach (var file in files) { var entryName = fileToFullPath(file); entryName = ZLib.ZipEntry.CleanName(entryName); var entry = new ZLib.ZipEntry(entryName); using (var stream = file.GetContent().GetInputStream(FileMode.Open, FileShare.Read)) { if (stream.Length > 0) { entry.Size = stream.Length; } zipOutputStream.PutNextEntry(entry); stream.CopyTo(zipOutputStream); } zipOutputStream.CloseEntry(); } } } return(new ZipFileSystem(zipFile, options)); }
public LocalFileSystem(INodeAddress rootAddress, FileSystemOptions options) : base(rootAddress, null, options) { }
protected virtual FileSystemOptions AmmendOptionsFromAddress(INodeAddress address, FileSystemOptions options) { NameValueCollection variables = null; foreach (var key in address.QueryValues.Keys.Cast <string>().Where(key => this.SupportedUriSchemas.Any(c => key.StartsWith(c, StringComparison.InvariantCultureIgnoreCase)))) { if (variables == null) { variables = new NameValueCollection(); } variables[key] = address.QueryValues[key]; } return(options.AddVariables(variables)); }
public IFileSystem CreateView(FileSystemOptions options) { return(this.Wrappee.CreateView(options)); }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="name">The name of the file system.</param> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> public OverlayedFileSystem(string name, IEnumerable<IFileSystem> fileSystems, FileSystemOptions options) : this(name, fileSystems, options, new StandardOverlayedNodeSelector()) { }
public ViewNodeProvider(IFileSystemManager fileSystemManager, string scheme, IDirectory root, FileSystemOptions options) : this(fileSystemManager, scheme, root, options, null) { }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="name">The name of the file system.</param> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> /// <param name="overlayedNodeSelector">The <c>OverlayedNodeSelector</c> to use to select/resolve files.</param> public OverlayedFileSystem(string name, IEnumerable<IFileSystem> fileSystems, FileSystemOptions options, OverlayedNodeSelector overlayedNodeSelector) : base(new StandardNodeAddress(name == null ? "overlayed" : name, name != null ? null : OverlayedNodeProvider.NextUniqueName(), 0, 0, "", "", "/", "") , null, VerifyOptions(options)) { this.fileSystems = new List<IFileSystem>(); foreach (IFileSystem fs in fileSystems) { fs.Closed += new EventHandler(FileSystem_Closed); this.fileSystems.Add(fs); } readonlyFileSystems = ((List<IFileSystem>)this.fileSystems).AsReadOnly(); this.OverlayedNodeSelector = overlayedNodeSelector; }
public override INode Resolve(string uri, NodeType nodeType, AddressScope scope, FileSystemOptions options) { bool success; IFileSystem fileSystem; var address = LayeredNodeAddress.Parse(uri); lock (this.fileSystemCache) { success = this.fileSystemCache.TryGetValue(address.RootUri, out fileSystem); } if (!success) { var networkUri = String.Format("netvfs://{0}[" + uri + "]/", this.ipAddress); fileSystem = FileSystemManager.GetManager().ResolveDirectory(networkUri).FileSystem; lock (this.fileSystemCache) { this.fileSystemCache.Add(address.RootUri, fileSystem); } } return(fileSystem.Resolve(address.PathAndQuery)); }
public ViewFileSystem(string scheme, IDirectory root, FileSystemOptions options) : base(ViewNodeAddress.Parse(scheme + ":///"), null, options) { this.foriegnRoot = root; }
public ZipFileSystem(IFile file, FileSystemOptions options) : this(LayeredNodeAddress.Parse("zip://[" + file.Address.Uri + "]"), file, options) { }
public override INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options) { var result = uri.SplitOnFirst("://"); if (result.Left != this.viewFileSystem.RootDirectory.Address.Scheme) { throw new NotSupportedException(result.Left); } return(this.viewFileSystem.Resolve(TextConversion.FromEscapedHexString(result.Right), nodeType)); }
public ViewFileSystem(IDirectory root, INodeAddress rootAddress, IFile parentLayer, FileSystemOptions options) : base(rootAddress, parentLayer, options) { this.foriegnRoot = root; }
public FileHandlerService(IServiceProvider serviceProvider, IOptions <FileSystemOptions> options) { _fileEntryService = serviceProvider.GetRequiredService <IFileEntryService>(); _fileSystemOptions = options.Value ?? throw new InvalidDataException("Invalid file system options provided."); }
/// <summary> /// Initializes a new instance of the <see cref="PgpFileSystem"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="options">The options.</param> public PgpFileSystem(IFile file, FileSystemOptions options) : this(LayeredNodeAddress.Parse("pgp://[" + file.Address.Uri + "]"), file, options) { }
public SerialTagReader(DicomTagReaderOptions options, FileSystemOptions fileSystemOptions, IProducerModel seriesMessageProducerModel, IProducerModel fileMessageProducerModel, IFileSystem fs) : base(options, fileSystemOptions, seriesMessageProducerModel, fileMessageProducerModel, fs) { }
/// <inheritdoc /> public abstract bool Exists(string path, FileSystemOptions options = FileSystemOptions.File | FileSystemOptions.Directory);
private static IFileSystem CreateViewFileSystem(string scheme, IDirectory root, FileSystemOptions options, Configuration config) { if (scheme.IsNullOrEmpty()) { throw new ArgumentException(String.Empty, "scheme"); } if (config != null) { options = options.CreateWithAdditionalConfig(config); } var fileSystem = root.CreateView(scheme, options); return fileSystem; }
public abstract INode Find(INodeResolver resolver, string uri, NodeType nodeType, FileSystemOptions options);
public override IFileSystem CreateView(string scheme, FileSystemOptions options) { return(new View.ViewFileSystem(scheme, this, options)); }
internal protected NetworkFileSystem(INodeAddress rootAddress, FileSystemOptions options) : base(rootAddress, null, options) { var comparer = ObjectReferenceIdentityEqualityComparer<INetworkFileSystemClient>.Default; this.freeClients = new TimedReferenceDictionary<INetworkFileSystemClient, INetworkFileSystemClient>(TimeSpan.FromMinutes(25), comparer); this.freeClientsForBinaryAccess = new TimedReferenceDictionary<INetworkFileSystemClient, INetworkFileSystemClient>(TimeSpan.FromMinutes(25), comparer); lock (staticFileSystemsCache) { IList<NetworkFileSystemWeakReference> fileSystems; var uniqueId = this.GetUniqueId(); if (!staticFileSystemsCache.TryGetValue(uniqueId, out fileSystems)) { fileSystems = new List<NetworkFileSystemWeakReference>(); staticFileSystemsCache[GetUniqueId()] = fileSystems; } fileSystems.Add(new NetworkFileSystemWeakReference(this)); } }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="name">The name of the file system.</param> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> /// <param name="overlayedNodeSelector">The <c>OverlayedNodeSelector</c> to use to select/resolve files.</param> public OverlayedFileSystem(string name, IEnumerable <IFileSystem> fileSystems, FileSystemOptions options, OverlayedNodeSelector overlayedNodeSelector) : base(new StandardNodeAddress(name ?? "overlayed", name != null ? null : OverlayedNodeProvider.NextUniqueName(), 0, 0, "", "", "/", ""), null, VerifyOptions(options)) { this.fileSystems = new List <IFileSystem>(); foreach (var fs in fileSystems) { fs.Closed += this.FileSystem_Closed; this.fileSystems.Add(fs); } this.OverlayedNodeSelector = overlayedNodeSelector; }
public virtual IFileSystem CreateView(string scheme, FileSystemOptions options) { return DoCreateView(scheme, options); }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> public OverlayedFileSystem(FileSystemOptions options, params IFileSystem[] fileSystems) : this(fileSystems, options, new StandardOverlayedNodeSelector()) { }
public override IFileSystem CreateView(string scheme, FileSystemOptions options) { return new View.ViewFileSystem(scheme, this, options); }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> /// <param name="overlayedNodeSelector">The <c>OverlayedNodeSelector</c> to use to select/resolve files.</param> public OverlayedFileSystem(IEnumerable<IFileSystem> fileSystems, FileSystemOptions options, OverlayedNodeSelector overlayedNodeSelector) : this(null, fileSystems, options, overlayedNodeSelector) { }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> /// <param name="overlayedNodeSelector">The <c>OverlayedNodeSelector</c> to use to select/resolve files.</param> public OverlayedFileSystem(IEnumerable <IFileSystem> fileSystems, FileSystemOptions options, OverlayedNodeSelector overlayedNodeSelector) : this(null, fileSystems, options, overlayedNodeSelector) { }
public static ZipFileSystem CreateZipFile(IFile zipFile, FileSystemOptions options) { return(CreateZipFile(zipFile, null, null, options)); }
private bool HasOptions(FileSystemOptions options, FileSystemOptions expected) { return((options & expected) == expected); }
public virtual IFileSystem CreateView(string scheme, FileSystemOptions options) { return(this.Wrappee.CreateView(scheme, options)); }
public virtual IFileSystem CreateView(FileSystemOptions options) { return DoCreateView(this.Address.Scheme, options); }
public IFileSystem CreateView(FileSystemOptions options) { return(CreateView(this.Address.Scheme, options)); }
protected virtual IFileSystem DoCreateView(string scheme, FileSystemOptions options) { return new View.ViewFileSystem(scheme, this, options); }
protected override IFileSystem DoCreateView(string scheme, FileSystemOptions options) { return(new NetworkFileSystem(NetworkNodeAddress.CreateAsRoot(scheme, this.Address, true), options)); }
public TempNodeProvider(IFileSystemManager manager, string scheme, IDirectory root, FileSystemOptions options) : base(manager, scheme, root, options) { }
/// <summary> /// Construct a new <see cref="OverlayedFileSystem"/>. /// </summary> /// <param name="name">The name of the file system.</param> /// <param name="fileSystems">The file systems to initially add to this file system.</param> /// <param name="options">The options for the file system.</param> public OverlayedFileSystem(string name, IEnumerable <IFileSystem> fileSystems, FileSystemOptions options) : this(name, fileSystems, options, new StandardOverlayedNodeSelector()) { }