using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ScrewTurn.Wiki.PluginFramework {
///
/// Contains arguments for the File Activity event.
///
public class FileActivityEventArgs : EventArgs {
private StFileInfo file;
private string oldFileName;
private StDirectoryInfo directory;
private string oldDirectoryName;
private PageInfo page;
private FileActivity activity;
///
/// Initializes a new instance of the class.
///
/// The file that changed, if any (full path).
/// The old name of the file, if any (full path).
/// The directory that changed, if any (full path).
/// The old name of the directory, if any (full path).
/// The page owning the attachment, if any.
/// The activity.
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;
}
///
/// Gets the provider.
///
public IFilesStorageProviderV30 Provider {
get {
if(file != null) return file.Provider;
else if(directory != null) return directory.Provider;
else return null;
}
}
///
/// Gets the file that changed, if any.
///
public StFileInfo File {
get { return file; }
}
///
/// Gets the old name of the file, if any.
///
public string OldFileName {
get { return oldFileName; }
}
///
/// Gets the directory that changed, if any.
///
public StDirectoryInfo Directory {
get { return directory; }
}
///
/// Gets the old name of the directory, if any.
///
public string OldDirectoryName {
get { return oldDirectoryName; }
}
///
/// Gets the page owning the attachment, if any.
///
public PageInfo Page {
get { return page; }
}
///
/// Gets the activity.
///
public FileActivity Activity {
get { return activity; }
}
}
///
/// Lists legal file activities.
///
public enum FileActivity {
///
/// A file has been uploaded.
///
FileUploaded,
///
/// A file has been renamed.
///
FileRenamed,
///
/// A file has been deleted.
///
FileDeleted,
///
/// A directory has been created.
///
DirectoryCreated,
///
/// A directory has been renamed.
///
DirectoryRenamed,
///
/// A directory (and all its contents) has been deleted.
///
DirectoryDeleted,
///
/// An attachment has been uploaded.
///
AttachmentUploaded,
///
/// An attachment has been renamed.
///
AttachmentRenamed,
///
/// An attachment has been deleted.
///
AttachmentDeleted
}
}