mirror of https://github.com/raandree/NTFSSecurity
10 changed files with 6 additions and 1463 deletions
@ -1,309 +0,0 @@ |
|||||
namespace NTFSSecurity |
|
||||
{ |
|
||||
partial class ShowSimpleAccessForm |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Required designer variable.
|
|
||||
/// </summary>
|
|
||||
private System.ComponentModel.IContainer components = null; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Clean up any resources being used.
|
|
||||
/// </summary>
|
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||
protected override void Dispose(bool disposing) |
|
||||
{ |
|
||||
if (disposing && (components != null)) |
|
||||
{ |
|
||||
components.Dispose(); |
|
||||
} |
|
||||
base.Dispose(disposing); |
|
||||
} |
|
||||
|
|
||||
#region Windows Form Designer generated code
|
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Required method for Designer support - do not modify
|
|
||||
/// the contents of this method with the code editor.
|
|
||||
/// </summary>
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
this.components = new System.ComponentModel.Container(); |
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowSimpleAccessForm)); |
|
||||
this.trvDirectories = new System.Windows.Forms.TreeView(); |
|
||||
this.imlIcons = new System.Windows.Forms.ImageList(this.components); |
|
||||
this.lstPermissions = new System.Windows.Forms.ListView(); |
|
||||
this.chdIdentity = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chdRights = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chdAccessControlType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chkRemoveFoldersWithoutAccess = new System.Windows.Forms.CheckBox(); |
|
||||
this.grpFilter = new System.Windows.Forms.GroupBox(); |
|
||||
this.grpSearchForIdentity = new System.Windows.Forms.GroupBox(); |
|
||||
this.btnSearchForIdentityNext = new System.Windows.Forms.Button(); |
|
||||
this.btnSearchForIdentityPrev = new System.Windows.Forms.Button(); |
|
||||
this.txtSearchForIdentity = new System.Windows.Forms.TextBox(); |
|
||||
this.btnSearchForIdentity = new System.Windows.Forms.Button(); |
|
||||
this.grpSearchForFolder = new System.Windows.Forms.GroupBox(); |
|
||||
this.btnSearchForFolderPrev = new System.Windows.Forms.Button(); |
|
||||
this.btnSearchForFolderNext = new System.Windows.Forms.Button(); |
|
||||
this.btnSearchForFolder = new System.Windows.Forms.Button(); |
|
||||
this.txtSearchForFolder = new System.Windows.Forms.TextBox(); |
|
||||
this.labDirectoryTreeView = new System.Windows.Forms.Label(); |
|
||||
this.labAccessView = new System.Windows.Forms.Label(); |
|
||||
this.ttSearchForFolder = new System.Windows.Forms.ToolTip(this.components); |
|
||||
this.grpFilter.SuspendLayout(); |
|
||||
this.grpSearchForIdentity.SuspendLayout(); |
|
||||
this.grpSearchForFolder.SuspendLayout(); |
|
||||
this.SuspendLayout(); |
|
||||
//
|
|
||||
// trvDirectories
|
|
||||
//
|
|
||||
this.trvDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
||||
| System.Windows.Forms.AnchorStyles.Left))); |
|
||||
this.trvDirectories.ImageIndex = 0; |
|
||||
this.trvDirectories.ImageList = this.imlIcons; |
|
||||
this.trvDirectories.Location = new System.Drawing.Point(12, 29); |
|
||||
this.trvDirectories.Name = "trvDirectories"; |
|
||||
this.trvDirectories.SelectedImageIndex = 0; |
|
||||
this.trvDirectories.Size = new System.Drawing.Size(320, 574); |
|
||||
this.trvDirectories.TabIndex = 0; |
|
||||
this.trvDirectories.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.trvDirectories_AfterSelect); |
|
||||
//
|
|
||||
// imlIcons
|
|
||||
//
|
|
||||
this.imlIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imlIcons.ImageStream"))); |
|
||||
this.imlIcons.TransparentColor = System.Drawing.Color.Transparent; |
|
||||
this.imlIcons.Images.SetKeyName(0, "container.jpg"); |
|
||||
//
|
|
||||
// lstPermissions
|
|
||||
//
|
|
||||
this.lstPermissions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
||||
| System.Windows.Forms.AnchorStyles.Left) |
|
||||
| System.Windows.Forms.AnchorStyles.Right))); |
|
||||
this.lstPermissions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { |
|
||||
this.chdIdentity, |
|
||||
this.chdRights, |
|
||||
this.chdAccessControlType}); |
|
||||
this.lstPermissions.Location = new System.Drawing.Point(338, 29); |
|
||||
this.lstPermissions.Name = "lstPermissions"; |
|
||||
this.lstPermissions.Size = new System.Drawing.Size(480, 342); |
|
||||
this.lstPermissions.SmallImageList = this.imlIcons; |
|
||||
this.lstPermissions.TabIndex = 1; |
|
||||
this.lstPermissions.UseCompatibleStateImageBehavior = false; |
|
||||
this.lstPermissions.View = System.Windows.Forms.View.Details; |
|
||||
//
|
|
||||
// chdIdentity
|
|
||||
//
|
|
||||
this.chdIdentity.Text = "Identity"; |
|
||||
//
|
|
||||
// chdRights
|
|
||||
//
|
|
||||
this.chdRights.Text = "Rights"; |
|
||||
//
|
|
||||
// chdAccessControlType
|
|
||||
//
|
|
||||
this.chdAccessControlType.Text = "AccessControlType"; |
|
||||
//
|
|
||||
// chkRemoveFoldersWithoutAccess
|
|
||||
//
|
|
||||
this.chkRemoveFoldersWithoutAccess.AutoSize = true; |
|
||||
this.chkRemoveFoldersWithoutAccess.Location = new System.Drawing.Point(6, 19); |
|
||||
this.chkRemoveFoldersWithoutAccess.Name = "chkRemoveFoldersWithoutAccess"; |
|
||||
this.chkRemoveFoldersWithoutAccess.Size = new System.Drawing.Size(347, 17); |
|
||||
this.chkRemoveFoldersWithoutAccess.TabIndex = 2; |
|
||||
this.chkRemoveFoldersWithoutAccess.Text = "Remove Folders that do not have different access than their parents"; |
|
||||
this.chkRemoveFoldersWithoutAccess.UseVisualStyleBackColor = true; |
|
||||
this.chkRemoveFoldersWithoutAccess.CheckedChanged += new System.EventHandler(this.chkRemoveFoldersWithoutAccess_CheckedChanged); |
|
||||
//
|
|
||||
// grpFilter
|
|
||||
//
|
|
||||
this.grpFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
|
||||
| System.Windows.Forms.AnchorStyles.Right))); |
|
||||
this.grpFilter.Controls.Add(this.grpSearchForIdentity); |
|
||||
this.grpFilter.Controls.Add(this.grpSearchForFolder); |
|
||||
this.grpFilter.Controls.Add(this.chkRemoveFoldersWithoutAccess); |
|
||||
this.grpFilter.Location = new System.Drawing.Point(338, 377); |
|
||||
this.grpFilter.Name = "grpFilter"; |
|
||||
this.grpFilter.Size = new System.Drawing.Size(480, 226); |
|
||||
this.grpFilter.TabIndex = 3; |
|
||||
this.grpFilter.TabStop = false; |
|
||||
this.grpFilter.Text = "Filter"; |
|
||||
//
|
|
||||
// grpSearchForIdentity
|
|
||||
//
|
|
||||
this.grpSearchForIdentity.Controls.Add(this.btnSearchForIdentityNext); |
|
||||
this.grpSearchForIdentity.Controls.Add(this.btnSearchForIdentityPrev); |
|
||||
this.grpSearchForIdentity.Controls.Add(this.txtSearchForIdentity); |
|
||||
this.grpSearchForIdentity.Controls.Add(this.btnSearchForIdentity); |
|
||||
this.grpSearchForIdentity.Location = new System.Drawing.Point(9, 125); |
|
||||
this.grpSearchForIdentity.Name = "grpSearchForIdentity"; |
|
||||
this.grpSearchForIdentity.Size = new System.Drawing.Size(384, 95); |
|
||||
this.grpSearchForIdentity.TabIndex = 4; |
|
||||
this.grpSearchForIdentity.TabStop = false; |
|
||||
this.grpSearchForIdentity.Text = "Search for Identity"; |
|
||||
//
|
|
||||
// btnSearchForIdentityNext
|
|
||||
//
|
|
||||
this.btnSearchForIdentityNext.Enabled = false; |
|
||||
this.btnSearchForIdentityNext.Location = new System.Drawing.Point(222, 45); |
|
||||
this.btnSearchForIdentityNext.Name = "btnSearchForIdentityNext"; |
|
||||
this.btnSearchForIdentityNext.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForIdentityNext.TabIndex = 7; |
|
||||
this.btnSearchForIdentityNext.Text = "Prev"; |
|
||||
this.btnSearchForIdentityNext.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForIdentityNext.Click += new System.EventHandler(this.btnSearchForIdentityNext_Click); |
|
||||
//
|
|
||||
// btnSearchForIdentityPrev
|
|
||||
//
|
|
||||
this.btnSearchForIdentityPrev.Enabled = false; |
|
||||
this.btnSearchForIdentityPrev.Location = new System.Drawing.Point(303, 45); |
|
||||
this.btnSearchForIdentityPrev.Name = "btnSearchForIdentityPrev"; |
|
||||
this.btnSearchForIdentityPrev.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForIdentityPrev.TabIndex = 6; |
|
||||
this.btnSearchForIdentityPrev.Text = "Next"; |
|
||||
this.btnSearchForIdentityPrev.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForIdentityPrev.Click += new System.EventHandler(this.btnSearchForIdentityPrev_Click); |
|
||||
//
|
|
||||
// txtSearchForIdentity
|
|
||||
//
|
|
||||
this.txtSearchForIdentity.Location = new System.Drawing.Point(3, 19); |
|
||||
this.txtSearchForIdentity.Name = "txtSearchForIdentity"; |
|
||||
this.txtSearchForIdentity.Size = new System.Drawing.Size(341, 20); |
|
||||
this.txtSearchForIdentity.TabIndex = 4; |
|
||||
//
|
|
||||
// btnSearchForIdentity
|
|
||||
//
|
|
||||
this.btnSearchForIdentity.Location = new System.Drawing.Point(350, 17); |
|
||||
this.btnSearchForIdentity.Name = "btnSearchForIdentity"; |
|
||||
this.btnSearchForIdentity.Size = new System.Drawing.Size(28, 23); |
|
||||
this.btnSearchForIdentity.TabIndex = 5; |
|
||||
this.btnSearchForIdentity.Text = "Go"; |
|
||||
this.btnSearchForIdentity.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForIdentity.Click += new System.EventHandler(this.btnSearchForIdentity_Click); |
|
||||
//
|
|
||||
// grpSearchForFolder
|
|
||||
//
|
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolderPrev); |
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolderNext); |
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolder); |
|
||||
this.grpSearchForFolder.Controls.Add(this.txtSearchForFolder); |
|
||||
this.grpSearchForFolder.Location = new System.Drawing.Point(6, 42); |
|
||||
this.grpSearchForFolder.Name = "grpSearchForFolder"; |
|
||||
this.grpSearchForFolder.Size = new System.Drawing.Size(387, 77); |
|
||||
this.grpSearchForFolder.TabIndex = 3; |
|
||||
this.grpSearchForFolder.TabStop = false; |
|
||||
this.grpSearchForFolder.Text = "Search for Folder"; |
|
||||
this.ttSearchForFolder.SetToolTip(this.grpSearchForFolder, "\"Search for folder\" lets you search in the tree view for the"); |
|
||||
//
|
|
||||
// btnSearchForFolderPrev
|
|
||||
//
|
|
||||
this.btnSearchForFolderPrev.Enabled = false; |
|
||||
this.btnSearchForFolderPrev.Location = new System.Drawing.Point(225, 45); |
|
||||
this.btnSearchForFolderPrev.Name = "btnSearchForFolderPrev"; |
|
||||
this.btnSearchForFolderPrev.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForFolderPrev.TabIndex = 3; |
|
||||
this.btnSearchForFolderPrev.Text = "Prev"; |
|
||||
this.btnSearchForFolderPrev.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolderPrev.Click += new System.EventHandler(this.btnSearchForFolderPrev_Click); |
|
||||
//
|
|
||||
// btnSearchForFolderNext
|
|
||||
//
|
|
||||
this.btnSearchForFolderNext.Enabled = false; |
|
||||
this.btnSearchForFolderNext.Location = new System.Drawing.Point(306, 45); |
|
||||
this.btnSearchForFolderNext.Name = "btnSearchForFolderNext"; |
|
||||
this.btnSearchForFolderNext.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForFolderNext.TabIndex = 2; |
|
||||
this.btnSearchForFolderNext.Text = "Next"; |
|
||||
this.btnSearchForFolderNext.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolderNext.Click += new System.EventHandler(this.btnSearchForFolderNext_Click); |
|
||||
//
|
|
||||
// btnSearchForFolder
|
|
||||
//
|
|
||||
this.btnSearchForFolder.Location = new System.Drawing.Point(353, 17); |
|
||||
this.btnSearchForFolder.Name = "btnSearchForFolder"; |
|
||||
this.btnSearchForFolder.Size = new System.Drawing.Size(28, 23); |
|
||||
this.btnSearchForFolder.TabIndex = 1; |
|
||||
this.btnSearchForFolder.Text = "Go"; |
|
||||
this.btnSearchForFolder.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolder.Click += new System.EventHandler(this.btnSearchForFolder_Click); |
|
||||
//
|
|
||||
// txtSearchForFolder
|
|
||||
//
|
|
||||
this.txtSearchForFolder.Location = new System.Drawing.Point(6, 19); |
|
||||
this.txtSearchForFolder.Name = "txtSearchForFolder"; |
|
||||
this.txtSearchForFolder.Size = new System.Drawing.Size(341, 20); |
|
||||
this.txtSearchForFolder.TabIndex = 0; |
|
||||
this.ttSearchForFolder.SetToolTip(this.txtSearchForFolder, "\"Search for folder\" lets you search in the tree view for the"); |
|
||||
//
|
|
||||
// labDirectoryTreeView
|
|
||||
//
|
|
||||
this.labDirectoryTreeView.AutoSize = true; |
|
||||
this.labDirectoryTreeView.Location = new System.Drawing.Point(13, 13); |
|
||||
this.labDirectoryTreeView.Name = "labDirectoryTreeView"; |
|
||||
this.labDirectoryTreeView.Size = new System.Drawing.Size(57, 13); |
|
||||
this.labDirectoryTreeView.TabIndex = 4; |
|
||||
this.labDirectoryTreeView.Text = "Directories"; |
|
||||
//
|
|
||||
// labAccessView
|
|
||||
//
|
|
||||
this.labAccessView.AutoSize = true; |
|
||||
this.labAccessView.Location = new System.Drawing.Point(344, 12); |
|
||||
this.labAccessView.Name = "labAccessView"; |
|
||||
this.labAccessView.Size = new System.Drawing.Size(202, 13); |
|
||||
this.labAccessView.TabIndex = 5; |
|
||||
this.labAccessView.Text = "Permissions given on the seletcted object"; |
|
||||
//
|
|
||||
// ttSearchForFolder
|
|
||||
//
|
|
||||
this.ttSearchForFolder.IsBalloon = true; |
|
||||
this.ttSearchForFolder.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info; |
|
||||
//
|
|
||||
// ShowSimpleAccessForm
|
|
||||
//
|
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
||||
this.ClientSize = new System.Drawing.Size(830, 615); |
|
||||
this.Controls.Add(this.labAccessView); |
|
||||
this.Controls.Add(this.labDirectoryTreeView); |
|
||||
this.Controls.Add(this.grpFilter); |
|
||||
this.Controls.Add(this.lstPermissions); |
|
||||
this.Controls.Add(this.trvDirectories); |
|
||||
this.Name = "ShowSimpleAccessForm"; |
|
||||
this.Text = "ShowAccess"; |
|
||||
this.grpFilter.ResumeLayout(false); |
|
||||
this.grpFilter.PerformLayout(); |
|
||||
this.grpSearchForIdentity.ResumeLayout(false); |
|
||||
this.grpSearchForIdentity.PerformLayout(); |
|
||||
this.grpSearchForFolder.ResumeLayout(false); |
|
||||
this.grpSearchForFolder.PerformLayout(); |
|
||||
this.ResumeLayout(false); |
|
||||
this.PerformLayout(); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
#endregion
|
|
||||
|
|
||||
private System.Windows.Forms.TreeView trvDirectories; |
|
||||
private System.Windows.Forms.ListView lstPermissions; |
|
||||
private System.Windows.Forms.ColumnHeader chdIdentity; |
|
||||
private System.Windows.Forms.ColumnHeader chdRights; |
|
||||
private System.Windows.Forms.ColumnHeader chdAccessControlType; |
|
||||
private System.Windows.Forms.ImageList imlIcons; |
|
||||
private System.Windows.Forms.CheckBox chkRemoveFoldersWithoutAccess; |
|
||||
private System.Windows.Forms.GroupBox grpFilter; |
|
||||
private System.Windows.Forms.Label labDirectoryTreeView; |
|
||||
private System.Windows.Forms.Label labAccessView; |
|
||||
private System.Windows.Forms.GroupBox grpSearchForFolder; |
|
||||
private System.Windows.Forms.Button btnSearchForFolder; |
|
||||
private System.Windows.Forms.TextBox txtSearchForFolder; |
|
||||
private System.Windows.Forms.Button btnSearchForFolderNext; |
|
||||
private System.Windows.Forms.Button btnSearchForFolderPrev; |
|
||||
private System.Windows.Forms.GroupBox grpSearchForIdentity; |
|
||||
private System.Windows.Forms.Button btnSearchForIdentityNext; |
|
||||
private System.Windows.Forms.Button btnSearchForIdentityPrev; |
|
||||
private System.Windows.Forms.TextBox txtSearchForIdentity; |
|
||||
private System.Windows.Forms.Button btnSearchForIdentity; |
|
||||
private System.Windows.Forms.ToolTip ttSearchForFolder; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,271 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.ComponentModel; |
|
||||
using System.Data; |
|
||||
using System.Drawing; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Windows.Forms; |
|
||||
using Alphaleonis.Win32.Filesystem; |
|
||||
using Security2; |
|
||||
|
|
||||
namespace NTFSSecurity |
|
||||
{ |
|
||||
public partial class ShowSimpleAccessForm : Form |
|
||||
{ |
|
||||
private IEnumerable<DirectoryInfo> directoryList; |
|
||||
private IQueryable<SimpleFileSystemAccessRule> aceList; |
|
||||
private IEnumerable<DirectoryTreeNode> searchResultByFolder; |
|
||||
private int searchResultByFolderIndex; |
|
||||
|
|
||||
public IEnumerable<DirectoryInfo> DirectoryList |
|
||||
{ |
|
||||
get { return directoryList; } |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<SimpleFileSystemAccessRule> AceList |
|
||||
{ |
|
||||
get { return aceList; } |
|
||||
} |
|
||||
|
|
||||
public ShowSimpleAccessForm() |
|
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
public void BuildDirectoryTreeNodes() |
|
||||
{ |
|
||||
string previousPath = string.Empty; |
|
||||
DirectoryTreeNode previousNode; |
|
||||
DirectoryTreeNode rootNode; |
|
||||
|
|
||||
var rootDirectory = directoryList.First(); |
|
||||
|
|
||||
rootNode = new DirectoryTreeNode(rootDirectory.FullName, rootDirectory.Name, aceList.Where(ace => ace.FullName == rootDirectory.Name)); |
|
||||
previousNode = rootNode; |
|
||||
trvDirectories.Nodes.Add(rootNode); |
|
||||
|
|
||||
foreach (var directory in directoryList.Skip(1)) |
|
||||
{ |
|
||||
if (previousNode.Name == directory.GetParent().FullName) |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
previousNode = (DirectoryTreeNode)trvDirectories.Nodes.Find(directory.GetParent().FullName, true).FirstOrDefault(); |
|
||||
if (previousNode != null) |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void BuildDirectoryTreeNodes(IEnumerable<DirectoryInfo> directoryList, IQueryable<SimpleFileSystemAccessRule> aceList) |
|
||||
{ |
|
||||
this.directoryList = directoryList; |
|
||||
this.aceList = aceList; |
|
||||
|
|
||||
this.BuildDirectoryTreeNodes(); |
|
||||
} |
|
||||
|
|
||||
private void trvDirectories_AfterSelect(object sender, TreeViewEventArgs e) |
|
||||
{ |
|
||||
lstPermissions.Items.Clear(); |
|
||||
|
|
||||
foreach (var ace in aceList.Where(ace => ace.FullName == e.Node.Name)) |
|
||||
{ |
|
||||
ListViewItem listItem = new ListViewItem(); |
|
||||
listItem.Name = e.Node.Name; |
|
||||
listItem.Text = ace.Identity.AccountName; |
|
||||
listItem.SubItems.AddRange(new string[] { ace.AccessRights.ToString(), ace.AccessControlType.ToString(), e.Node.FullPath }); |
|
||||
listItem.ImageIndex = 1; |
|
||||
|
|
||||
lstPermissions.Items.Add(listItem); |
|
||||
} |
|
||||
|
|
||||
if (lstPermissions.Items.Count > 0) |
|
||||
{ |
|
||||
foreach (ColumnHeader column in lstPermissions.Columns) |
|
||||
{ |
|
||||
column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void chkRemoveFoldersWithoutAccess_CheckedChanged(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (chkRemoveFoldersWithoutAccess.Checked) |
|
||||
{ |
|
||||
RemoveFoldersWithoutAccess((DirectoryTreeNode)trvDirectories.Nodes[0]); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
trvDirectories.Nodes.Clear(); |
|
||||
BuildDirectoryTreeNodes(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void RemoveFoldersWithoutAccess(DirectoryTreeNode node) |
|
||||
{ |
|
||||
for (int i = 0; i < node.Nodes.Count; i++) |
|
||||
{ |
|
||||
if (node.Nodes[i].GetNodeCount(false) > 0) |
|
||||
RemoveFoldersWithoutAccess((DirectoryTreeNode)node.Nodes[i]); |
|
||||
|
|
||||
if (node.Nodes[i].Nodes.Count == 0 & ((DirectoryTreeNode)node.Nodes[i]).Acl.Count() == 0) |
|
||||
{ |
|
||||
node.Nodes.Remove(node.Nodes[i]); |
|
||||
i--; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolder_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
searchResultByFolder = null; |
|
||||
searchResultByFolderIndex = 0; |
|
||||
trvDirectories.HideSelection = false; |
|
||||
|
|
||||
searchResultByFolder = FindNodeByFolder((DirectoryTreeNode)trvDirectories.Nodes[0], txtSearchForFolder.Text); |
|
||||
if (searchResultByFolder.Count() > 0) |
|
||||
{ |
|
||||
btnSearchForFolderNext.Enabled = true; |
|
||||
btnSearchForFolderPrev.Enabled = true; |
|
||||
|
|
||||
trvDirectories.SelectedNode = searchResultByFolder.First(); |
|
||||
searchResultByFolderIndex = 0; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
btnSearchForFolderNext.Enabled = false; |
|
||||
btnSearchForFolderPrev.Enabled = false; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private IEnumerable<DirectoryTreeNode> FindNodeByFolder(DirectoryTreeNode node, string search) |
|
||||
{ |
|
||||
if (node.Text.ToLower().Contains(search.ToLower())) |
|
||||
{ |
|
||||
yield return node; |
|
||||
} |
|
||||
|
|
||||
foreach (DirectoryTreeNode childNode in node.Nodes) |
|
||||
{ |
|
||||
foreach (DirectoryTreeNode match in this.FindNodeByFolder(childNode, search)) |
|
||||
{ |
|
||||
yield return match; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private IEnumerable<DirectoryTreeNode> FindNodeByIdentity(DirectoryTreeNode node, string search) |
|
||||
{ |
|
||||
if (node.Acl.Where(ace => ace.Identity.AccountName.ToLower().Contains(search.ToLower())).Count() > 0) |
|
||||
{ |
|
||||
yield return node; |
|
||||
} |
|
||||
|
|
||||
foreach (DirectoryTreeNode childNode in node.Nodes) |
|
||||
{ |
|
||||
foreach (DirectoryTreeNode match in this.FindNodeByIdentity(childNode, search)) |
|
||||
{ |
|
||||
yield return match; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolderNext_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolder.Count() > searchResultByFolderIndex + 1) |
|
||||
{ |
|
||||
searchResultByFolderIndex++; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolderPrev_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolderIndex - 1 > -1) |
|
||||
{ |
|
||||
searchResultByFolderIndex--; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForIdentity_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
trvDirectories.HideSelection = false; |
|
||||
searchResultByFolder = null; |
|
||||
searchResultByFolderIndex = 0; |
|
||||
|
|
||||
searchResultByFolder = FindNodeByIdentity((DirectoryTreeNode)trvDirectories.Nodes[0], txtSearchForIdentity.Text); |
|
||||
if (searchResultByFolder.Count() > 0) |
|
||||
{ |
|
||||
btnSearchForIdentityNext.Enabled = true; |
|
||||
btnSearchForIdentityPrev.Enabled = true; |
|
||||
|
|
||||
trvDirectories.SelectedNode = searchResultByFolder.First(); |
|
||||
searchResultByFolderIndex = 0; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
btnSearchForIdentityNext.Enabled = false; |
|
||||
btnSearchForIdentityPrev.Enabled = false; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForIdentityPrev_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolder.Count() > searchResultByFolderIndex + 1) |
|
||||
{ |
|
||||
searchResultByFolderIndex++; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForIdentityNext_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolderIndex - 1 > -1) |
|
||||
{ |
|
||||
searchResultByFolderIndex--; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public class DirectoryTreeNode : TreeNode |
|
||||
{ |
|
||||
private IList<SimpleFileSystemAccessRule> acl; |
|
||||
|
|
||||
public IList<SimpleFileSystemAccessRule> Acl |
|
||||
{ |
|
||||
get { return acl; } |
|
||||
} |
|
||||
|
|
||||
public DirectoryTreeNode(string key, string text) |
|
||||
: base(text) |
|
||||
{ |
|
||||
this.Name = key; |
|
||||
} |
|
||||
|
|
||||
public DirectoryTreeNode(string key, string text, IQueryable<SimpleFileSystemAccessRule> acl) |
|
||||
: this(key, text) |
|
||||
{ |
|
||||
this.acl = acl.ToList(); |
|
||||
|
|
||||
if (acl.Count() == 0) |
|
||||
{ |
|
||||
this.ForeColor = Color.Gray; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,168 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<root> |
|
||||
<!-- |
|
||||
Microsoft ResX Schema |
|
||||
|
|
||||
Version 2.0 |
|
||||
|
|
||||
The primary goals of this format is to allow a simple XML format |
|
||||
that is mostly human readable. The generation and parsing of the |
|
||||
various data types are done through the TypeConverter classes |
|
||||
associated with the data types. |
|
||||
|
|
||||
Example: |
|
||||
|
|
||||
... ado.net/XML headers & schema ... |
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|
||||
<resheader name="version">2.0</resheader> |
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|
||||
</data> |
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|
||||
<comment>This is a comment</comment> |
|
||||
</data> |
|
||||
|
|
||||
There are any number of "resheader" rows that contain simple |
|
||||
name/value pairs. |
|
||||
|
|
||||
Each data row contains a name, and value. The row also contains a |
|
||||
type or mimetype. Type corresponds to a .NET class that support |
|
||||
text/value conversion through the TypeConverter architecture. |
|
||||
Classes that don't support this are serialized and stored with the |
|
||||
mimetype set. |
|
||||
|
|
||||
The mimetype is used for serialized objects, and tells the |
|
||||
ResXResourceReader how to depersist the object. This is currently not |
|
||||
extensible. For a given mimetype the value must be set accordingly: |
|
||||
|
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
|
||||
that the ResXResourceWriter will generate, however the reader can |
|
||||
read any of the formats listed below. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
|
||||
value : The object must be serialized with |
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
|
||||
: and then encoded with base64 encoding. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
|
||||
value : The object must be serialized with |
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|
||||
: and then encoded with base64 encoding. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|
||||
value : The object must be serialized into a byte array |
|
||||
: using a System.ComponentModel.TypeConverter |
|
||||
: and then encoded with base64 encoding. |
|
||||
--> |
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
|
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:choice maxOccurs="unbounded"> |
|
||||
<xsd:element name="metadata"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
|
||||
<xsd:attribute name="type" type="xsd:string" /> |
|
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
|
||||
<xsd:attribute ref="xml:space" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="assembly"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:attribute name="alias" type="xsd:string" /> |
|
||||
<xsd:attribute name="name" type="xsd:string" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="data"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|
||||
<xsd:attribute ref="xml:space" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="resheader"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
</xsd:choice> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
</xsd:schema> |
|
||||
<resheader name="resmimetype"> |
|
||||
<value>text/microsoft-resx</value> |
|
||||
</resheader> |
|
||||
<resheader name="version"> |
|
||||
<value>2.0</value> |
|
||||
</resheader> |
|
||||
<resheader name="reader"> |
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
||||
</resheader> |
|
||||
<resheader name="writer"> |
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
||||
</resheader> |
|
||||
<metadata name="imlIcons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
|
||||
<value>17, 17</value> |
|
||||
</metadata> |
|
||||
<data name="imlIcons.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
||||
<value> |
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w |
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 |
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAs |
|
||||
CAAAAk1TRnQBSQFMAwEBAAGIAQABiAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA |
|
||||
AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA |
|
||||
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA |
|
||||
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm |
|
||||
AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ |
|
||||
AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwC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AAB/wHtAfQEeQFeAZkBXgJ5ARwBQwEHAf8wAAH/Ae0BwwN5AV4BmQFeAZkBXgF5AVgBQwEHAf8wAAH/ |
|
||||
Ae0B9AJ5AV0BmQFeAbwBXgGZAV4B9wFDAQcB/zAAAf8B7QHDAXoCeQFeAZkBXgGZAV4BeQFYAUMBBwH/ |
|
||||
MAAB/wHtAfQEeQFeAZkBXgJ5ARwBQwEHAf8wAAH/Ae0BwwOgAeUBGgHlARoB5QEaAXkBQwEHAf8wAAH/ |
|
||||
Ae0BGwGgAcMBGgGgARsEBwH3AewB8QH/MAAB/wG8ARwEeQH3AvABvALwAfMC/zAAAv8BvAHtAnMB7QHw |
|
||||
CP8wAAP/BPQJ/zAAEP8wAAFCAU0BPgcAAT4DAAEoAwABQAMAARADAAEBAQABAQUAAYAXAAP/gQAL |
|
||||
</value> |
|
||||
</data> |
|
||||
<metadata name="ttSearchForFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
|
||||
<value>114, 17</value> |
|
||||
</metadata> |
|
||||
</root> |
|
||||
@ -1,234 +0,0 @@ |
|||||
namespace NTFSSecurity |
|
||||
{ |
|
||||
partial class ShowSimpleEffectiveAccessForm |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// Required designer variable.
|
|
||||
/// </summary>
|
|
||||
private System.ComponentModel.IContainer components = null; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Clean up any resources being used.
|
|
||||
/// </summary>
|
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||
protected override void Dispose(bool disposing) |
|
||||
{ |
|
||||
if (disposing && (components != null)) |
|
||||
{ |
|
||||
components.Dispose(); |
|
||||
} |
|
||||
base.Dispose(disposing); |
|
||||
} |
|
||||
|
|
||||
#region Windows Form Designer generated code
|
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Required method for Designer support - do not modify
|
|
||||
/// the contents of this method with the code editor.
|
|
||||
/// </summary>
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
this.components = new System.ComponentModel.Container(); |
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShowSimpleEffectiveAccessForm)); |
|
||||
this.trvDirectories = new System.Windows.Forms.TreeView(); |
|
||||
this.imlIcons = new System.Windows.Forms.ImageList(this.components); |
|
||||
this.lstPermissions = new System.Windows.Forms.ListView(); |
|
||||
this.chdIdentity = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chdRights = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chdAccessControlType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); |
|
||||
this.chkRemoveFoldersWithoutAccess = new System.Windows.Forms.CheckBox(); |
|
||||
this.grpFilter = new System.Windows.Forms.GroupBox(); |
|
||||
this.grpSearchForFolder = new System.Windows.Forms.GroupBox(); |
|
||||
this.btnSearchForFolderPrev = new System.Windows.Forms.Button(); |
|
||||
this.btnSearchForFolderNext = new System.Windows.Forms.Button(); |
|
||||
this.btnSearchForFolder = new System.Windows.Forms.Button(); |
|
||||
this.txtSearchForFolder = new System.Windows.Forms.TextBox(); |
|
||||
this.labDirectoryTreeView = new System.Windows.Forms.Label(); |
|
||||
this.labAccessView = new System.Windows.Forms.Label(); |
|
||||
this.grpFilter.SuspendLayout(); |
|
||||
this.grpSearchForFolder.SuspendLayout(); |
|
||||
this.SuspendLayout(); |
|
||||
//
|
|
||||
// trvDirectories
|
|
||||
//
|
|
||||
this.trvDirectories.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
||||
| System.Windows.Forms.AnchorStyles.Left))); |
|
||||
this.trvDirectories.ImageIndex = 0; |
|
||||
this.trvDirectories.ImageList = this.imlIcons; |
|
||||
this.trvDirectories.Location = new System.Drawing.Point(12, 29); |
|
||||
this.trvDirectories.Name = "trvDirectories"; |
|
||||
this.trvDirectories.SelectedImageIndex = 0; |
|
||||
this.trvDirectories.Size = new System.Drawing.Size(320, 353); |
|
||||
this.trvDirectories.TabIndex = 0; |
|
||||
this.trvDirectories.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.trvDirectories_AfterSelect); |
|
||||
//
|
|
||||
// imlIcons
|
|
||||
//
|
|
||||
this.imlIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imlIcons.ImageStream"))); |
|
||||
this.imlIcons.TransparentColor = System.Drawing.Color.Transparent; |
|
||||
this.imlIcons.Images.SetKeyName(0, "container.jpg"); |
|
||||
//
|
|
||||
// lstPermissions
|
|
||||
//
|
|
||||
this.lstPermissions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
|
||||
| System.Windows.Forms.AnchorStyles.Left) |
|
||||
| System.Windows.Forms.AnchorStyles.Right))); |
|
||||
this.lstPermissions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { |
|
||||
this.chdIdentity, |
|
||||
this.chdRights, |
|
||||
this.chdAccessControlType}); |
|
||||
this.lstPermissions.Location = new System.Drawing.Point(338, 29); |
|
||||
this.lstPermissions.Name = "lstPermissions"; |
|
||||
this.lstPermissions.Size = new System.Drawing.Size(480, 226); |
|
||||
this.lstPermissions.SmallImageList = this.imlIcons; |
|
||||
this.lstPermissions.TabIndex = 1; |
|
||||
this.lstPermissions.UseCompatibleStateImageBehavior = false; |
|
||||
this.lstPermissions.View = System.Windows.Forms.View.Details; |
|
||||
//
|
|
||||
// chdIdentity
|
|
||||
//
|
|
||||
this.chdIdentity.Text = "Identity"; |
|
||||
//
|
|
||||
// chdRights
|
|
||||
//
|
|
||||
this.chdRights.Text = "Rights"; |
|
||||
//
|
|
||||
// chdAccessControlType
|
|
||||
//
|
|
||||
this.chdAccessControlType.Text = "AccessControlType"; |
|
||||
//
|
|
||||
// chkRemoveFoldersWithoutAccess
|
|
||||
//
|
|
||||
this.chkRemoveFoldersWithoutAccess.AutoSize = true; |
|
||||
this.chkRemoveFoldersWithoutAccess.Location = new System.Drawing.Point(6, 19); |
|
||||
this.chkRemoveFoldersWithoutAccess.Name = "chkRemoveFoldersWithoutAccess"; |
|
||||
this.chkRemoveFoldersWithoutAccess.Size = new System.Drawing.Size(347, 17); |
|
||||
this.chkRemoveFoldersWithoutAccess.TabIndex = 2; |
|
||||
this.chkRemoveFoldersWithoutAccess.Text = "Remove Folders that do not have different access than their parents"; |
|
||||
this.chkRemoveFoldersWithoutAccess.UseVisualStyleBackColor = true; |
|
||||
this.chkRemoveFoldersWithoutAccess.CheckedChanged += new System.EventHandler(this.chkRemoveFoldersWithoutAccess_CheckedChanged); |
|
||||
//
|
|
||||
// grpFilter
|
|
||||
//
|
|
||||
this.grpFilter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) |
|
||||
| System.Windows.Forms.AnchorStyles.Right))); |
|
||||
this.grpFilter.Controls.Add(this.grpSearchForFolder); |
|
||||
this.grpFilter.Controls.Add(this.chkRemoveFoldersWithoutAccess); |
|
||||
this.grpFilter.Location = new System.Drawing.Point(338, 258); |
|
||||
this.grpFilter.Name = "grpFilter"; |
|
||||
this.grpFilter.Size = new System.Drawing.Size(480, 124); |
|
||||
this.grpFilter.TabIndex = 3; |
|
||||
this.grpFilter.TabStop = false; |
|
||||
this.grpFilter.Text = "Filter"; |
|
||||
//
|
|
||||
// grpSearchForFolder
|
|
||||
//
|
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolderPrev); |
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolderNext); |
|
||||
this.grpSearchForFolder.Controls.Add(this.btnSearchForFolder); |
|
||||
this.grpSearchForFolder.Controls.Add(this.txtSearchForFolder); |
|
||||
this.grpSearchForFolder.Location = new System.Drawing.Point(6, 42); |
|
||||
this.grpSearchForFolder.Name = "grpSearchForFolder"; |
|
||||
this.grpSearchForFolder.Size = new System.Drawing.Size(421, 77); |
|
||||
this.grpSearchForFolder.TabIndex = 3; |
|
||||
this.grpSearchForFolder.TabStop = false; |
|
||||
this.grpSearchForFolder.Text = "Search for Folder"; |
|
||||
//
|
|
||||
// btnSearchForFolderPrev
|
|
||||
//
|
|
||||
this.btnSearchForFolderPrev.Enabled = false; |
|
||||
this.btnSearchForFolderPrev.Location = new System.Drawing.Point(240, 45); |
|
||||
this.btnSearchForFolderPrev.Name = "btnSearchForFolderPrev"; |
|
||||
this.btnSearchForFolderPrev.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForFolderPrev.TabIndex = 3; |
|
||||
this.btnSearchForFolderPrev.Text = "Prev"; |
|
||||
this.btnSearchForFolderPrev.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolderPrev.Click += new System.EventHandler(this.btnSearchForFolderPrev_Click); |
|
||||
//
|
|
||||
// btnSearchForFolderNext
|
|
||||
//
|
|
||||
this.btnSearchForFolderNext.Enabled = false; |
|
||||
this.btnSearchForFolderNext.Location = new System.Drawing.Point(321, 45); |
|
||||
this.btnSearchForFolderNext.Name = "btnSearchForFolderNext"; |
|
||||
this.btnSearchForFolderNext.Size = new System.Drawing.Size(75, 23); |
|
||||
this.btnSearchForFolderNext.TabIndex = 2; |
|
||||
this.btnSearchForFolderNext.Text = "Next"; |
|
||||
this.btnSearchForFolderNext.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolderNext.Click += new System.EventHandler(this.btnSearchForFolderNext_Click); |
|
||||
//
|
|
||||
// btnSearchForFolder
|
|
||||
//
|
|
||||
this.btnSearchForFolder.Location = new System.Drawing.Point(353, 17); |
|
||||
this.btnSearchForFolder.Name = "btnSearchForFolder"; |
|
||||
this.btnSearchForFolder.Size = new System.Drawing.Size(43, 23); |
|
||||
this.btnSearchForFolder.TabIndex = 1; |
|
||||
this.btnSearchForFolder.Text = "Go"; |
|
||||
this.btnSearchForFolder.UseVisualStyleBackColor = true; |
|
||||
this.btnSearchForFolder.Click += new System.EventHandler(this.btnSearchForFolder_Click); |
|
||||
//
|
|
||||
// txtSearchForFolder
|
|
||||
//
|
|
||||
this.txtSearchForFolder.Location = new System.Drawing.Point(6, 19); |
|
||||
this.txtSearchForFolder.Name = "txtSearchForFolder"; |
|
||||
this.txtSearchForFolder.Size = new System.Drawing.Size(341, 20); |
|
||||
this.txtSearchForFolder.TabIndex = 0; |
|
||||
//
|
|
||||
// labDirectoryTreeView
|
|
||||
//
|
|
||||
this.labDirectoryTreeView.AutoSize = true; |
|
||||
this.labDirectoryTreeView.Location = new System.Drawing.Point(13, 13); |
|
||||
this.labDirectoryTreeView.Name = "labDirectoryTreeView"; |
|
||||
this.labDirectoryTreeView.Size = new System.Drawing.Size(57, 13); |
|
||||
this.labDirectoryTreeView.TabIndex = 4; |
|
||||
this.labDirectoryTreeView.Text = "Directories"; |
|
||||
//
|
|
||||
// labAccessView
|
|
||||
//
|
|
||||
this.labAccessView.AutoSize = true; |
|
||||
this.labAccessView.Location = new System.Drawing.Point(344, 12); |
|
||||
this.labAccessView.Name = "labAccessView"; |
|
||||
this.labAccessView.Size = new System.Drawing.Size(202, 13); |
|
||||
this.labAccessView.TabIndex = 5; |
|
||||
this.labAccessView.Text = "Permissions given on the seletcted object"; |
|
||||
//
|
|
||||
// ShowSimpleEffectiveAccessForm
|
|
||||
//
|
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
|
||||
this.ClientSize = new System.Drawing.Size(830, 389); |
|
||||
this.Controls.Add(this.labAccessView); |
|
||||
this.Controls.Add(this.labDirectoryTreeView); |
|
||||
this.Controls.Add(this.grpFilter); |
|
||||
this.Controls.Add(this.lstPermissions); |
|
||||
this.Controls.Add(this.trvDirectories); |
|
||||
this.Name = "ShowSimpleEffectiveAccessForm"; |
|
||||
this.Text = "ShowAccess"; |
|
||||
this.grpFilter.ResumeLayout(false); |
|
||||
this.grpFilter.PerformLayout(); |
|
||||
this.grpSearchForFolder.ResumeLayout(false); |
|
||||
this.grpSearchForFolder.PerformLayout(); |
|
||||
this.ResumeLayout(false); |
|
||||
this.PerformLayout(); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
#endregion
|
|
||||
|
|
||||
private System.Windows.Forms.TreeView trvDirectories; |
|
||||
private System.Windows.Forms.ListView lstPermissions; |
|
||||
private System.Windows.Forms.ColumnHeader chdIdentity; |
|
||||
private System.Windows.Forms.ColumnHeader chdRights; |
|
||||
private System.Windows.Forms.ColumnHeader chdAccessControlType; |
|
||||
private System.Windows.Forms.ImageList imlIcons; |
|
||||
private System.Windows.Forms.CheckBox chkRemoveFoldersWithoutAccess; |
|
||||
private System.Windows.Forms.GroupBox grpFilter; |
|
||||
private System.Windows.Forms.Label labDirectoryTreeView; |
|
||||
private System.Windows.Forms.Label labAccessView; |
|
||||
private System.Windows.Forms.GroupBox grpSearchForFolder; |
|
||||
private System.Windows.Forms.Button btnSearchForFolder; |
|
||||
private System.Windows.Forms.TextBox txtSearchForFolder; |
|
||||
private System.Windows.Forms.Button btnSearchForFolderNext; |
|
||||
private System.Windows.Forms.Button btnSearchForFolderPrev; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,222 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.ComponentModel; |
|
||||
using System.Data; |
|
||||
using System.Drawing; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Windows.Forms; |
|
||||
using System.IO; |
|
||||
using Security2; |
|
||||
|
|
||||
namespace NTFSSecurity |
|
||||
{ |
|
||||
public partial class ShowSimpleEffectiveAccessForm : Form |
|
||||
{ |
|
||||
private IEnumerable<DirectoryInfo> directoryList; |
|
||||
private IQueryable<SimpleFileSystemAccessRule> aceList; |
|
||||
private IEnumerable<DirectoryTreeNode> searchResultByFolder; |
|
||||
private int searchResultByFolderIndex; |
|
||||
|
|
||||
public IEnumerable<DirectoryInfo> DirectoryList |
|
||||
{ |
|
||||
get { return directoryList; } |
|
||||
} |
|
||||
|
|
||||
public IEnumerable<SimpleFileSystemAccessRule> AceList |
|
||||
{ |
|
||||
get { return aceList; } |
|
||||
} |
|
||||
|
|
||||
public ShowSimpleEffectiveAccessForm() |
|
||||
{ |
|
||||
InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
public void BuildDirectoryTreeNodes() |
|
||||
{ |
|
||||
string previousPath = string.Empty; |
|
||||
DirectoryTreeNode previousNode; |
|
||||
DirectoryTreeNode rootNode; |
|
||||
|
|
||||
var rootDirectory = directoryList.First(); |
|
||||
|
|
||||
rootNode = new DirectoryTreeNode(rootDirectory.FullName, rootDirectory.Name, aceList.Where(ace => ace.FullName == rootDirectory.Name)); |
|
||||
previousNode = rootNode; |
|
||||
trvDirectories.Nodes.Add(rootNode); |
|
||||
|
|
||||
foreach (var directory in directoryList.Skip(1)) |
|
||||
{ |
|
||||
if (previousNode.Name == directory.GetParent().FullName) |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
previousNode = (DirectoryTreeNode)trvDirectories.Nodes.Find(directory.GetParent().FullName, true).FirstOrDefault(); |
|
||||
if (previousNode != null) |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
var node = new DirectoryTreeNode(directory.FullName, directory.Name, aceList.Where(ace => ace.FullName == directory.FullName)); |
|
||||
previousNode.Nodes.Add(node); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void BuildDirectoryTreeNodes(IEnumerable<DirectoryInfo> directoryList, IQueryable<SimpleFileSystemAccessRule> aceList) |
|
||||
{ |
|
||||
this.directoryList = directoryList; |
|
||||
this.aceList = aceList; |
|
||||
|
|
||||
this.BuildDirectoryTreeNodes(); |
|
||||
} |
|
||||
|
|
||||
private void trvDirectories_AfterSelect(object sender, TreeViewEventArgs e) |
|
||||
{ |
|
||||
lstPermissions.Items.Clear(); |
|
||||
|
|
||||
foreach (var ace in aceList.Where(ace => ace.FullName == e.Node.Name)) |
|
||||
{ |
|
||||
ListViewItem listItem = new ListViewItem(); |
|
||||
listItem.Name = e.Node.Name; |
|
||||
listItem.Text = ace.Identity.AccountName; |
|
||||
listItem.SubItems.AddRange(new string[] { ace.AccessRights.ToString(), ace.AccessControlType.ToString(), e.Node.FullPath }); |
|
||||
listItem.ImageIndex = 1; |
|
||||
|
|
||||
lstPermissions.Items.Add(listItem); |
|
||||
} |
|
||||
|
|
||||
if (lstPermissions.Items.Count > 0) |
|
||||
{ |
|
||||
foreach (ColumnHeader column in lstPermissions.Columns) |
|
||||
{ |
|
||||
column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void chkRemoveFoldersWithoutAccess_CheckedChanged(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (chkRemoveFoldersWithoutAccess.Checked) |
|
||||
{ |
|
||||
RemoveFoldersWithoutAccess((DirectoryTreeNode)trvDirectories.Nodes[0]); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
trvDirectories.Nodes.Clear(); |
|
||||
BuildDirectoryTreeNodes(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void RemoveFoldersWithoutAccess(DirectoryTreeNode node) |
|
||||
{ |
|
||||
for (int i = 0; i < node.Nodes.Count; i++) |
|
||||
{ |
|
||||
if (node.Nodes[i].GetNodeCount(false) > 0) |
|
||||
RemoveFoldersWithoutAccess((DirectoryTreeNode)node.Nodes[i]); |
|
||||
|
|
||||
if (node.Nodes[i].Nodes.Count == 0 & ((DirectoryTreeNode)node.Nodes[i]).Acl.Count() == 0) |
|
||||
{ |
|
||||
node.Nodes.Remove(node.Nodes[i]); |
|
||||
i--; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolder_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
searchResultByFolder = null; |
|
||||
searchResultByFolderIndex = 0; |
|
||||
trvDirectories.HideSelection = false; |
|
||||
|
|
||||
searchResultByFolder = FindNodeByFolder((DirectoryTreeNode)trvDirectories.Nodes[0], txtSearchForFolder.Text); |
|
||||
if (searchResultByFolder.Count() > 0) |
|
||||
{ |
|
||||
btnSearchForFolderNext.Enabled = true; |
|
||||
btnSearchForFolderPrev.Enabled = true; |
|
||||
|
|
||||
trvDirectories.SelectedNode = searchResultByFolder.First(); |
|
||||
searchResultByFolderIndex = 0; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
btnSearchForFolderNext.Enabled = false; |
|
||||
btnSearchForFolderPrev.Enabled = false; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private IEnumerable<DirectoryTreeNode> FindNodeByFolder(DirectoryTreeNode node, string search) |
|
||||
{ |
|
||||
if (node.Text.ToLower().Contains(search.ToLower())) |
|
||||
{ |
|
||||
yield return node; |
|
||||
} |
|
||||
|
|
||||
foreach (DirectoryTreeNode childNode in node.Nodes) |
|
||||
{ |
|
||||
foreach (DirectoryTreeNode match in this.FindNodeByFolder(childNode, search)) |
|
||||
{ |
|
||||
yield return match; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private IEnumerable<DirectoryTreeNode> FindNodeByIdentity(DirectoryTreeNode node, string search) |
|
||||
{ |
|
||||
if (node.Acl.Where(ace => ace.Identity.AccountName.ToLower().Contains(search.ToLower())).Count() > 0) |
|
||||
{ |
|
||||
yield return node; |
|
||||
} |
|
||||
|
|
||||
foreach (DirectoryTreeNode childNode in node.Nodes) |
|
||||
{ |
|
||||
foreach (DirectoryTreeNode match in this.FindNodeByIdentity(childNode, search)) |
|
||||
{ |
|
||||
yield return match; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolderNext_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolder.Count() > searchResultByFolderIndex + 1) |
|
||||
{ |
|
||||
searchResultByFolderIndex++; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForFolderPrev_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolderIndex - 1 > -1) |
|
||||
{ |
|
||||
searchResultByFolderIndex--; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForIdentityPrev_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolder.Count() > searchResultByFolderIndex + 1) |
|
||||
{ |
|
||||
searchResultByFolderIndex++; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void btnSearchForIdentityNext_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (searchResultByFolderIndex - 1 > -1) |
|
||||
{ |
|
||||
searchResultByFolderIndex--; |
|
||||
trvDirectories.SelectedNode = searchResultByFolder.ElementAt(searchResultByFolderIndex); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,165 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<root> |
|
||||
<!-- |
|
||||
Microsoft ResX Schema |
|
||||
|
|
||||
Version 2.0 |
|
||||
|
|
||||
The primary goals of this format is to allow a simple XML format |
|
||||
that is mostly human readable. The generation and parsing of the |
|
||||
various data types are done through the TypeConverter classes |
|
||||
associated with the data types. |
|
||||
|
|
||||
Example: |
|
||||
|
|
||||
... ado.net/XML headers & schema ... |
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
|
||||
<resheader name="version">2.0</resheader> |
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
|
||||
</data> |
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
|
||||
<comment>This is a comment</comment> |
|
||||
</data> |
|
||||
|
|
||||
There are any number of "resheader" rows that contain simple |
|
||||
name/value pairs. |
|
||||
|
|
||||
Each data row contains a name, and value. The row also contains a |
|
||||
type or mimetype. Type corresponds to a .NET class that support |
|
||||
text/value conversion through the TypeConverter architecture. |
|
||||
Classes that don't support this are serialized and stored with the |
|
||||
mimetype set. |
|
||||
|
|
||||
The mimetype is used for serialized objects, and tells the |
|
||||
ResXResourceReader how to depersist the object. This is currently not |
|
||||
extensible. For a given mimetype the value must be set accordingly: |
|
||||
|
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
|
||||
that the ResXResourceWriter will generate, however the reader can |
|
||||
read any of the formats listed below. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
|
||||
value : The object must be serialized with |
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
|
||||
: and then encoded with base64 encoding. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
|
||||
value : The object must be serialized with |
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
|
||||
: and then encoded with base64 encoding. |
|
||||
|
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
|
||||
value : The object must be serialized into a byte array |
|
||||
: using a System.ComponentModel.TypeConverter |
|
||||
: and then encoded with base64 encoding. |
|
||||
--> |
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
|
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:choice maxOccurs="unbounded"> |
|
||||
<xsd:element name="metadata"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
|
||||
<xsd:attribute name="type" type="xsd:string" /> |
|
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
|
||||
<xsd:attribute ref="xml:space" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="assembly"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:attribute name="alias" type="xsd:string" /> |
|
||||
<xsd:attribute name="name" type="xsd:string" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="data"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
|
||||
<xsd:attribute ref="xml:space" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
<xsd:element name="resheader"> |
|
||||
<xsd:complexType> |
|
||||
<xsd:sequence> |
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
|
||||
</xsd:sequence> |
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
</xsd:choice> |
|
||||
</xsd:complexType> |
|
||||
</xsd:element> |
|
||||
</xsd:schema> |
|
||||
<resheader name="resmimetype"> |
|
||||
<value>text/microsoft-resx</value> |
|
||||
</resheader> |
|
||||
<resheader name="version"> |
|
||||
<value>2.0</value> |
|
||||
</resheader> |
|
||||
<resheader name="reader"> |
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
||||
</resheader> |
|
||||
<resheader name="writer"> |
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
|
||||
</resheader> |
|
||||
<metadata name="imlIcons.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
|
||||
<value>17, 17</value> |
|
||||
</metadata> |
|
||||
<data name="imlIcons.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> |
|
||||
<value> |
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w |
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 |
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAs |
|
||||
CAAAAk1TRnQBSQFMAwEBAAGQAQABkAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA |
|
||||
AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA |
|
||||
AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA |
|
||||
AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm |
|
||||
AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ |
|
||||
AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm |
|
||||
AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz |
|
||||
AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm |
|
||||
AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm |
|
||||
AQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMCzAEA |
|
||||
ATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMBAAFm |
|
||||
AQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkBAAFm |
|
||||
ATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZk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