/// <summary> /// Initializes a new instance of the <see cref="T:FileActivityEventArgs" /> class. /// </summary> /// <param name="file">The file that changed, if any (full path).</param> /// <param name="oldFileName">The old name of the file, if any (full path).</param> /// <param name="directory">The directory that changed, if any (full path).</param> /// <param name="oldDirectoryName">The old name of the directory, if any (full path).</param> /// <param name="page">The page owning the attachment, if any.</param> /// <param name="activity">The activity.</param> public FileActivityEventArgs(StFileInfo file, string oldFileName, StDirectoryInfo directory, string oldDirectoryName, PageInfo page, FileActivity activity) { File = file; OldFileName = oldFileName; Directory = directory; OldDirectoryName = oldDirectoryName; Page = page; Activity = activity; }
/// <summary> /// Initializes a new instance of the <see cref="T:FileActivityEventArgs" /> class. /// </summary> /// <param name="file">The file that changed, if any (full path).</param> /// <param name="oldFileName">The old name of the file, if any (full path).</param> /// <param name="directory">The directory that changed, if any (full path).</param> /// <param name="oldDirectoryName">The old name of the directory, if any (full path).</param> /// <param name="page">The page owning the attachment, if any.</param> /// <param name="activity">The activity.</param> public FileActivityEventArgs(StFileInfo file, string oldFileName, StDirectoryInfo directory, string oldDirectoryName, PageInfo page, FileActivity activity) { this.file = file; this.oldFileName = oldFileName; this.directory = directory; this.oldDirectoryName = oldDirectoryName; this.page = page; this.activity = activity; }
/// <summary> /// Initializes a new instance of the <see cref="T:FileActivityEventArgs" /> class. /// </summary> /// <param name="file">The file that changed, if any (full path).</param> /// <param name="oldFileName">The old name of the file, if any (full path).</param> /// <param name="directory">The directory that changed, if any (full path).</param> /// <param name="oldDirectoryName">The old name of the directory, if any (full path).</param> /// <param name="page">The page owning the attachment, if any.</param> /// <param name="activity">The activity.</param> public FileActivityEventArgs(StFileInfo file, string oldFileName, StDirectoryInfo directory, string oldDirectoryName, PageInfo page, FileActivity activity) { this.file = file; this.oldFileName = oldFileName; this.directory = directory; this.oldDirectoryName = oldDirectoryName; this.page = page; this.activity = activity; }
/// <summary> /// Lists files in a directory. /// </summary> /// <param name="directory">The directory (<c>null</c> for the root, first invocation).</param> /// <returns>The files.</returns> public StFileInfo[] ListFiles(StDirectoryInfo directory) { List<StFileInfo> result = new List<StFileInfo>(20); if(directory == null) { foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) { string[] files = prov.ListFiles(null); foreach(string file in files) { FileDetails details = prov.GetFileDetails(file); result.Add(new StFileInfo(details.Size, details.LastModified, details.RetrievalCount, file, prov)); } } } else { string[] files = directory.Provider.ListFiles(directory.FullPath); foreach(string file in files) { FileDetails details = directory.Provider.GetFileDetails(file); result.Add(new StFileInfo(details.Size, details.LastModified, details.RetrievalCount, file, directory.Provider)); } } return result.ToArray(); }
/// <summary> /// Lists directories in a directory. /// </summary> /// <param name="directory">The directory (<c>null</c> for the root, first invocation).</param> /// <returns>The directories.</returns> public StDirectoryInfo[] ListDirectories(StDirectoryInfo directory) { List<StDirectoryInfo> result = new List<StDirectoryInfo>(20); if(directory == null) { foreach(IFilesStorageProviderV30 prov in Collectors.FilesProviderCollector.AllProviders) { string[] dirs = prov.ListDirectories(null); foreach(string dir in dirs) { result.Add(new StDirectoryInfo(dir, prov)); } } } else { string[] dirs = directory.Provider.ListDirectories(directory.FullPath); foreach(string dir in dirs) { result.Add(new StDirectoryInfo(dir, directory.Provider)); } } return result.ToArray(); }
/// <summary> /// Checks whether an action is allowed for a directory. /// </summary> /// <param name="directory">The directory.</param> /// <param name="action">The action (see <see cref="Actions.ForDirectories" />).</param> /// <param name="user">The user.</param> /// <returns><c>true</c> if the action is allowed, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">If <b>directory</b>, <b>action</b> or <b>user</b> are <c>null</c>.</exception> /// <exception cref="ArgumentException">If <b>action</b> is empty.</exception> public bool CheckActionForDirectory(StDirectoryInfo directory, string action, UserInfo user) { if(directory == null) throw new ArgumentNullException("directory"); if(action == null) throw new ArgumentNullException("action"); if(action.Length == 0) throw new ArgumentException("Action cannot be empty", "action"); var temp = user != null ? user : Users.GetAnonymousAccount(); return AuthChecker.CheckActionForDirectory(directory.Provider, directory.FullPath, action, temp.Username, temp.Groups); }
/// <summary> /// Gets the directory path of the file. /// </summary> /// <returns>The directory path.</returns> public string GetDirectory() { return(StDirectoryInfo.GetDirectory(fullName)); }
public bool CheckActionForDirectory(StDirectoryInfo directory, string action, UserInfo user) { throw new NotImplementedException(); }
public StFileInfo[] ListFiles(StDirectoryInfo directory) { throw new NotImplementedException(); }
/// <summary> /// Checks whether an action is allowed for a directory. /// </summary> /// <param name="directory">The directory.</param> /// <param name="action">The action (see <see cref="Actions.ForDirectories" />).</param> /// <param name="user">The user.</param> /// <returns><c>true</c> if the action is allowed, <c>false</c> otherwise.</returns> /// <exception cref="ArgumentNullException">If <b>directory</b>, <b>action</b> or <b>user</b> are <c>null</c>.</exception> /// <exception cref="ArgumentException">If <b>action</b> is empty.</exception> public bool CheckActionForDirectory(StDirectoryInfo directory, string action, UserInfo user) { if(directory == null) throw new ArgumentNullException("directory"); if(action == null) throw new ArgumentNullException("action"); if(action.Length == 0) throw new ArgumentException("Action cannot be empty", "action"); if(user == null) throw new ArgumentNullException("user"); return AuthChecker.CheckActionForDirectory(directory.Provider, directory.FullPath, action, user.Username, user.Groups); }