public void CreateDirectory(string virtualPath) { Directory.CreateDirectory(MapPath(virtualPath)); if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
public void CreateDirectory(string virtualPath) { isp.CreateFolder(ToRelative(virtualPath)); if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
public void CreateDirectory(string virtualPath) { var path = UnEscapedPath(virtualPath); Container.GetDirectoryReference(path); if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
/// <summary>Creates a directory.</summary> /// <param name="virtualPath">The directory path to create.</param> public virtual void CreateDirectory(string virtualPath) { string path = MapPath(virtualPath); CreateDirectoryPath(new DirectoryInfo(path)); if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
public void CreateDirectory(string virtualPath) { string fixedPath = FixPath(virtualPath); GetGridFS().Upload(new MemoryStream(new byte[0]), fixedPath, new MongoGridFSCreateOptions { Metadata = CreateMetadata(fixedPath, true) }); if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
public void CreateDirectory(string virtualPath) { virtualPath = string.Format("{0}/{1}", FixPathForS3(virtualPath), EmptyFilename); var request = new PutObjectRequest() .WithBucketName(this.bucketName) .WithKey(virtualPath) .WithContentBody(string.Empty) .WithContentType("text"); using (this.s3.PutObject(request)) { } if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(FixPathForN2(virtualPath), null)); } }
public void CreateDirectory(string virtualPath) { var path = FileSystemPath.Directory(virtualPath); // Ensure consistent behavoir with the System.UI.Directory methods used by mapped and virtual filesystem if(DirectoryExists(path.ToString())) throw new IOException("The directory " + path.ToString() + " already exists."); using (var trx = Session.BeginTransaction()) { CreateDirectoryInternal(virtualPath); trx.Commit(); } if (DirectoryCreated != null) { DirectoryCreated.Invoke(this, new FileEventArgs(virtualPath, null)); } }
private async Task <bool> TryRecover() { _fileWatcher.EnableRaisingEvents = false; _directoryWatcher.EnableRaisingEvents = false; _attributesWatcher.EnableRaisingEvents = false; await Task.Delay(_recoveryDelayMilliseconds); EmptyQueue(); var rescanChange = new DirectoryCreated(_entries, _directory, _fileSystem, _fileSystemFilter, _directory); bool isRecovered; try { _entries.MarkAllDeleted(); _log.WatcherApplyRecoveryChange(rescanChange.ToString()); rescanChange.Apply(); isRecovered = !_entries.RescanRequired; } catch (Exception e) { _log.WatcherApplyRecoveryChangeFailed(rescanChange.ToString(), e); isRecovered = false; } if (isRecovered) { try { _fileWatcher.EnableRaisingEvents = true; _directoryWatcher.EnableRaisingEvents = true; _attributesWatcher.EnableRaisingEvents = true; } catch (Exception) { isRecovered = false; } } if (!isRecovered) { Error?.Invoke(this, new EventArgs()); Dispose(); } return(isRecovered); }
/// <summary> /// Creates a directory if it does not exist /// </summary> /// <param name="path">Path of the new directory</param> public void CreateDirectory(string path) { var parentPath = Path.GetDirectoryName(path); if (CanCreateDirectory(parentPath)) { var fixedPath = FixPath(path); // Ensure parent directory exists if (!string.IsNullOrEmpty(fixedPath)) // But only if it isn't the root { CreateDirectory(parentPath); } // Create the directory if (!DirectoryExists(fixedPath)) { Items.Add(fixedPath, null); DirectoryCreated?.Invoke(this, new DirectoryCreatedEventArgs(fixedPath)); } } }
public static void CreateDirectory(string path) { if (!DirectoryExists(path)) { string[] pathlist = path.Split('/'); int vol = Convert.ToInt32(pathlist[0].Replace(":", "")); var dir = Mounts[vol]; for (int i = 1; i <= pathlist.Length - 2; i++) { dir = dir.FindDirectoryByName(pathlist[i]); } dir.AddDirectory(new Directory { Name = pathlist[pathlist.Length - 1], permissions = CurrentUser, }); DirectoryCreated?.Invoke(path); } else { throw new Exception("The directory \"" + path + "\" already exists."); } }
private async Task<bool> TryRecover() { _fileWatcher.EnableRaisingEvents = false; _directoryWatcher.EnableRaisingEvents = false; _attributesWatcher.EnableRaisingEvents = false; await Task.Delay(_recoveryDelayMilliseconds); EmptyQueue(); var rescanChange = new DirectoryCreated(_entries, _directory, _fileSystem, _fileSystemFilter, _directory); bool isRecovered; try { _entries.MarkAllDeleted(); _log.WatcherApplyRecoveryChange(rescanChange.ToString()); rescanChange.Apply(); isRecovered = !_entries.RescanRequired; } catch (Exception e) { _log.WatcherApplyRecoveryChangeFailed(rescanChange.ToString(), e); isRecovered = false; } if (isRecovered) { try { _fileWatcher.EnableRaisingEvents = true; _directoryWatcher.EnableRaisingEvents = true; _attributesWatcher.EnableRaisingEvents = true; } catch (Exception) { isRecovered = false; } } if (!isRecovered) { Error?.Invoke(this, new EventArgs()); Dispose(); } return isRecovered; }