You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

71 lines
2.8 KiB

  1. using Alphaleonis.Win32.Filesystem;
  2. using System.Security.AccessControl;
  3. namespace Security2
  4. {
  5. public partial class FileSystemAuditRule2
  6. {
  7. #region Properties
  8. private FileSystemAuditRule fileSystemAuditRule;
  9. private string fullName;
  10. private bool inheritanceEnabled;
  11. private string inheritedFrom;
  12. public string Name { get { return System.IO.Path.GetFileName(fullName); } }
  13. public string FullName { get { return fullName; } set { fullName = value; } }
  14. public bool InheritanceEnabled { get { return inheritanceEnabled; } set { inheritanceEnabled = value; } }
  15. public string InheritedFrom { get { return inheritedFrom; } set { inheritedFrom = value; } }
  16. public AuditFlags AuditFlags { get { return fileSystemAuditRule.AuditFlags; } }
  17. public FileSystemRights2 AccessRights { get { return (FileSystemRights2)fileSystemAuditRule.FileSystemRights; } }
  18. public IdentityReference2 Account { get { return (IdentityReference2)fileSystemAuditRule.IdentityReference; } }
  19. public InheritanceFlags InheritanceFlags { get { return fileSystemAuditRule.InheritanceFlags; } }
  20. public bool IsInherited { get { return fileSystemAuditRule.IsInherited; } }
  21. public PropagationFlags PropagationFlags { get { return fileSystemAuditRule.PropagationFlags; } }
  22. #endregion
  23. public FileSystemAuditRule2(FileSystemAuditRule fileSystemAuditRule)
  24. {
  25. this.fileSystemAuditRule = fileSystemAuditRule;
  26. }
  27. public FileSystemAuditRule2(FileSystemAuditRule fileSystemAuditRule, FileSystemInfo item)
  28. {
  29. this.fileSystemAuditRule = fileSystemAuditRule;
  30. this.fullName = item.FullName;
  31. }
  32. public FileSystemAuditRule2(FileSystemAuditRule fileSystemAuditRule, string path)
  33. {
  34. this.fileSystemAuditRule = fileSystemAuditRule;
  35. }
  36. #region Conversion
  37. public static implicit operator FileSystemAuditRule(FileSystemAuditRule2 ace2)
  38. {
  39. return ace2.fileSystemAuditRule;
  40. }
  41. public static implicit operator FileSystemAuditRule2(FileSystemAuditRule ace)
  42. {
  43. return new FileSystemAuditRule2(ace);
  44. }
  45. //REQUIRED BECAUSE OF CONVERSION OPERATORS
  46. public override bool Equals(object obj)
  47. {
  48. return this.fileSystemAuditRule == (FileSystemAuditRule)obj;
  49. }
  50. public override int GetHashCode()
  51. {
  52. return this.fileSystemAuditRule.GetHashCode();
  53. }
  54. public override string ToString()
  55. {
  56. return fileSystemAuditRule.ToString();
  57. }
  58. public SimpleFileSystemAuditRule ToSimpleFileSystemAuditRule2()
  59. {
  60. return new SimpleFileSystemAuditRule(this.fullName, this.Account, this.AccessRights);
  61. }
  62. #endregion
  63. }
  64. }