From 67b0c7ac0b93248951e4e25ea5186545c352388d Mon Sep 17 00:00:00 2001 From: Lex Li Date: Mon, 7 Apr 2025 01:32:28 -0700 Subject: [PATCH 1/7] Fixed initial state for navigation actions. --- JexusManager/MainForm.Designer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/JexusManager/MainForm.Designer.cs b/JexusManager/MainForm.Designer.cs index e2e0da48..4aad8d78 100644 --- a/JexusManager/MainForm.Designer.cs +++ b/JexusManager/MainForm.Designer.cs @@ -1111,6 +1111,7 @@ private void InitializeComponent() // // actBack // + actBack.Enabled = false; actBack.Image = Main.Properties.Resources.back_16; actBack.ShortcutKeys = Keys.Alt | Keys.Left; actBack.Text = "Back"; @@ -1118,6 +1119,7 @@ private void InitializeComponent() // // actForward // + actForward.Enabled = false; actForward.Image = Main.Properties.Resources.forward_16; actForward.ShortcutKeys = Keys.Alt | Keys.Right; actForward.Text = "Forward"; From bbd04dda64ca2fb5528d9488406ffacf57d9c446 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Mon, 7 Apr 2025 04:51:38 -0400 Subject: [PATCH 2/7] Enabled column click and grouping. --- .../AuthenticationPage.Designer.cs | 5 +- .../AuthenticationPage.cs | 19 +++ .../AuthorizationPage.cs | 2 + .../CachingFeature.cs | 23 ++- .../CachingPage.Designer.cs | 7 +- JexusManager.Features.Caching/CachingPage.cs | 16 +- .../CertificatesFeature.cs | 22 ++- .../CertificatesPage.Designer.cs | 5 +- .../CertificatesPage.cs | 8 + .../DefaultDocumentPage.Designer.cs | 146 +----------------- .../DefaultDocumentPage.cs | 5 +- JexusManager.Features.FastCgi/FastCgiPage.cs | 2 + .../HandlersFeature.cs | 35 ++++- .../HandlersPage.Designer.cs | 7 +- .../HandlersPage.cs | 10 +- JexusManager.Features.HttpApi/HttpApiPage.cs | 4 + .../HttpErrorsFeature.cs | 18 +++ .../HttpErrorsPage.Designer.cs | 5 +- .../HttpErrorsPage.cs | 8 + .../IpSecurityFeature.cs | 18 +++ .../IpSecurityPage.Designer.cs | 7 +- .../IpSecurityPage.cs | 8 + .../IsapiCgiRestrictionFeature.cs | 16 ++ .../IsapiCgiRestrictionPage.Designer.cs | 7 +- .../IsapiCgiRestrictionPage.cs | 8 + .../IsapiFiltersFeature.cs | 16 ++ .../IsapiFiltersPage.Designer.cs | 7 +- .../IsapiFiltersPage.cs | 10 +- .../MimeMapFeature.cs | 18 +++ .../MimeMapPage.Designer.cs | 7 +- JexusManager.Features.MimeMap/MimeMapPage.cs | 8 + .../ModulesFeature.cs | 18 +++ .../ModulesPage.Designer.cs | 7 +- JexusManager.Features.Modules/ModulesPage.cs | 8 + .../RequestFilteringPage.cs | 7 + .../ResponseHeadersFeature.cs | 16 ++ .../ResponseHeadersPage.Designer.cs | 7 +- .../ResponseHeadersPage.cs | 8 + .../Inbound/AllowedVariablesFeature.cs | 16 ++ .../Inbound/MapsPage.cs | 2 + .../Inbound/ServerVariablesPage.Designer.cs | 5 +- .../Inbound/ServerVariablesPage.cs | 10 +- .../Outbound/CustomTagsPage.cs | 2 +- .../Outbound/PreConditionsPage.cs | 2 +- .../RewriteFeature.cs | 5 + JexusManager.Features.Rewrite/RewritePage.cs | 8 +- .../TraceFailedRequestsFeature.cs | 17 ++ .../TraceFailedRequestsPage.Designer.cs | 7 +- .../TraceFailedRequestsPage.cs | 9 ++ JexusManager.Shared/ColumnClickHook.cs | 146 ++++++++++++++++++ JexusManager.Shared/DialogHelper.cs | 39 +++++ JexusManager.Shared/Features/FeatureBase.cs | 19 ++- .../Features/Main/ApplicationPoolsFeature.cs | 23 +++ .../Main/ApplicationPoolsPage.Designer.cs | 5 +- .../Features/Main/ApplicationPoolsPage.cs | 10 +- .../Features/Main/ApplicationsFeature.cs | 21 +++ .../Main/ApplicationsPage.Designer.cs | 5 +- .../Features/Main/ApplicationsPage.cs | 8 + JexusManager/Features/Main/SitesFeature.cs | 30 ++++ .../Features/Main/SitesPage.Designer.cs | 7 +- JexusManager/Features/Main/SitesPage.cs | 10 +- .../Main/VirtualDirectoriesPage.Designer.cs | 133 +++------------- .../Features/Main/VirtualDirectoriesPage.cs | 19 +-- 63 files changed, 730 insertions(+), 376 deletions(-) create mode 100644 JexusManager.Shared/ColumnClickHook.cs diff --git a/JexusManager.Features.Authentication/AuthenticationPage.Designer.cs b/JexusManager.Features.Authentication/AuthenticationPage.Designer.cs index 94144cbd..c68b5994 100644 --- a/JexusManager.Features.Authentication/AuthenticationPage.Designer.cs +++ b/JexusManager.Features.Authentication/AuthenticationPage.Designer.cs @@ -166,10 +166,11 @@ private void InitializeComponent() this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbGroup.Items.AddRange(new object[] { "No Grouping", - "Category", - "Area"}); + "Response Type", + "Status"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label3 // diff --git a/JexusManager.Features.Authentication/AuthenticationPage.cs b/JexusManager.Features.Authentication/AuthenticationPage.cs index 3639b8a2..2631c413 100644 --- a/JexusManager.Features.Authentication/AuthenticationPage.cs +++ b/JexusManager.Features.Authentication/AuthenticationPage.cs @@ -151,6 +151,8 @@ protected override void InitializeListPage() extra = item.Feature.GetTaskList(); } + new ColumnClickHook().HandleColumnClick(listView1); + Tasks.Fill(tsActionPanel, cmsActionPanel, extra); } @@ -178,6 +180,23 @@ private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) } } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), (item, selectedGroup) => + { + // Determine the group key based on the selected grouping option + switch (selectedGroup) + { + case "Response Type": + return item.SubItems[2].Text; + case "Status": + return item.SubItems[1].Text; + default: + return "Unknown"; + } + }); + } + protected override TaskListCollection Tasks { get diff --git a/JexusManager.Features.Authorization/AuthorizationPage.cs b/JexusManager.Features.Authorization/AuthorizationPage.cs index 00ee7c2e..449b72f3 100644 --- a/JexusManager.Features.Authorization/AuthorizationPage.cs +++ b/JexusManager.Features.Authorization/AuthorizationPage.cs @@ -86,6 +86,8 @@ protected override void InitializeListPage() listView1.Items.Add(new AuthorizationListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { this.Refresh(); diff --git a/JexusManager.Features.Caching/CachingFeature.cs b/JexusManager.Features.Caching/CachingFeature.cs index 99a38bf7..ccfeb5f3 100644 --- a/JexusManager.Features.Caching/CachingFeature.cs +++ b/JexusManager.Features.Caching/CachingFeature.cs @@ -146,7 +146,12 @@ public void Remove() public void Edit() { - using var dialog = new NewCachingDialog(Module, SelectedItem, this); + DoubleClick(SelectedItem); + } + + protected override void DoubleClick(CachingItem item) + { + using var dialog = new NewCachingDialog(Module, item, this); if (dialog.ShowDialog() != DialogResult.OK) { return; @@ -155,6 +160,22 @@ public void Edit() EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[3].Text; + default: + return "Unknown"; + } + } + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { var section = service.GetSection("system.webServer/caching"); diff --git a/JexusManager.Features.Caching/CachingPage.Designer.cs b/JexusManager.Features.Caching/CachingPage.Designer.cs index 43442316..e748adf8 100644 --- a/JexusManager.Features.Caching/CachingPage.Designer.cs +++ b/JexusManager.Features.Caching/CachingPage.Designer.cs @@ -159,14 +159,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroupSelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.Caching/CachingPage.cs b/JexusManager.Features.Caching/CachingPage.cs index b29f5939..e4bf63b2 100644 --- a/JexusManager.Features.Caching/CachingPage.cs +++ b/JexusManager.Features.Caching/CachingPage.cs @@ -94,6 +94,9 @@ protected override void InitializeListPage() listView1.Items.Add(new CachingListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -130,13 +133,18 @@ private void ListView1MouseDoubleClick(object sender, MouseEventArgs e) private void ListView1SelectedIndexChanged(object sender, EventArgs e) { - _feature.SelectedItem = listView1.SelectedItems.Count > 0 - ? ((CachingListViewItem)listView1.SelectedItems[0]).Item - : null; - // TODO: optimize refresh when null to not null (vice versa) + _feature.HandleSelectedIndexChanged(listView1); Refresh(); } + private void CbGroupSelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping( + listView1, + cbGroup.SelectedItem.ToString(), + _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.Certificates/CertificatesFeature.cs b/JexusManager.Features.Certificates/CertificatesFeature.cs index d4a03639..49ee89b2 100644 --- a/JexusManager.Features.Certificates/CertificatesFeature.cs +++ b/JexusManager.Features.Certificates/CertificatesFeature.cs @@ -281,8 +281,6 @@ public void Load() OnCertificatesSettingsSaved(); } - public List Items { get; set; } - public void Import() { using (var dialog = new ImportCertificateDialog(Module, this)) @@ -433,6 +431,26 @@ protected override void DoubleClick(CertificatesItem item) DialogHelper.DisplayCertificate(item.Item, IntPtr.Zero); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Expiration Date", "Issued By", "Certificate Store"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Expiration Date": + return item.SubItems[3].Text; + case "Issued By": + return item.SubItems[2].Text; + case "Certificate Store": + return item.SubItems[5].Text; + default: + return "Unknown"; + } + } + private void Trust() { var cert = SelectedItem.Item; diff --git a/JexusManager.Features.Certificates/CertificatesPage.Designer.cs b/JexusManager.Features.Certificates/CertificatesPage.Designer.cs index 213cd3a7..40cace3d 100644 --- a/JexusManager.Features.Certificates/CertificatesPage.Designer.cs +++ b/JexusManager.Features.Certificates/CertificatesPage.Designer.cs @@ -229,12 +229,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Category", - "Area"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.Certificates/CertificatesPage.cs b/JexusManager.Features.Certificates/CertificatesPage.cs index 77eea0fc..a764dc1f 100644 --- a/JexusManager.Features.Certificates/CertificatesPage.cs +++ b/JexusManager.Features.Certificates/CertificatesPage.cs @@ -81,6 +81,9 @@ protected override void InitializeListPage() listView1.Items.Add(new CertificatesListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -121,6 +124,11 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.DefaultDocument/DefaultDocumentPage.Designer.cs b/JexusManager.Features.DefaultDocument/DefaultDocumentPage.Designer.cs index 31ce453f..c5c9d45c 100644 --- a/JexusManager.Features.DefaultDocument/DefaultDocumentPage.Designer.cs +++ b/JexusManager.Features.DefaultDocument/DefaultDocumentPage.Designer.cs @@ -39,20 +39,6 @@ private void InitializeComponent() this.listView1 = new System.Windows.Forms.ListView(); this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.toolStrip2 = new System.Windows.Forms.ToolStrip(); - this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); - this.cbFilter = new System.Windows.Forms.ToolStripComboBox(); - this.btnGo = new System.Windows.Forms.ToolStripSplitButton(); - this.protocolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.btnShowAll = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel(); - this.cbGroup = new System.Windows.Forms.ToolStripComboBox(); - this.btnView = new System.Windows.Forms.ToolStripSplitButton(); - this.detailsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.iconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.tilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.listToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); @@ -65,7 +51,6 @@ private void InitializeComponent() this.splitContainer1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.panel2.SuspendLayout(); - this.toolStrip2.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -112,7 +97,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel2.Controls.Add(this.listView1); - this.panel2.Controls.Add(this.toolStrip2); this.panel2.Controls.Add(this.label2); this.panel2.Location = new System.Drawing.Point(10, 50); this.panel2.Name = "panel2"; @@ -127,11 +111,11 @@ private void InitializeComponent() this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.FullRowSelect = true; this.listView1.HideSelection = false; - this.listView1.Location = new System.Drawing.Point(0, 38); + this.listView1.Location = new System.Drawing.Point(0, 13); this.listView1.Margin = new System.Windows.Forms.Padding(5); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(560, 502); + this.listView1.Size = new System.Drawing.Size(560, 527); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; @@ -149,116 +133,6 @@ private void InitializeComponent() this.chType.Text = "Entry Type"; this.chType.Width = 80; // - // toolStrip2 - // - this.toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripLabel2, - this.cbFilter, - this.btnGo, - this.btnShowAll, - this.toolStripSeparator4, - this.toolStripLabel3, - this.cbGroup, - this.btnView}); - this.toolStrip2.Location = new System.Drawing.Point(0, 13); - this.toolStrip2.Name = "toolStrip2"; - this.toolStrip2.Size = new System.Drawing.Size(560, 25); - this.toolStrip2.TabIndex = 3; - this.toolStrip2.Text = "toolStrip2"; - // - // toolStripLabel2 - // - this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(36, 22); - this.toolStripLabel2.Text = "Filter:"; - // - // cbFilter - // - this.cbFilter.Name = "cbFilter"; - this.cbFilter.Size = new System.Drawing.Size(121, 25); - // - // btnGo - // - this.btnGo.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.protocolToolStripMenuItem}); - this.btnGo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnGo.Name = "btnGo"; - this.btnGo.Size = new System.Drawing.Size(54, 22); - this.btnGo.Text = "Go"; - this.btnGo.ToolTipText = "Go"; - // - // protocolToolStripMenuItem - // - this.protocolToolStripMenuItem.Name = "protocolToolStripMenuItem"; - this.protocolToolStripMenuItem.Size = new System.Drawing.Size(88, 22); - this.protocolToolStripMenuItem.Text = "All"; - // - // btnShowAll - // - this.btnShowAll.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnShowAll.Name = "btnShowAll"; - this.btnShowAll.Size = new System.Drawing.Size(73, 22); - this.btnShowAll.Text = "Show All"; - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25); - // - // toolStripLabel3 - // - this.toolStripLabel3.Name = "toolStripLabel3"; - this.toolStripLabel3.Size = new System.Drawing.Size(59, 22); - this.toolStripLabel3.Text = "Group by:"; - // - // cbGroup - // - this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Category", - "Area"}); - this.cbGroup.Name = "cbGroup"; - this.cbGroup.Size = new System.Drawing.Size(121, 25); - // - // btnView - // - this.btnView.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.btnView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.detailsToolStripMenuItem, - this.iconsToolStripMenuItem, - this.tilesToolStripMenuItem, - this.listToolStripMenuItem}); - this.btnView.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnView.Name = "btnView"; - this.btnView.Size = new System.Drawing.Size(32, 22); - this.btnView.Text = "toolStripButton1"; - // - // detailsToolStripMenuItem - // - this.detailsToolStripMenuItem.Name = "detailsToolStripMenuItem"; - this.detailsToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.detailsToolStripMenuItem.Text = "Details"; - // - // iconsToolStripMenuItem - // - this.iconsToolStripMenuItem.Name = "iconsToolStripMenuItem"; - this.iconsToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.iconsToolStripMenuItem.Text = "Icons"; - // - // tilesToolStripMenuItem - // - this.tilesToolStripMenuItem.Name = "tilesToolStripMenuItem"; - this.tilesToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.tilesToolStripMenuItem.Text = "Tiles"; - // - // listToolStripMenuItem - // - this.listToolStripMenuItem.Name = "listToolStripMenuItem"; - this.listToolStripMenuItem.Size = new System.Drawing.Size(109, 22); - this.listToolStripMenuItem.Text = "List"; - // // label2 // this.label2.AutoSize = true; @@ -344,8 +218,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); - this.toolStrip2.ResumeLayout(false); - this.toolStrip2.PerformLayout(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.panel1.ResumeLayout(false); @@ -368,20 +240,6 @@ private void InitializeComponent() private Label label3; private PictureBox pictureBox1; private Panel panel2; - private ToolStrip toolStrip2; - private ToolStripLabel toolStripLabel2; - private ToolStripComboBox cbFilter; - private ToolStripSplitButton btnGo; - private ToolStripMenuItem protocolToolStripMenuItem; - private ToolStripButton btnShowAll; - private ToolStripSeparator toolStripSeparator4; - private ToolStripLabel toolStripLabel3; - private ToolStripComboBox cbGroup; - private ToolStripSplitButton btnView; - private ToolStripMenuItem detailsToolStripMenuItem; - private ToolStripMenuItem iconsToolStripMenuItem; - private ToolStripMenuItem tilesToolStripMenuItem; - private ToolStripMenuItem listToolStripMenuItem; private ContextMenuStrip cmsActionPanel; } } diff --git a/JexusManager.Features.DefaultDocument/DefaultDocumentPage.cs b/JexusManager.Features.DefaultDocument/DefaultDocumentPage.cs index 0fd3099b..991e59e7 100644 --- a/JexusManager.Features.DefaultDocument/DefaultDocumentPage.cs +++ b/JexusManager.Features.DefaultDocument/DefaultDocumentPage.cs @@ -53,9 +53,6 @@ public DefaultDocumentListViewItem(DocumentItem item, DefaultDocumentPage page) public DefaultDocumentPage() { InitializeComponent(); - btnView.Image = DefaultTaskList.ViewImage; - btnGo.Image = DefaultTaskList.GoImage; - btnShowAll.Image = DefaultTaskList.ShowAllImage; } protected override void Initialize(object navigationData) @@ -77,6 +74,8 @@ protected override void InitializeListPage() listView1.Items.Add(new DefaultDocumentListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem != null) { foreach (DefaultDocumentListViewItem item in listView1.Items) diff --git a/JexusManager.Features.FastCgi/FastCgiPage.cs b/JexusManager.Features.FastCgi/FastCgiPage.cs index 66bb7e00..b5b256e4 100644 --- a/JexusManager.Features.FastCgi/FastCgiPage.cs +++ b/JexusManager.Features.FastCgi/FastCgiPage.cs @@ -75,6 +75,8 @@ protected override void InitializeListPage() listView1.Items.Add(new FastCgiListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { Refresh(); diff --git a/JexusManager.Features.Handlers/HandlersFeature.cs b/JexusManager.Features.Handlers/HandlersFeature.cs index 982f1924..0850b6a5 100644 --- a/JexusManager.Features.Handlers/HandlersFeature.cs +++ b/JexusManager.Features.Handlers/HandlersFeature.cs @@ -265,12 +265,17 @@ public void Remove() } public void Edit() + { + DoubleClick(SelectedItem); + } + + protected override void DoubleClick(HandlersItem item) { HandlersItem newItem; - if (!string.IsNullOrWhiteSpace(SelectedItem.Type)) + if (!string.IsNullOrWhiteSpace(item.Type)) { - using var dialog = new NewHandlerDialog(Module, SelectedItem, this); + using var dialog = new NewHandlerDialog(Module, item, this); if (dialog.ShowDialog() != DialogResult.OK) { return; @@ -278,9 +283,9 @@ public void Edit() newItem = dialog.Item; } - else if (SelectedItem.Modules == "IsapiModule" && !string.IsNullOrWhiteSpace(SelectedItem.ScriptProcessor)) + else if (SelectedItem.Modules == "IsapiModule" && !string.IsNullOrWhiteSpace(item.ScriptProcessor)) { - using var dialog = new NewScriptMapDialog(Module, SelectedItem, this); + using var dialog = new NewScriptMapDialog(Module, item, this); if (dialog.ShowDialog() != DialogResult.OK) { return; @@ -290,7 +295,7 @@ public void Edit() } else { - using var dialog = new NewMappingDialog(Module, SelectedItem, this); + using var dialog = new NewMappingDialog(Module, item, this); if (dialog.ShowDialog() != DialogResult.OK) { return; @@ -302,6 +307,26 @@ public void Edit() EditItem(newItem); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type", "Path Type", "State"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[5].Text; + case "Path Type": + return item.SubItems[3].Text; + case "State": + return item.SubItems[2].Text; + default: + return "Unknown"; + } + } + public void Rename() { RenameInline(SelectedItem); diff --git a/JexusManager.Features.Handlers/HandlersPage.Designer.cs b/JexusManager.Features.Handlers/HandlersPage.Designer.cs index af4aaa6f..8fe88a38 100644 --- a/JexusManager.Features.Handlers/HandlersPage.Designer.cs +++ b/JexusManager.Features.Handlers/HandlersPage.Designer.cs @@ -178,14 +178,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroupSelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.Handlers/HandlersPage.cs b/JexusManager.Features.Handlers/HandlersPage.cs index fc32a77a..01578600 100644 --- a/JexusManager.Features.Handlers/HandlersPage.cs +++ b/JexusManager.Features.Handlers/HandlersPage.cs @@ -70,7 +70,7 @@ protected override void Initialize(object navigationData) _feature.HandlersSettingsUpdated = InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); @@ -97,6 +97,9 @@ protected override void InitializeListPage() listView1.Items.Add(new HandlersListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { this.Refresh(); @@ -137,6 +140,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroupSelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.HttpApi/HttpApiPage.cs b/JexusManager.Features.HttpApi/HttpApiPage.cs index 96c034d9..b3771e58 100644 --- a/JexusManager.Features.HttpApi/HttpApiPage.cs +++ b/JexusManager.Features.HttpApi/HttpApiPage.cs @@ -140,17 +140,21 @@ protected override void Initialize(object navigationData) var ip = new IpMappingFeature(Module); ip.HttpApiSettingsUpdate = RefreshIp; ip.Load(); + ip.InitializeColumnClick(lvIP); + // TODO: add grouping? tpIP.Tag = ip; RefreshIp(); var sni = new SniMappingFeature(Module); sni.HttpApiSettingsUpdate = RefreshSni; sni.Load(); + sni.InitializeColumnClick(lvSni); tpSNI.Tag = sni; var url = new ReservedUrlsFeature(Module); url.HttpApiSettingsUpdate = RefreshUrl; url.Load(); + url.InitializeColumnClick(lvURL); tpURL.Tag = url; } diff --git a/JexusManager.Features.HttpErrors/HttpErrorsFeature.cs b/JexusManager.Features.HttpErrors/HttpErrorsFeature.cs index e3567bc8..ce7cc12e 100644 --- a/JexusManager.Features.HttpErrors/HttpErrorsFeature.cs +++ b/JexusManager.Features.HttpErrors/HttpErrorsFeature.cs @@ -149,6 +149,24 @@ protected override void DoubleClick(HttpErrorsItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type", "Type"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[3].Text; + case "Type": + return item.SubItems[2].Text; + default: + return string.Empty; + } + } + public void Set() { var service = (IConfigurationService)GetService(typeof(IConfigurationService)); diff --git a/JexusManager.Features.HttpErrors/HttpErrorsPage.Designer.cs b/JexusManager.Features.HttpErrors/HttpErrorsPage.Designer.cs index 2c5b2e41..71c64429 100644 --- a/JexusManager.Features.HttpErrors/HttpErrorsPage.Designer.cs +++ b/JexusManager.Features.HttpErrors/HttpErrorsPage.Designer.cs @@ -165,12 +165,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Category", - "Area"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.HttpErrors/HttpErrorsPage.cs b/JexusManager.Features.HttpErrors/HttpErrorsPage.cs index 5b3e7b97..f510fff8 100644 --- a/JexusManager.Features.HttpErrors/HttpErrorsPage.cs +++ b/JexusManager.Features.HttpErrors/HttpErrorsPage.cs @@ -76,6 +76,9 @@ protected override void InitializeListPage() listView1.Items.Add(new CustomErrorsListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem != null) { foreach (CustomErrorsListViewItem item in listView1.Items) @@ -115,6 +118,11 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.IpSecurity/IpSecurityFeature.cs b/JexusManager.Features.IpSecurity/IpSecurityFeature.cs index 817c00f3..bfd30a31 100644 --- a/JexusManager.Features.IpSecurity/IpSecurityFeature.cs +++ b/JexusManager.Features.IpSecurity/IpSecurityFeature.cs @@ -226,6 +226,24 @@ public void Dynamic() service.ServerManager.CommitChanges(); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange("No Grouping", "Entry Type", "Mode"); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[2].Text; + case "Mode": + return item.Text; + default: + return "Unknown"; + } + } + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { ConfigurationSection section = service.GetSection("system.webServer/security/ipSecurity", null, false); diff --git a/JexusManager.Features.IpSecurity/IpSecurityPage.Designer.cs b/JexusManager.Features.IpSecurity/IpSecurityPage.Designer.cs index f1bbd749..0ef7deec 100644 --- a/JexusManager.Features.IpSecurity/IpSecurityPage.Designer.cs +++ b/JexusManager.Features.IpSecurity/IpSecurityPage.Designer.cs @@ -157,14 +157,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.IpSecurity/IpSecurityPage.cs b/JexusManager.Features.IpSecurity/IpSecurityPage.cs index 4d8a4dbf..103b65df 100644 --- a/JexusManager.Features.IpSecurity/IpSecurityPage.cs +++ b/JexusManager.Features.IpSecurity/IpSecurityPage.cs @@ -75,6 +75,9 @@ protected override void InitializeListPage() listView1.Items.Add(new IpSecurityListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -115,6 +118,11 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionFeature.cs b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionFeature.cs index 60474bea..45a25cd2 100644 --- a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionFeature.cs +++ b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionFeature.cs @@ -207,6 +207,22 @@ protected override void DoubleClick(IsapiCgiRestrictionItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Restriction"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Restriction": + return item.SubItems[1].Text; + default: + return "Unknown"; + } + } + protected override void OnSettingsSaved() { IsapiCgiRestrictionSettingsUpdated?.Invoke(); diff --git a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.Designer.cs b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.Designer.cs index 247ad2b4..bae7d251 100644 --- a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.Designer.cs +++ b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.Designer.cs @@ -157,14 +157,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroupSelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs index 8f1cc48f..c02f8f99 100644 --- a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs +++ b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs @@ -76,6 +76,9 @@ protected override void InitializeListPage() listView1.Items.Add(new IsapiCgiRestrictionListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -116,6 +119,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroupSelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.IsapiFilters/IsapiFiltersFeature.cs b/JexusManager.Features.IsapiFilters/IsapiFiltersFeature.cs index 314d45ea..1151b4f5 100644 --- a/JexusManager.Features.IsapiFilters/IsapiFiltersFeature.cs +++ b/JexusManager.Features.IsapiFilters/IsapiFiltersFeature.cs @@ -200,6 +200,22 @@ protected override void DoubleClick(IsapiFiltersItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange("No Grouping", "Entry Type"); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[2].Text; + default: + return "Unknown"; + } + } + public void Rename() { RenameInline(SelectedItem); diff --git a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.Designer.cs b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.Designer.cs index 21b988f3..10f4f682 100644 --- a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.Designer.cs +++ b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.Designer.cs @@ -157,14 +157,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroupSelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs index 8aa5bf88..1f0908c3 100644 --- a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs +++ b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs @@ -65,7 +65,7 @@ protected override void Initialize(object navigationData) _feature.IsapiFiltersSettingsUpdated = InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); @@ -92,6 +92,9 @@ protected override void InitializeListPage() listView1.Items.Add(new IsapiFiltersListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -132,6 +135,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroupSelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.MimeMap/MimeMapFeature.cs b/JexusManager.Features.MimeMap/MimeMapFeature.cs index 52cf5209..c42a1d4b 100644 --- a/JexusManager.Features.MimeMap/MimeMapFeature.cs +++ b/JexusManager.Features.MimeMap/MimeMapFeature.cs @@ -145,6 +145,24 @@ protected override void DoubleClick(MimeMapItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange("No Grouping", "Entry Type", "Content Type"); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[2].Text; + case "Content Type": + return item.SubItems[1].Text; + default: + return "Unknown"; + } + } + protected override void OnSettingsSaved() { MimeMapSettingsUpdated?.Invoke(); diff --git a/JexusManager.Features.MimeMap/MimeMapPage.Designer.cs b/JexusManager.Features.MimeMap/MimeMapPage.Designer.cs index c37650e6..36cb07a4 100644 --- a/JexusManager.Features.MimeMap/MimeMapPage.Designer.cs +++ b/JexusManager.Features.MimeMap/MimeMapPage.Designer.cs @@ -157,14 +157,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.MimeMap/MimeMapPage.cs b/JexusManager.Features.MimeMap/MimeMapPage.cs index e83f45bb..1273f115 100644 --- a/JexusManager.Features.MimeMap/MimeMapPage.cs +++ b/JexusManager.Features.MimeMap/MimeMapPage.cs @@ -76,6 +76,9 @@ protected override void InitializeListPage() listView1.Items.Add(new MimeMapListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -116,6 +119,11 @@ private void listView1_SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.Modules/ModulesFeature.cs b/JexusManager.Features.Modules/ModulesFeature.cs index e63ab594..f15eb72b 100644 --- a/JexusManager.Features.Modules/ModulesFeature.cs +++ b/JexusManager.Features.Modules/ModulesFeature.cs @@ -279,6 +279,24 @@ protected override void DoubleClick(ModulesItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange("No Grouping", "Entry Type", "Module Type"); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[3].Text; + case "Module Type": + return item.SubItems[2].Text; + default: + return "Unknown"; + } + } + public void Rename() { } diff --git a/JexusManager.Features.Modules/ModulesPage.Designer.cs b/JexusManager.Features.Modules/ModulesPage.Designer.cs index 58606841..0107f2da 100644 --- a/JexusManager.Features.Modules/ModulesPage.Designer.cs +++ b/JexusManager.Features.Modules/ModulesPage.Designer.cs @@ -164,14 +164,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.Modules/ModulesPage.cs b/JexusManager.Features.Modules/ModulesPage.cs index 894218dd..7b65ef33 100644 --- a/JexusManager.Features.Modules/ModulesPage.cs +++ b/JexusManager.Features.Modules/ModulesPage.cs @@ -78,6 +78,9 @@ protected override void InitializeListPage() listView1.Items.Add(new ModulesListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -118,6 +121,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.RequestFiltering/RequestFilteringPage.cs b/JexusManager.Features.RequestFiltering/RequestFilteringPage.cs index 7f574b76..e82f5bbd 100644 --- a/JexusManager.Features.RequestFiltering/RequestFilteringPage.cs +++ b/JexusManager.Features.RequestFiltering/RequestFilteringPage.cs @@ -178,36 +178,43 @@ protected override void Initialize(object navigationData) extensions.RequestFilteringSettingsUpdate = RefreshExtensions; extensions.Load(); tpExtensions.Tag = extensions; + extensions.InitializeColumnClick(lvExtensions); RefreshExtensions(); var rules = new FilteringRulesFeature(Module); rules.RequestFilteringSettingsUpdate = RefreshRules; rules.Load(); + rules.InitializeColumnClick(lvRules); tpRules.Tag = rules; var segments = new HiddenSegmentsFeature(Module); segments.RequestFilteringSettingsUpdate = RefreshSegments; segments.Load(); + segments.InitializeColumnClick(lvSegments); tpSegments.Tag = segments; var urls = new UrlsFeature(Module); urls.RequestFilteringSettingsUpdate = RefreshUrls; urls.Load(); + urls.InitializeColumnClick(lvUrls); tpUrl.Tag = urls; var verbs = new VerbsFeature(Module); verbs.RequestFilteringSettingsUpdate = RefreshVerbs; verbs.Load(); + verbs.InitializeColumnClick(lvVerbs); tpVerbs.Tag = verbs; var headers = new HeadersFeature(Module); headers.RequestFilteringSettingsUpdate = RefreshHeaders; headers.Load(); + headers.InitializeColumnClick(lvHeaders); tpHeaders.Tag = headers; var queries = new QueryStringsFeature(Module); queries.RequestFilteringSettingsUpdate = RefreshQueries; queries.Load(); + queries.InitializeColumnClick(lvQueries); tpQuery.Tag = queries; } diff --git a/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs b/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs index bf67f861..55598146 100644 --- a/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs +++ b/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs @@ -149,6 +149,22 @@ protected override void DoubleClick(ResponseHeadersItem item) EditItem(dialog.Item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[2].Text; + default: + return "Unknown"; + } + } + public void Set() { var service = (IConfigurationService)GetService(typeof(IConfigurationService)); diff --git a/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.Designer.cs b/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.Designer.cs index ac5e1572..44186ffa 100644 --- a/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.Designer.cs +++ b/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.Designer.cs @@ -158,14 +158,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.cs b/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.cs index 8907e972..80ac458b 100644 --- a/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.cs +++ b/JexusManager.Features.ResponseHeaders/ResponseHeadersPage.cs @@ -75,6 +75,9 @@ protected override void InitializeListPage() listView1.Items.Add(new ResponseHeadersListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { Refresh(); @@ -115,6 +118,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs b/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs index 8a6ad818..23d6349b 100644 --- a/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs +++ b/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs @@ -225,6 +225,22 @@ protected override void DoubleClick(AllowedVariableItem item) RenameInline(item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[1].Text; + default: + return "Unknown"; + } + } + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { return null; diff --git a/JexusManager.Features.Rewrite/Inbound/MapsPage.cs b/JexusManager.Features.Rewrite/Inbound/MapsPage.cs index 102354fc..1c209804 100644 --- a/JexusManager.Features.Rewrite/Inbound/MapsPage.cs +++ b/JexusManager.Features.Rewrite/Inbound/MapsPage.cs @@ -107,6 +107,8 @@ protected override void InitializeListPage() listView1.Items.Add(new MapsListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { this.Refresh(); diff --git a/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.Designer.cs b/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.Designer.cs index cba407cf..2e7adc63 100644 --- a/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.Designer.cs +++ b/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.Designer.cs @@ -150,12 +150,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Category", - "Area"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.cs b/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.cs index 74a7a1cc..defb9735 100644 --- a/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.cs +++ b/JexusManager.Features.Rewrite/Inbound/ServerVariablesPage.cs @@ -89,7 +89,7 @@ protected override void Initialize(object navigationData) _feature.RewriteSettingsUpdated = this.InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); @@ -115,6 +115,9 @@ protected override void InitializeListPage() listView1.Items.Add(new VariableListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + _feature.InitializeGrouping(cbGroup); + if (_feature.SelectedItem == null) { this.Refresh(); @@ -144,6 +147,11 @@ private void ListView1SelectedIndexChanged(object sender, EventArgs e) Refresh(); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override void Refresh() { this.Tasks.Fill(tsActionPanel, cmsActionPanel); diff --git a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs index fc6886b9..bcfdcc2e 100644 --- a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs +++ b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs @@ -95,7 +95,7 @@ protected override void Initialize(object navigationData) _feature.RewriteSettingsUpdated = this.InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); diff --git a/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs b/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs index bd3e3770..165f27ea 100644 --- a/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs +++ b/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs @@ -95,7 +95,7 @@ protected override void Initialize(object navigationData) _feature.RewriteSettingsUpdated = InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); diff --git a/JexusManager.Features.Rewrite/RewriteFeature.cs b/JexusManager.Features.Rewrite/RewriteFeature.cs index 3a3424d5..6134bb6d 100644 --- a/JexusManager.Features.Rewrite/RewriteFeature.cs +++ b/JexusManager.Features.Rewrite/RewriteFeature.cs @@ -350,14 +350,19 @@ public virtual bool ShowHelp() private void ViewTags() { + var service = (INavigationService)GetService(typeof(INavigationService)); + service.Navigate(null, null, typeof(CustomTagsPage), null); } private void ViewPreconditions() { + var service = (INavigationService)GetService(typeof(INavigationService)); + service.Navigate(null, null, typeof(PreConditionsPage), null); } private void ViewProviders() { + // TODO: } private void ViewMaps() diff --git a/JexusManager.Features.Rewrite/RewritePage.cs b/JexusManager.Features.Rewrite/RewritePage.cs index 1299f250..ead1289a 100644 --- a/JexusManager.Features.Rewrite/RewritePage.cs +++ b/JexusManager.Features.Rewrite/RewritePage.cs @@ -129,7 +129,7 @@ protected override void Initialize(object navigationData) _feature.Outbound.RewriteSettingsUpdated = InitializeOutbound; _feature.Load(); - _feature.Inbound.HandleMouseClick(lvIn, (item, text) => + _feature.Inbound.InitializeMouseClick(lvIn, (item, text) => { item.Name = text; item.Apply(); @@ -146,7 +146,7 @@ protected override void Initialize(object navigationData) return true; }); - _feature.Outbound.HandleMouseClick(lvOut, (item, text) => + _feature.Outbound.InitializeMouseClick(lvOut, (item, text) => { item.Name = text; item.Apply(); @@ -178,6 +178,8 @@ private void InitializeInbound() lvIn.Items.Add(new InboundRuleListViewItem(file, this)); } + _feature.Inbound.InitializeColumnClick(lvIn); + if (_feature.Inbound.SelectedItem == null) { this.Refresh(); @@ -201,6 +203,8 @@ private void InitializeOutbound() lvOut.Items.Add(new OutboundRuleListViewItem(file, this)); } + _feature.Outbound.InitializeColumnClick(lvOut); + if (_feature.Outbound.SelectedItem == null) { this.Refresh(); diff --git a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsFeature.cs b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsFeature.cs index ce575ce5..f22a6ea1 100644 --- a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsFeature.cs +++ b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsFeature.cs @@ -331,6 +331,23 @@ public virtual bool ShowHelp() return false; } + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + // Determine the group key based on the selected grouping option + switch (selectedGroup) + { + case "Entry Type": + return item.SubItems[4].Text; + default: + return "Unknown"; + } + } + + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(["No Grouping", "Entry Type"]); + } + public bool IsInOrder { get; private set; } public bool CanRevert { get; private set; } diff --git a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.Designer.cs b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.Designer.cs index ea30ebb6..d0d159b3 100644 --- a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.Designer.cs +++ b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.Designer.cs @@ -162,14 +162,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.cs b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.cs index 3c95afef..f2b53c96 100644 --- a/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.cs +++ b/JexusManager.Features.TraceFailedRequests/TraceFailedRequestsPage.cs @@ -5,6 +5,7 @@ namespace JexusManager.Features.TraceFailedRequests { using System; + using System.Collections.Generic; using System.Reflection; using System.Windows.Forms; @@ -76,6 +77,9 @@ protected override void InitializeListPage() listView1.Items.Add(new TraceFailedRequestsListViewItem(file, this)); } + _feature.InitializeGrouping(cbGroup); + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { Refresh(); @@ -116,6 +120,11 @@ private void ListView1_MouseDoubleClick(object sender, MouseEventArgs e) _feature.HandleMouseDoubleClick(listView1); } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override bool ShowHelp() { _feature.ShowHelp(); diff --git a/JexusManager.Shared/ColumnClickHook.cs b/JexusManager.Shared/ColumnClickHook.cs new file mode 100644 index 00000000..384dd4fd --- /dev/null +++ b/JexusManager.Shared/ColumnClickHook.cs @@ -0,0 +1,146 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Runtime.InteropServices; +using System.Windows.Forms; +using System; + +namespace JexusManager +{ + using System.Windows.Forms; + + public class ColumnClickHook + { + // Simple comparer for sorting ListView items by text. + private class ListViewItemComparer : System.Collections.IComparer + { + private readonly int _column; + private readonly SortOrder _order; + + public ListViewItemComparer(int column, SortOrder order) + { + _column = column; + _order = order; + } + + public int Compare(object x, object y) + { + var itemX = x as ListViewItem; + var itemY = y as ListViewItem; + + if (itemX == null || itemY == null) + { + return 0; + } + + int result = string.Compare(itemX.SubItems[_column].Text, itemY.SubItems[_column].Text); + + return _order == SortOrder.Descending ? -result : result; + } + } + + private int _sortColumn = -1; + + public void HandleColumnClick(ListView listView1) + { + listView1.ColumnClick += (o, e) => + { + // Determine if the clicked column is already the one being sorted. + if (e.Column == _sortColumn) + { + // Reverse the current sort direction for this column. + listView1.Sorting = listView1.Sorting == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending; + } + else + { + // Set the column number that is to be sorted; default to ascending. + _sortColumn = e.Column; + listView1.Sorting = SortOrder.Ascending; + } + + // Sort the items in the ListView. + listView1.Sorting = listView1.Sorting; + listView1.ListViewItemSorter = new ListViewItemComparer(e.Column, listView1.Sorting); + listView1.Sort(); + + // Update the column header to show the sorting indicator + IndicatorHelper.SetSortIcon(listView1, e.Column, listView1.Sorting); + }; + } + } + + public static class IndicatorHelper + { + private const int HDI_FORMAT = 0x0004; + private const int HDF_SORTUP = 0x0400; // Arrow pointing up + private const int HDF_SORTDOWN = 0x0200; // Arrow pointing down + private const int LVM_GETHEADER = 0x101F; + private const int HDM_GETITEM = 0x120B; + private const int HDM_SETITEM = 0x120C; + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + private struct HDITEM + { + public int mask; + public int cxy; + [MarshalAs(UnmanagedType.LPTStr)] + public string pszText; + public IntPtr hbm; + public int cchTextMax; + public int fmt; + public IntPtr lParam; + // If running on 64-bit, add padding + public int iImage; + public int iOrder; + } + + public static void SetSortIcon(ListView listView, int columnIndex, SortOrder order) + { + IntPtr headerHandle = SendMessage(listView.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero); + + for (int i = 0; i < listView.Columns.Count; i++) + { + var item = new HDITEM + { + mask = HDI_FORMAT + }; + + // Get the current header item + IntPtr itemPtr = Marshal.AllocHGlobal(Marshal.SizeOf(item)); + Marshal.StructureToPtr(item, itemPtr, false); + SendMessage(headerHandle, HDM_GETITEM, new IntPtr(i), itemPtr); + + // Update the format to add or remove the sort arrow + item = Marshal.PtrToStructure(itemPtr); + if (i == columnIndex) + { + if (order == SortOrder.Ascending) + { + item.fmt &= ~HDF_SORTDOWN; // Remove the descending flag + item.fmt |= HDF_SORTUP; // Add the ascending flag + } + else if (order == SortOrder.Descending) + { + item.fmt &= ~HDF_SORTUP; // Remove the ascending flag + item.fmt |= HDF_SORTDOWN; // Add the descending flag + } + } + else + { + // Remove any sorting indicator for other columns + item.fmt &= ~HDF_SORTUP; + item.fmt &= ~HDF_SORTDOWN; + } + + // Set the updated header item + Marshal.StructureToPtr(item, itemPtr, false); + SendMessage(headerHandle, HDM_SETITEM, new IntPtr(i), itemPtr); + Marshal.FreeHGlobal(itemPtr); + } + } + } +} diff --git a/JexusManager.Shared/DialogHelper.cs b/JexusManager.Shared/DialogHelper.cs index c37be0f9..6aed935f 100644 --- a/JexusManager.Shared/DialogHelper.cs +++ b/JexusManager.Shared/DialogHelper.cs @@ -19,6 +19,7 @@ namespace JexusManager using Tulpep.NotificationWindow; using System.Net; using System.Drawing; + using System.Collections.Generic; public static class DialogHelper { @@ -425,5 +426,43 @@ public static void MessageBoxShow(string message, bool error = false) }; popupNotifier.Popup(); } + + public static void HandleGrouping(ListView listView1, string selectedGroup, Func GetGroupKey) + { + // Clear existing groups and items + listView1.Groups.Clear(); + foreach (ListViewItem item in listView1.Items) + { + item.Group = null; + } + + if (selectedGroup == "No Grouping") + { + // No grouping, return + return; + } + + // Create groups based on the selected option + Dictionary groups = new Dictionary(); + foreach (ListViewItem item in listView1.Items) + { + string groupKey = GetGroupKey(item, selectedGroup); + if (string.IsNullOrWhiteSpace(groupKey)) + { + groupKey = "Other"; + } + + if (!groups.ContainsKey(groupKey)) + { + // Create a new group if it doesn't exist + ListViewGroup group = new ListViewGroup(groupKey, groupKey); + groups[groupKey] = group; + listView1.Groups.Add(group); + } + + // Assign the item to the appropriate group + item.Group = groups[groupKey]; + } + } } } diff --git a/JexusManager.Shared/Features/FeatureBase.cs b/JexusManager.Shared/Features/FeatureBase.cs index 2c62970e..ed0bb7f0 100644 --- a/JexusManager.Shared/Features/FeatureBase.cs +++ b/JexusManager.Shared/Features/FeatureBase.cs @@ -2,6 +2,9 @@ // // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Collections.Generic; +using System.Windows.Forms; + namespace JexusManager.Features { using System; @@ -266,7 +269,7 @@ public void HandleSelectedIndexChanged(ListView listView) } } - public void HandleMouseClick(ListView listView1, Action updatePropertyAction, Func validateAction) + public void InitializeMouseClick(ListView listView1, Action updatePropertyAction, Func validateAction) { _listView = listView1; listView1.LabelEdit = true; @@ -322,6 +325,20 @@ public bool FindDuplicate(Func value, string text) return Items.Where(item => item != SelectedItem) .Any(item => string.Equals(value(item), text, StringComparison.Ordinal)); } + + public virtual string GetGroupKey(ListViewItem item, string selectedGroup) + { + return "Unknown"; + } + + public virtual void InitializeGrouping(ToolStripComboBox cbGroup) + { } + + public void InitializeColumnClick(ListView listView) + { + var hook = new ColumnClickHook(); + hook.HandleColumnClick(listView); + } #endregion } } diff --git a/JexusManager/Features/Main/ApplicationPoolsFeature.cs b/JexusManager/Features/Main/ApplicationPoolsFeature.cs index 44fd19fe..d02f4f40 100644 --- a/JexusManager/Features/Main/ApplicationPoolsFeature.cs +++ b/JexusManager/Features/Main/ApplicationPoolsFeature.cs @@ -347,6 +347,29 @@ protected override void DoubleClick(ApplicationPool item) OnApplicationPoolsSettingsSaved(); } + public override void InitializeGrouping(ToolStripComboBox groupBox) + { + groupBox.Items.AddRange(["No Grouping", "Status", ".NET CLR Version", "Managed Pipeline Mode", "Identity"]); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + // Determine the group key based on the selected grouping option + switch (selectedGroup) + { + case "Status": + return item.SubItems[1].Text; + case ".NET CLR Version": + return item.SubItems[2].Text; + case "Managed Pipeline Mode": + return item.SubItems[3].Text; + case "Identity": + return item.SubItems[4].Text; + default: + return "Unknown"; + } + } + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { return null; diff --git a/JexusManager/Features/Main/ApplicationPoolsPage.Designer.cs b/JexusManager/Features/Main/ApplicationPoolsPage.Designer.cs index e3846ec3..8a4b59cc 100644 --- a/JexusManager/Features/Main/ApplicationPoolsPage.Designer.cs +++ b/JexusManager/Features/Main/ApplicationPoolsPage.Designer.cs @@ -251,12 +251,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Category", - "Area"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // pictureBox1 // diff --git a/JexusManager/Features/Main/ApplicationPoolsPage.cs b/JexusManager/Features/Main/ApplicationPoolsPage.cs index ed7b696e..0b8b1729 100644 --- a/JexusManager/Features/Main/ApplicationPoolsPage.cs +++ b/JexusManager/Features/Main/ApplicationPoolsPage.cs @@ -84,7 +84,7 @@ protected override void Initialize(object navigationData) _feature.ApplicationPoolsSettingsUpdated = InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); @@ -125,6 +125,9 @@ protected override void InitializeListPage() listView1.Items.Add(new ApplicationPoolsListViewItem(file, this)); } + _feature.InitializeGrouping(cbGroup); + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem != null) { foreach (ApplicationPoolsListViewItem item in listView1.Items) @@ -158,6 +161,11 @@ private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) } } + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + protected override TaskListCollection Tasks { get diff --git a/JexusManager/Features/Main/ApplicationsFeature.cs b/JexusManager/Features/Main/ApplicationsFeature.cs index 9ccd52cc..d77c53c8 100644 --- a/JexusManager/Features/Main/ApplicationsFeature.cs +++ b/JexusManager/Features/Main/ApplicationsFeature.cs @@ -305,6 +305,27 @@ protected override void DoubleClick(Application item) Basic(); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(new object[] { + "No Grouping", + "Site", + "Application Pool"}); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + switch (selectedGroup) + { + case "Site": + return item.SubItems[1].Name; + case "Application Pool": + return item.SubItems[2].Name; + default: + return string.Empty; + } + } + private void Permissions() { var path = SelectedItem.PhysicalPath.ExpandIisExpressEnvironmentVariables(SelectedItem.GetActualExecutable()); diff --git a/JexusManager/Features/Main/ApplicationsPage.Designer.cs b/JexusManager/Features/Main/ApplicationsPage.Designer.cs index 8fc06cc4..7516c1e8 100644 --- a/JexusManager/Features/Main/ApplicationsPage.Designer.cs +++ b/JexusManager/Features/Main/ApplicationsPage.Designer.cs @@ -238,12 +238,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Path", - "Application Pool"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager/Features/Main/ApplicationsPage.cs b/JexusManager/Features/Main/ApplicationsPage.cs index 72ad3be5..e25d71a4 100644 --- a/JexusManager/Features/Main/ApplicationsPage.cs +++ b/JexusManager/Features/Main/ApplicationsPage.cs @@ -102,6 +102,9 @@ protected override void InitializeListPage() listView1.Items.Add(new ApplicationsListViewItem(app, this)); } + _feature.InitializeGrouping(cbGroup); + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem != null) { foreach (ApplicationsListViewItem item in listView1.Items) @@ -178,5 +181,10 @@ private void ListView1_SelectedIndexChanged(object sender, EventArgs e) _feature.HandleSelectedIndexChanged(listView1); Refresh(); } + + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } } } diff --git a/JexusManager/Features/Main/SitesFeature.cs b/JexusManager/Features/Main/SitesFeature.cs index 6a4e9247..4a74be32 100644 --- a/JexusManager/Features/Main/SitesFeature.cs +++ b/JexusManager/Features/Main/SitesFeature.cs @@ -485,6 +485,36 @@ protected override void DoubleClick(Site item) mainForm?.ShowSite(item); } + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(new object[] { + "No Grouping", + "Status", + //"IP Address", + //"Protocol", + //"Port" + }); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + Site site = item.Tag as Site; + switch (selectedGroup) + { + case "Status": + return item.SubItems[2].Text; + // TODO: + //case "IP Address": + // return site.Bindings; + //case "Protocol": + // return item.SubItems[3].Text; + //case "Port": + // return item.SubItems[4].Text; + default: + return string.Empty; + } + } + private void Permissions() { var path = SelectedItem.PhysicalPath.ExpandIisExpressEnvironmentVariables(SelectedItem.Applications[0].GetActualExecutable()); diff --git a/JexusManager/Features/Main/SitesPage.Designer.cs b/JexusManager/Features/Main/SitesPage.Designer.cs index db314f85..d747ed47 100644 --- a/JexusManager/Features/Main/SitesPage.Designer.cs +++ b/JexusManager/Features/Main/SitesPage.Designer.cs @@ -269,14 +269,9 @@ private void InitializeComponent() // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Status", - "IP Address", - "Protocol", - "Port"}); this.cbGroup.Name = "cbGroup"; this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); // // label2 // diff --git a/JexusManager/Features/Main/SitesPage.cs b/JexusManager/Features/Main/SitesPage.cs index 61ceae40..cfe50a29 100644 --- a/JexusManager/Features/Main/SitesPage.cs +++ b/JexusManager/Features/Main/SitesPage.cs @@ -97,7 +97,7 @@ protected override void Initialize(object navigationData) _feature.SitesSettingsUpdated = InitializeListPage; _feature.Load(); - _feature.HandleMouseClick(listView1, (item, text) => + _feature.InitializeMouseClick(listView1, (item, text) => { item.Name = text; item.Apply(); @@ -155,6 +155,9 @@ protected override void InitializeListPage() listView1.Items.Add(new SitesListViewItem(file, this)); } + _feature.InitializeGrouping(cbGroup); + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem != null) { foreach (SitesListViewItem item in listView1.Items) @@ -231,5 +234,10 @@ private void ListView1_SelectedIndexChanged(object sender, EventArgs e) _feature.HandleSelectedIndexChanged(listView1); Refresh(); } + + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } } } diff --git a/JexusManager/Features/Main/VirtualDirectoriesPage.Designer.cs b/JexusManager/Features/Main/VirtualDirectoriesPage.Designer.cs index cb7b1be0..11321749 100644 --- a/JexusManager/Features/Main/VirtualDirectoriesPage.Designer.cs +++ b/JexusManager/Features/Main/VirtualDirectoriesPage.Designer.cs @@ -13,7 +13,7 @@ partial class VirtualDirectoriesPage /// /// Clean up any resources being used. /// - /// true if managed resources should be disposed; otherwise, false. + /// true if managed resources should be disposed; otherwise. protected override void Dispose(bool disposing) { if (disposing && (components != null)) @@ -37,18 +37,10 @@ private void InitializeComponent() this.cmsActionPanel = new System.Windows.Forms.ContextMenuStrip(this.components); this.panel2 = new System.Windows.Forms.Panel(); this.listView1 = new System.Windows.Forms.ListView(); + this.chAppPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chPhysicalPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.toolStrip2 = new System.Windows.Forms.ToolStrip(); - this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); - this.cbFilter = new System.Windows.Forms.ToolStripComboBox(); - this.btnGo = new System.Windows.Forms.ToolStripSplitButton(); - this.pathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.physicalPathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.btnShowAll = new System.Windows.Forms.ToolStripButton(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); - this.cbGroup = new System.Windows.Forms.ToolStripComboBox(); + this.chIdentity = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.label2 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); @@ -60,7 +52,6 @@ private void InitializeComponent() this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.panel2.SuspendLayout(); - this.toolStrip2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -106,7 +97,6 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel2.Controls.Add(this.listView1); - this.panel2.Controls.Add(this.toolStrip2); this.panel2.Location = new System.Drawing.Point(10, 50); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(560, 540); @@ -115,15 +105,17 @@ private void InitializeComponent() // listView1 // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chAppPath, this.chPath, - this.chPhysicalPath}); + this.chPhysicalPath, + this.chIdentity}); this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.FullRowSelect = true; this.listView1.LabelEdit = true; - this.listView1.Location = new System.Drawing.Point(0, 25); + this.listView1.Location = new System.Drawing.Point(0, 0); this.listView1.Margin = new System.Windows.Forms.Padding(5); this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(560, 515); + this.listView1.Size = new System.Drawing.Size(560, 540); this.listView1.SmallImageList = this.imageList1; this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; @@ -132,95 +124,25 @@ private void InitializeComponent() this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListView1_MouseDoubleClick); this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged); // + // chAppPath + // + this.chAppPath.Text = "Application Path"; + this.chAppPath.Width = 150; + // // chPath // - this.chPath.Text = "Path"; - this.chPath.Width = 200; + this.chPath.Text = "Virtual Path"; + this.chPath.Width = 150; // // chPhysicalPath // this.chPhysicalPath.Text = "Physical Path"; - this.chPhysicalPath.Width = 350; - // - // toolStrip2 - // - this.toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; - this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripLabel1, - this.cbFilter, - this.btnGo, - this.btnShowAll, - this.toolStripSeparator1, - this.toolStripLabel2, - this.cbGroup}); - this.toolStrip2.Location = new System.Drawing.Point(0, 0); - this.toolStrip2.Name = "toolStrip2"; - this.toolStrip2.Size = new System.Drawing.Size(560, 25); - this.toolStrip2.TabIndex = 3; - this.toolStrip2.Text = "toolStrip2"; - // - // toolStripLabel1 - // - this.toolStripLabel1.Name = "toolStripLabel1"; - this.toolStripLabel1.Size = new System.Drawing.Size(36, 22); - this.toolStripLabel1.Text = "Filter:"; - // - // cbFilter - // - this.cbFilter.Name = "cbFilter"; - this.cbFilter.Size = new System.Drawing.Size(121, 25); - this.cbFilter.TextChanged += new System.EventHandler(this.cbFilter_TextChanged); - // - // btnGo - // - this.btnGo.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.pathToolStripMenuItem, - this.physicalPathToolStripMenuItem}); - this.btnGo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnGo.Name = "btnGo"; - this.btnGo.Size = new System.Drawing.Size(54, 22); - this.btnGo.Text = "Go"; - this.btnGo.ToolTipText = "Go"; - // - // pathToolStripMenuItem - // - this.pathToolStripMenuItem.Name = "pathToolStripMenuItem"; - this.pathToolStripMenuItem.Size = new System.Drawing.Size(144, 22); - this.pathToolStripMenuItem.Text = "Path"; - // - // physicalPathToolStripMenuItem - // - this.physicalPathToolStripMenuItem.Name = "physicalPathToolStripMenuItem"; - this.physicalPathToolStripMenuItem.Size = new System.Drawing.Size(144, 22); - this.physicalPathToolStripMenuItem.Text = "Physical Path"; - // - // btnShowAll - // - this.btnShowAll.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnShowAll.Name = "btnShowAll"; - this.btnShowAll.Size = new System.Drawing.Size(73, 22); - this.btnShowAll.Text = "Show All"; - this.btnShowAll.Click += new System.EventHandler(this.btnShowAll_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); - // - // toolStripLabel2 - // - this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(59, 22); - this.toolStripLabel2.Text = "Group by:"; + this.chPhysicalPath.Width = 250; // - // cbGroup + // chIdentity // - this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbGroup.Items.AddRange(new object[] { - "No Grouping", - "Path"}); - this.cbGroup.Name = "cbGroup"; - this.cbGroup.Size = new System.Drawing.Size(121, 25); + this.chIdentity.Text = "Identity"; + this.chIdentity.Width = 150; // // label2 // @@ -302,9 +224,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.toolStrip2.ResumeLayout(false); - this.toolStrip2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); @@ -325,18 +244,10 @@ private void InitializeComponent() private Label label2; private ToolStrip tsActionPanel; private ListView listView1; + private ColumnHeader chAppPath; private ColumnHeader chPath; private ColumnHeader chPhysicalPath; - private ToolStrip toolStrip2; - private ToolStripLabel toolStripLabel1; - private ToolStripComboBox cbFilter; - private ToolStripSplitButton btnGo; - private ToolStripMenuItem pathToolStripMenuItem; - private ToolStripMenuItem physicalPathToolStripMenuItem; - private ToolStripButton btnShowAll; - private ToolStripSeparator toolStripSeparator1; - private ToolStripLabel toolStripLabel2; - private ToolStripComboBox cbGroup; + private ColumnHeader chIdentity; private ContextMenuStrip cmsActionPanel; } -} \ No newline at end of file +} diff --git a/JexusManager/Features/Main/VirtualDirectoriesPage.cs b/JexusManager/Features/Main/VirtualDirectoriesPage.cs index f97b47f1..c6a4cb9a 100644 --- a/JexusManager/Features/Main/VirtualDirectoriesPage.cs +++ b/JexusManager/Features/Main/VirtualDirectoriesPage.cs @@ -49,11 +49,13 @@ private sealed class VirtualDirectoriesListViewItem : ListViewItem, IFeatureList private readonly VirtualDirectoriesPage _page; public VirtualDirectoriesListViewItem(VirtualDirectory item, VirtualDirectoriesPage page) - : base(item.Path) + : base(item.Application.IsRoot() ? "Root Application": item.Application.Path) // TODO: miss the icon in this column. { Item = item; _page = page; + SubItems.Add(new ListViewSubItem(this, Item.Path)); SubItems.Add(new ListViewSubItem(this, Item.PhysicalPath)); + SubItems.Add(new ListViewSubItem(this, Item.UserName ?? string.Empty)); ImageIndex = 0; } } @@ -65,9 +67,6 @@ public VirtualDirectoriesListViewItem(VirtualDirectory item, VirtualDirectoriesP public VirtualDirectoriesPage() { InitializeComponent(); - btnGo.Image = DefaultTaskList.GoImage; - btnShowAll.Image = DefaultTaskList.ShowAllImage; - imageList1.Images.Add(Resources.virtual_directory_16); } @@ -95,6 +94,8 @@ protected override void InitializeListPage() { listView1.Items.Add(new VirtualDirectoriesListViewItem(vdir, this)); } + + _feature.InitializeColumnClick(listView1); if (_feature.SelectedItem != null) { @@ -144,16 +145,6 @@ protected override TaskListCollection Tasks } } - private void cbFilter_TextChanged(object sender, EventArgs e) - { - btnGo.Enabled = !string.IsNullOrWhiteSpace(cbFilter.Text); - } - - private void btnShowAll_Click(object sender, EventArgs e) - { - cbFilter.Text = string.Empty; - } - private void ListView1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) From 8a50cada947232470dfaab437480e968ef247493 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Mon, 7 Apr 2025 21:47:46 -0400 Subject: [PATCH 3/7] Implemented providers page. --- .vscode/settings.json | 3 +- .../AddProviderDialog.Designer.cs | 129 ++++++++ .../AddProviderDialog.cs | 124 +++++++ .../Outbound/CustomTagsPage.cs | 2 + .../Outbound/PreConditionsPage.cs | 2 + JexusManager.Features.Rewrite/ProviderItem.cs | 110 +++++++ .../ProvidersFeature.cs | 308 ++++++++++++++++++ .../ProvidersPage.Designer.cs | 260 +++++++++++++++ .../ProvidersPage.cs | 195 +++++++++++ .../Resources/ProvidersPage.resx | 135 ++++++++ .../RewriteFeature.cs | 3 +- JexusManager.Features.Rewrite/SettingItem.cs | 50 +++ JexusManager.slnx | 43 +++ 13 files changed, 1362 insertions(+), 2 deletions(-) create mode 100644 JexusManager.Features.Rewrite/AddProviderDialog.Designer.cs create mode 100644 JexusManager.Features.Rewrite/AddProviderDialog.cs create mode 100644 JexusManager.Features.Rewrite/ProviderItem.cs create mode 100644 JexusManager.Features.Rewrite/ProvidersFeature.cs create mode 100644 JexusManager.Features.Rewrite/ProvidersPage.Designer.cs create mode 100644 JexusManager.Features.Rewrite/ProvidersPage.cs create mode 100644 JexusManager.Features.Rewrite/Resources/ProvidersPage.resx create mode 100644 JexusManager.Features.Rewrite/SettingItem.cs create mode 100644 JexusManager.slnx diff --git a/.vscode/settings.json b/.vscode/settings.json index 013007bb..9fa61c3d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "dotnet.preferCSharpExtension": true + "dotnet.preferCSharpExtension": true, + "dotnet.defaultSolution": "JexusManager.sln" } \ No newline at end of file diff --git a/JexusManager.Features.Rewrite/AddProviderDialog.Designer.cs b/JexusManager.Features.Rewrite/AddProviderDialog.Designer.cs new file mode 100644 index 00000000..549b7499 --- /dev/null +++ b/JexusManager.Features.Rewrite/AddProviderDialog.Designer.cs @@ -0,0 +1,129 @@ +namespace JexusManager.Features.Rewrite +{ + partial class AddProviderDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify the contents of this method with the code editor. + /// + private void InitializeComponent() + { this.label1 = new System.Windows.Forms.Label(); + this.txtName = new System.Windows.Forms.TextBox(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.cbManagedType = new System.Windows.Forms.ComboBox(); + this.SuspendLayout(); // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(38, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Name:"; + // + // txtName + // + this.txtName.Location = new System.Drawing.Point(12, 25); + this.txtName.Name = "txtName"; + this.txtName.Size = new System.Drawing.Size(446, 20); + this.txtName.TabIndex = 1; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(383, 151); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 5; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.Enabled = false; + this.btnOK.Location = new System.Drawing.Point(302, 151); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 4; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 71); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(79, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Managed Type:"; + // + // cbManagedType + // + this.cbManagedType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbManagedType.FormattingEnabled = true; + this.cbManagedType.Items.AddRange(new object[] { + "System.Web.Routing.RouteCollection, System.Web.Routing, Version=4.0.0.0", + "System.Web.Configuration.MachineKeySection, System.Web, Version=4.0.0.0", + "Microsoft.Web.Iis.Rewrite.ManagedProviders.RewriteMapCollection"}); + this.cbManagedType.Location = new System.Drawing.Point(12, 87); + this.cbManagedType.Name = "cbManagedType"; + this.cbManagedType.Size = new System.Drawing.Size(446, 21); + this.cbManagedType.TabIndex = 3; + // // AddProviderDialog + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(470, 186); + this.Controls.Add(this.cbManagedType); + this.Controls.Add(this.label2); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.txtName); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.HelpButton = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AddProviderDialog"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Add Provider"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtName; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox cbManagedType; + } +} diff --git a/JexusManager.Features.Rewrite/AddProviderDialog.cs b/JexusManager.Features.Rewrite/AddProviderDialog.cs new file mode 100644 index 00000000..574b1f0a --- /dev/null +++ b/JexusManager.Features.Rewrite/AddProviderDialog.cs @@ -0,0 +1,124 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.ComponentModel; + using System.Reactive.Disposables; + using System.Reactive.Linq; + using System.Windows.Forms; + using JexusManager.Services; + using Microsoft.Web.Administration; + using Microsoft.Web.Management.Client; + using Microsoft.Web.Management.Client.Win32; + + internal partial class AddProviderDialog : DialogForm + { + private readonly ProvidersFeature _feature; + + public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem existing = null) + : base(module) + { + InitializeComponent(); + _feature = feature; + + Text = existing == null ? "Add Provider" : "Edit Provider"; + if (existing != null) + { + txtName.Text = existing.Name; + txtName.ReadOnly = true; + + // Find the matching managed type if possible + for (int i = 0; i < cbManagedType.Items.Count; i++) + { + if (cbManagedType.Items[i].ToString() == existing.Type) + { + cbManagedType.SelectedIndex = i; + break; + } + } + + if (cbManagedType.SelectedIndex < 0) + { + cbManagedType.SelectedIndex = 0; + } + } + else + { + cbManagedType.SelectedIndex = 0; + } + + ProviderItem = existing; + + var container = new CompositeDisposable(); + FormClosed += (sender, args) => container.Dispose(); + + container.Add( + Observable.FromEventPattern(txtName, "TextChanged") + .Sample(TimeSpan.FromSeconds(0.5)) + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text); + })); + + container.Add( + Observable.FromEventPattern(btnOK, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + if (string.IsNullOrEmpty(txtName.Text)) + { + ShowMessage("Provider name cannot be empty.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + return; + } + + // Check for duplicate provider names + if (ProviderItem == null && _feature.Items.Exists(item => item.Name == txtName.Text)) + { + ShowMessage("A provider with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + return; + } + + if (ProviderItem == null) + { + // Create a new provider + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + var section = service.GetSection("system.webServer/rewrite/providers"); + var collection = section.GetCollection(); + + var element = collection.CreateElement(); + ProviderItem = new ProviderItem(element); + ProviderItem.Name = txtName.Text; + ProviderItem.Type = cbManagedType.Text; + + _feature.AddProvider(ProviderItem); + } + else + { + // Update existing provider + ProviderItem.Type = cbManagedType.Text; + ProviderItem.Apply(); + + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + service.ServerManager.CommitChanges(); + } + + DialogResult = DialogResult.OK; + })); + + container.Add( + Observable.FromEventPattern(this, "HelpButtonClicked") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + _feature.ShowHelp(); + })); + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public ProviderItem ProviderItem { get; private set; } + } +} diff --git a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs index bcfdcc2e..3b5d977e 100644 --- a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs +++ b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs @@ -120,6 +120,8 @@ protected override void InitializeListPage() listView1.Items.Add(new CustomTagsListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { this.Refresh(); diff --git a/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs b/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs index 165f27ea..320f79f0 100644 --- a/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs +++ b/JexusManager.Features.Rewrite/Outbound/PreConditionsPage.cs @@ -121,6 +121,8 @@ protected override void InitializeListPage() listView1.Items.Add(new PreConditionListViewItem(file, this)); } + _feature.InitializeColumnClick(listView1); + if (_feature.SelectedItem == null) { this.Refresh(); diff --git a/JexusManager.Features.Rewrite/ProviderItem.cs b/JexusManager.Features.Rewrite/ProviderItem.cs new file mode 100644 index 00000000..5cc48201 --- /dev/null +++ b/JexusManager.Features.Rewrite/ProviderItem.cs @@ -0,0 +1,110 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.Collections.Generic; + using System.Linq; + using Microsoft.Web.Administration; + + /// + /// Represents a URL rewrite provider item in system.webServer/rewrite/providers. + /// + public class ProviderItem : IItem + { + + /// + /// Gets or sets the name of the provider. + /// + public string Name + { + get { return (string)Element["name"]; } + set { Element["name"] = value; } + } + + /// + /// Gets or sets the type of the provider. + /// + public string Type + { + get { return (string)Element["type"]; } + set { Element["type"] = value; } + } + + /// + /// Gets the settings collection for this provider. + /// + public IList Settings { get; } = new List(); + + /// + /// Gets a flag indicating whether this item is locally stored or inherited. + /// + public string Flag { get; set; } + + /// + /// Gets the configuration element representing this provider. + /// + public ConfigurationElement Element { get; set; } + + /// + /// Initializes a new instance of the class. + /// + /// The provider configuration element. + public ProviderItem(ConfigurationElement element) + { + Element = element ?? throw new ArgumentNullException(nameof(element)); + Flag = element.IsLocallyStored ? "Local" : "Inherited"; + + // Load settings from the provider's settings collection + var settingsCollection = Element.GetChildElement("settings")?.GetCollection(); + if (settingsCollection != null) + { + foreach (ConfigurationElement setting in settingsCollection) + { + Settings.Add(new SettingItem(setting)); + } + } + } + + /// + /// Updates an existing provider item with the current values. + /// + public void Apply() + { + Element["name"] = Name; + Element["type"] = Type; + + var conditions = Element.GetCollection(); + conditions.Clear(); + foreach (var item in Settings) + { + item.AppendTo(conditions); + } + } + + /// + /// Determines whether this provider item equals another provider item. + /// + /// The provider item to compare with. + /// True if the items are equal, false otherwise. + public bool Equals(ProviderItem other) + { + return Match(other) && Type == other.Type; + } + + /// + /// Determines whether this provider item has the same key values as another provider item. + /// + /// The provider item to compare with. + /// True if the items match, false otherwise. + public bool Match(ProviderItem other) + { + if (other is null) + return false; + + return Name == other.Name; + } + } +} diff --git a/JexusManager.Features.Rewrite/ProvidersFeature.cs b/JexusManager.Features.Rewrite/ProvidersFeature.cs new file mode 100644 index 00000000..2e29ebf8 --- /dev/null +++ b/JexusManager.Features.Rewrite/ProvidersFeature.cs @@ -0,0 +1,308 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Reflection; + using System.Windows.Forms; + + using JexusManager.Features; + using JexusManager.Services; + + using Microsoft.Web.Administration; + using Microsoft.Web.Management.Client; + using Microsoft.Web.Management.Client.Win32; + + using Module = Microsoft.Web.Management.Client.Module; + + internal class ProvidersFeature : FeatureBase + { + private sealed class FeatureTaskList : DefaultTaskList + { + private readonly ProvidersFeature _owner; + + public FeatureTaskList(ProvidersFeature owner) + { + _owner = owner; + } + + public override ICollection GetTaskItems() + { + var result = new ArrayList(); + result.Add(new MethodTaskItem("Add", "Add Provider...", string.Empty).SetUsage()); + + if (_owner.SelectedItem != null) + { + result.Add(new MethodTaskItem("AddSetting", "Add Provider Setting...", string.Empty).SetUsage()); + result.Add(MethodTaskItem.CreateSeparator().SetUsage()); + result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage()); + result.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage()); + result.Add(RemoveTaskItem); + } + + if (_owner.CanRevert) + { + result.Add(MethodTaskItem.CreateSeparator().SetUsage()); + result.Add(RevertTaskItem); + } + + return result.ToArray(typeof(TaskItem)) as TaskItem[]; + } + + [Obfuscation(Exclude = true)] + public void Add() + { + _owner.Add(); + } + + [Obfuscation(Exclude = true)] + public void AddSetting() + { + _owner.AddSetting(); + } + + [Obfuscation(Exclude = true)] + public void Edit() + { + _owner.Edit(); + } + + [Obfuscation(Exclude = true)] + public void Rename() + { + _owner.Rename(); + } + + [Obfuscation(Exclude = true)] + public void Remove() + { + _owner.Remove(); + } + + [Obfuscation(Exclude = true)] + public void Revert() + { + _owner.Revert(); + } + + [Obfuscation(Exclude = true)] + public void ShowHelp() + { + _owner.ShowHelp(); + } + } + + public ProvidersFeature(Module module) + : base(module) + { + } + + private FeatureTaskList _taskList; + + public bool CanRevert { get; private set; } + + public TaskList GetTaskList() + { + return _taskList ?? (_taskList = new FeatureTaskList(this)); + } + + public void Load() + { + Items = new List(); + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + + try + { + var section = service.GetSection("system.webServer/rewrite/providers"); + CanRevert = section.CanRevert(); + + var collection = section.GetCollection(); + foreach (ConfigurationElement providerElement in collection) + { + var item = new ProviderItem(providerElement); + Items.Add(item); + } + } + catch (Exception ex) + { + var managementUIService = (IManagementUIService)GetService(typeof(IManagementUIService)); + managementUIService.ShowError(ex, "Error loading rewrite providers", Name, false); + } + + OnRewriteSettingsSaved(); + } + + internal protected void OnRewriteSettingsSaved() + { + RewriteSettingsUpdated?.Invoke(); + } + + public bool ShowHelp() + { + DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403&clcid=0x409"); + return false; + } + + public void Add() + { + using var dialog = new AddProviderDialog(Module, this, null); + if (dialog.ShowDialog() == DialogResult.OK) + { + OnRewriteSettingsSaved(); + } + } + + public void AddSetting() + { + if (SelectedItem == null) + { + return; + } + + // TODO: + //using var dialog = new AddSettingDialog(Module, this, SelectedItem); + //if (dialog.ShowDialog() == DialogResult.OK) + //{ + // OnRewriteSettingsSaved(); + //} + } + + public void Edit() + { + DoubleClick(SelectedItem); + } + + protected override void DoubleClick(ProviderItem item) + { + if (item == null) + { + return; + } + + using var dialog = new AddProviderDialog(Module, this, item); + if (dialog.ShowDialog() == DialogResult.OK) + { + OnRewriteSettingsSaved(); + } + } + + public void Rename() + { + RenameInline(SelectedItem); + } + + public void Remove() + { + if (SelectedItem == null) + { + return; + } + + var service = (IManagementUIService)GetService(typeof(IManagementUIService)); + if (service.ShowMessage( + "Are you sure you want to remove this provider?", + "Confirm Remove", + MessageBoxButtons.YesNoCancel, + MessageBoxIcon.Question, + MessageBoxDefaultButton.Button1) != DialogResult.Yes) + { + return; + } + + var configService = (IConfigurationService)GetService(typeof(IConfigurationService)); + var section = configService.GetSection("system.webServer/rewrite/providers"); + var collection = section.GetCollection(); + + // Find and remove the item from the configuration + foreach (ConfigurationElement element in collection) + { + if ((string)element["name"] == SelectedItem.Name) + { + collection.Remove(element); + break; + } + } + + configService.ServerManager.CommitChanges(); + + // Remove from the UI + Items.Remove(SelectedItem); + SelectedItem = null; + + OnRewriteSettingsSaved(); + } + + public void Revert() + { + if (!CanRevert) + { + throw new InvalidOperationException("Revert operation cannot be done at server level"); + } + + var service = (IManagementUIService)GetService(typeof(IManagementUIService)); + var result = + service.ShowMessage( + "Reverting to the parent configuration will result in the loss of all settings in the local configuration file for this feature. Are you sure you want to continue?", + Name, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, + MessageBoxDefaultButton.Button1); + if (result != DialogResult.Yes) + { + return; + } + + this.RevertItems(); + } + + + public void AddProvider(ProviderItem provider) + { + if (provider == null) + { + return; + } + + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + var section = service.GetSection("system.webServer/rewrite/providers"); + var collection = section.GetCollection(); + + ConfigurationElement element = collection.CreateElement(); + provider.Element = element; + provider.Apply(); + collection.Add(element); + + service.ServerManager.CommitChanges(); + + Items.Add(provider); + OnRewriteSettingsSaved(); + } + + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) + { + var section = service.GetSection("system.webServer/rewrite/providers"); + return section.GetCollection(); + } + + protected override void OnSettingsSaved() + { + OnRewriteSettingsSaved(); + } + + public RewriteSettingsSavedEventHandler RewriteSettingsUpdated { get; set; } + + public string Name + { + get { return "URL Rewrite Providers"; } + } + + public virtual Version MinimumFrameworkVersion + { + get { return FxVersionNotRequired; } + } + + private static readonly Version FxVersionNotRequired = new Version(); + } +} diff --git a/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs new file mode 100644 index 00000000..e73d628b --- /dev/null +++ b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs @@ -0,0 +1,260 @@ +namespace JexusManager.Features.Rewrite +{ + using System.ComponentModel; + using System.Windows.Forms; + + partial class ProvidersPage + { + /// + /// Required designer variable. + /// + private IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.cmsActionPanel = new System.Windows.Forms.ContextMenuStrip(this.components); + this.panel2 = new System.Windows.Forms.Panel(); + this.listView1 = new System.Windows.Forms.ListView(); + this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chProviderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chEntryType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.label2 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label3 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.tsActionPanel = new System.Windows.Forms.ToolStrip(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel1.ContextMenuStrip = this.cmsActionPanel; + this.splitContainer1.Panel1.Controls.Add(this.panel2); + this.splitContainer1.Panel1.Controls.Add(this.pictureBox1); + this.splitContainer1.Panel1.Controls.Add(this.label3); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tableLayoutPanel1); + this.splitContainer1.Panel2MinSize = 200; + this.splitContainer1.Size = new System.Drawing.Size(800, 600); + this.splitContainer1.SplitterDistance = 580; + this.splitContainer1.TabIndex = 3; + this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved); + // + // cmsActionPanel + // + this.cmsActionPanel.Name = "cmsActionPanel"; + this.cmsActionPanel.Size = new System.Drawing.Size(61, 4); + // + // panel2 + // + this.panel2.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.panel2.Controls.Add(this.listView1); + this.panel2.Controls.Add(this.label2); + this.panel2.Location = new System.Drawing.Point(10, 50); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(560, 540); + this.panel2.TabIndex = 8; + // + // listView1 + // + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chName, + this.chValue, + this.chProviderType, + this.chEntryType}); + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.FullRowSelect = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(0, 13); + this.listView1.Margin = new System.Windows.Forms.Padding(5); + this.listView1.MultiSelect = false; + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(560, 527); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + this.listView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ListView1_KeyDown); + this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListView1_MouseDoubleClick); + this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged); + // + // chName + // + this.chName.Text = "Name"; + this.chName.Width = 200; + // + // chValue + // + this.chValue.Text = "Value"; + this.chValue.Width = 200; + // + // chProviderType + // + this.chProviderType.Text = "Provider Type"; + this.chProviderType.Width = 150; + // + // chEntryType + // + this.chEntryType.Text = "Entry Type"; + this.chEntryType.Width = 100; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 0); + this.label2.Margin = new System.Windows.Forms.Padding(5); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(324, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Use this feature to view and manage your URL Rewrite providers."; + // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point(10, 10); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(32, 32); + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(48, 10); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(106, 25); + this.label3.TabIndex = 2; + this.label3.Text = "Providers"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tsActionPanel, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(216, 600); + this.tableLayoutPanel1.TabIndex = 1; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.SystemColors.ActiveBorder; + this.panel1.Controls.Add(this.label1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Margin = new System.Windows.Forms.Padding(0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(216, 23); + this.panel1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(3, 5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(49, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Actions"; + // + // tsActionPanel + // + this.tsActionPanel.CanOverflow = false; + this.tsActionPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tsActionPanel.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.tsActionPanel.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow; + this.tsActionPanel.Location = new System.Drawing.Point(0, 23); + this.tsActionPanel.Name = "tsActionPanel"; + this.tsActionPanel.Size = new System.Drawing.Size(216, 577); + this.tsActionPanel.TabIndex = 2; + this.tsActionPanel.Text = "toolStrip1"; + // + // ProvidersPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "ProvidersPage"; + this.Size = new System.Drawing.Size(800, 600); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private SplitContainer splitContainer1; + private ListView listView1; + private ColumnHeader chName; + private ColumnHeader chValue; + private ColumnHeader chProviderType; + private ColumnHeader chEntryType; + private TableLayoutPanel tableLayoutPanel1; + private Panel panel1; + private Label label1; + private ToolStrip tsActionPanel; + private Label label2; + private Label label3; + private PictureBox pictureBox1; + private Panel panel2; + private ContextMenuStrip cmsActionPanel; + } +} diff --git a/JexusManager.Features.Rewrite/ProvidersPage.cs b/JexusManager.Features.Rewrite/ProvidersPage.cs new file mode 100644 index 00000000..553eae6e --- /dev/null +++ b/JexusManager.Features.Rewrite/ProvidersPage.cs @@ -0,0 +1,195 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.Collections; + using System.ComponentModel; + using System.Reflection; + using System.Windows.Forms; + + using JexusManager.Properties; + using JexusManager.Services; + + using Microsoft.Web.Management.Client; + using Microsoft.Web.Management.Client.Win32; + + internal partial class ProvidersPage : ModuleListPage, IModuleChildPage + { + private sealed class PageTaskList : ShowHelpTaskList + { + private readonly ProvidersPage _owner; + + public PageTaskList(ProvidersPage owner) + { + _owner = owner; + } + + public override ICollection GetTaskItems() + { + return new TaskItem[] + { + GetBackTaskItem("Back", "Back to Rules"), + MethodTaskItem.CreateSeparator().SetUsage(), + HelpTaskItem + }; + } + + [Obfuscation(Exclude = true)] + public override void ShowHelp() + { + _owner.ShowHelp(); + } + + [Obfuscation(Exclude = true)] + public void Back() + { + _owner.Back(); + } + } + + private sealed class ProviderListViewItem : ListViewItem, IFeatureListViewItem + { + public ProviderItem Item { get; } + private readonly ProvidersPage _page; + + public ProviderListViewItem(ProviderItem item, ProvidersPage page) + : base(item.Name) + { + Item = item; + _page = page; + SubItems.Add(new ListViewSubItem(this, string.Empty /*item.Value*/)); // TODO: + SubItems.Add(new ListViewSubItem(this, item.Type)); + SubItems.Add(new ListViewSubItem(this, item.Flag)); + } + } + + private ProvidersFeature _feature; + private PageTaskList _taskList; + + public ProvidersPage() + { + InitializeComponent(); + + // Set the labels from resources if needed + label3.Text = "Rewrite Providers"; + label2.Text = "Providers implement custom rewrite logic and can be invoked from inbound and outbound rewrite rules."; + } + + protected override void Initialize(object navigationData) + { + base.Initialize(navigationData); + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + pictureBox1.Image = service.Scope.GetImage(); + + _feature = new ProvidersFeature(Module); + _feature.RewriteSettingsUpdated = InitializeListPage; + _feature.Load(); + + _feature.InitializeMouseClick(listView1, (item, text) => + { + item.Name = text; + item.Apply(); + }, + text => + { + if (_feature.FindDuplicate(item => item.Name, text)) + { + var service = (IManagementUIService)GetService(typeof(IManagementUIService)); + service.ShowMessage("A rewrite provider with this name already exists.", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return false; + } + + return true; + }); + } + + protected override void InitializeListPage() + { + listView1.Items.Clear(); + foreach (var provider in _feature.Items) + { + listView1.Items.Add(new ProviderListViewItem(provider, this)); + } + + _feature.InitializeColumnClick(listView1); + + if (_feature.SelectedItem != null) + { + foreach (ProviderListViewItem item in listView1.Items) + { + if (item.Item == _feature.SelectedItem) + { + item.Selected = true; + } + } + } + + Refresh(); + } + + protected override void Refresh() + { + Tasks.Fill(tsActionPanel, cmsActionPanel); + base.Refresh(); + } + + private void ListView1_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete) + { + _feature.Remove(); + } + } + + private void ListView1_MouseDoubleClick(object sender, MouseEventArgs e) + { + _feature.HandleMouseDoubleClick(listView1); + } + + private void ListView1_SelectedIndexChanged(object sender, EventArgs e) + { + _feature.HandleSelectedIndexChanged(listView1); + Refresh(); + } + + private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) + { + if (splitContainer1.Panel2.Width > 500) + { + splitContainer1.SplitterDistance = splitContainer1.Width - 500; + } + } + + protected override bool ShowHelp() + { + return _feature.ShowHelp(); + } + + private void Back() + { + var service = (INavigationService)GetService(typeof(INavigationService)); + service?.NavigateBack(1); + } + + protected override TaskListCollection Tasks + { + get + { + if (_taskList == null) + { + _taskList = new PageTaskList(this); + } + + base.Tasks.Add(_feature.GetTaskList()); + base.Tasks.Add(_taskList); + return base.Tasks; + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IModulePage ParentPage { get; set; } + } +} diff --git a/JexusManager.Features.Rewrite/Resources/ProvidersPage.resx b/JexusManager.Features.Rewrite/Resources/ProvidersPage.resx new file mode 100644 index 00000000..2b683712 --- /dev/null +++ b/JexusManager.Features.Rewrite/Resources/ProvidersPage.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Providers + + + Use this feature to view and manage your URL Rewrite providers. + + + Name + + + Type + + + Actions + + diff --git a/JexusManager.Features.Rewrite/RewriteFeature.cs b/JexusManager.Features.Rewrite/RewriteFeature.cs index 6134bb6d..5266339f 100644 --- a/JexusManager.Features.Rewrite/RewriteFeature.cs +++ b/JexusManager.Features.Rewrite/RewriteFeature.cs @@ -362,7 +362,8 @@ private void ViewPreconditions() private void ViewProviders() { - // TODO: + var service = (INavigationService)GetService(typeof(INavigationService)); + service.Navigate(null, null, typeof(ProvidersPage), null); } private void ViewMaps() diff --git a/JexusManager.Features.Rewrite/SettingItem.cs b/JexusManager.Features.Rewrite/SettingItem.cs new file mode 100644 index 00000000..aeaa2a3d --- /dev/null +++ b/JexusManager.Features.Rewrite/SettingItem.cs @@ -0,0 +1,50 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using Microsoft.Web.Administration; + + public class SettingItem : IItem + { + public ConfigurationElement Element { get; set; } + + public SettingItem(ConfigurationElement element) + { + Element = element; + if (element == null) + { + Key = string.Empty; + Value = string.Empty; + return; + } + + Key = (string)element["key"]; + Value = (string)element["value"]; + // TODO: encryptedValue + } + + public string Key { get; set; } + + public string Value { get; set; } + + public string Flag { get; set; } + + public void Apply() + { + Element["key"] = Key; + Element["value"] = Value; + } + + public bool Match(SettingItem other) + { + return other != null && Key == other.Key; + } + + public bool Equals(SettingItem other) + { + return Match(other) && Value == other.Value; + } + } +} diff --git a/JexusManager.slnx b/JexusManager.slnx new file mode 100644 index 00000000..21f2e04d --- /dev/null +++ b/JexusManager.slnx @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f8d2e5191babf17f255f2b5d4d0857cf5680b007 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Tue, 8 Apr 2025 01:56:23 -0400 Subject: [PATCH 4/7] Added provider settings support. --- .husky/pre-commit | 3 + .husky/task-runner.json | 14 + .vscode/settings.json | 5 +- .../AccessSettingsSavedEventHandler.cs | 2 +- JexusManager.Features.Asp/AspItem.cs | 2 +- .../AspSettingsSavedEventHandler.cs | 2 +- .../AnonymousItem.cs | 2 +- .../BasicItem.cs | 2 +- .../DigestItem.cs | 2 +- .../ImpersonationEditDialog.cs | 4 +- .../AuthorizationSettingsSavedEventHandler.cs | 2 +- .../CachingSettingsSavedEventHandler.cs | 2 +- .../CertificatesFeature.cs | 2 +- .../CertificatesSettingsSavedEventHandler.cs | 2 +- .../SelfCertificateDialog.cs | 4 +- .../CgiSettingsSavedEventHandler.cs | 2 +- .../CompressionPage.cs | 7 +- .../CompressionSettingsSavedEventHandler.cs | 2 +- ...efaultDocumentSettingsSavedEventHandler.cs | 2 +- ...irectoryBrowseSettingsSavedEventHandler.cs | 2 +- .../HandlersItem.cs | 2 +- .../HandlersSettingsSavedEventHandler.cs | 2 +- .../NewMappingDialog.cs | 4 +- .../HttpErrorsPage.cs | 2 +- .../HttpErrorsSettingsSavedEventHandler.cs | 2 +- .../HttpRedirectSettingsSavedEventHandler.cs | 2 +- .../IpSecurityPage.cs | 2 +- .../IpSecuritySettingsSavedEventHandler.cs | 2 +- .../IsapiCgiRestrictionPage.cs | 2 +- ...CgiRestrictionSettingsSavedEventHandler.cs | 2 +- .../IsapiFiltersPage.cs | 4 +- .../IsapiFiltersSettingsSavedEventHandler.cs | 2 +- .../AddFieldDialog.cs | 2 +- .../LoggingFeature.cs | 8 +- .../LoggingSettingsSavedEventHandler.cs | 2 +- .../MimeMapFeature.cs | 2 +- JexusManager.Features.MimeMap/MimeMapPage.cs | 2 +- .../MimeMapSettingsSavedEventHandler.cs | 2 +- JexusManager.Features.Modules/ModulesItem.cs | 8 +- .../ModulesSettingsSavedEventHandler.cs | 2 +- .../AppliesToItem.cs | 2 +- .../DenyStringsItem.cs | 2 +- .../IRequestFilteringFeature.cs | 2 +- ...questFilteringSettingsSavedEventHandler.cs | 2 +- .../ResponseHeadersFeature.cs | 2 +- ...esponseHeadersSettingsSavedEventHandler.cs | 2 +- .../AddProviderDialog.cs | 30 +- .../AddProviderSettingDialog.Designer.cs | 139 +++++++++ .../AddProviderSettingDialog.cs | 125 ++++++++ .../Inbound/MapPage.cs | 2 +- .../Inbound/MapSettingsUpdatedEventHandler.cs | 2 +- .../Inbound/MapsPage.cs | 2 +- .../Outbound/CustomTagsPage.cs | 2 +- JexusManager.Features.Rewrite/ProviderItem.cs | 10 +- .../ProvidersFeature.cs | 61 ++-- .../ProvidersPage.cs | 6 +- .../RewriteSettingsSavedEventHandler.cs | 2 +- .../RuleSettingsUpdatedEventHandler.cs | 2 +- JexusManager.Features.Rewrite/SettingItem.cs | 21 +- .../SettingsFeature.cs | 192 ++++++++++++ .../SettingsPage.Designer.cs | 282 ++++++++++++++++++ JexusManager.Features.Rewrite/SettingsPage.cs | 229 ++++++++++++++ .../SettingsDialog.cs | 2 +- .../Wizards/AddTraceWizard/ConditionsPage.cs | 2 +- JexusManager.Shared/BindingUtility.cs | 12 +- JexusManager.Shared/ColumnClickHook.cs | 2 +- JexusManager.Shared/DialogHelper.cs | 4 +- .../Features/TaskItemExtensions.cs | 4 +- JexusManager.Shared/NativeMethods.cs | 4 +- JexusManager.Shared/StringUtility.cs | 2 +- JexusManager.sln | 270 ----------------- JexusManager.slnx | 2 +- JexusManager/BindingExtensions.cs | 2 +- JexusManager/Dialogs/NewSiteDialog.cs | 4 +- .../Dialogs/NewVirtualDirectoryDialog.cs | 154 +++++----- JexusManager/Dialogs/SelectPoolDialog.cs | 2 +- .../Main/ApplicationPoolAdvancedSettings.cs | 2 +- .../Features/Main/ApplicationPoolsFeature.cs | 14 +- .../Features/Main/ApplicationPoolsPage.cs | 2 +- .../Features/Main/ApplicationsFeature.cs | 20 +- .../Features/Main/BindingDiagDialog.cs | 26 +- JexusManager/Features/Main/HomePage.cs | 12 +- .../Features/Main/KestrelDiagDialog.cs | 42 +-- .../Main/ModulePageInfoListViewItem.cs | 2 +- JexusManager/Features/Main/PhpDiagDialog.cs | 42 +-- JexusManager/Features/Main/SiteFeature.cs | 2 +- JexusManager/Features/Main/SitesFeature.cs | 12 +- JexusManager/Features/Main/SslDiagDialog.cs | 42 +-- .../Main/VirtualDirectoriesFeature.cs | 14 +- .../Features/Main/VirtualDirectoriesPage.cs | 4 +- JexusManager/Features/Main/VsDiagDialog.cs | 40 +-- JexusManager/LoggingService.cs | 2 +- JexusManager/MainForm.cs | 44 +-- JexusManager/Program.cs | 2 +- JexusManager/Services/NavigationService.cs | 46 +-- .../Tree/Hierarchy/ManagerHierarchyInfo.cs | 2 +- JexusManager/Tree/PlaceholderTreeNode.cs | 2 +- JexusManager/UpdateHelper.cs | 2 +- .../Wizards/ConnectionWizard/BrowsePage.cs | 2 +- Microsoft.Web.Administration/Application.cs | 4 +- .../ApplicationCollection.cs | 2 +- .../AspNetCoreHelper.cs | 4 +- Microsoft.Web.Administration/Binding.cs | 6 +- .../ConfigurationAttribute.cs | 18 +- .../ConfigurationAttributeSchema.cs | 2 +- .../ConfigurationElement.cs | 6 +- Microsoft.Web.Administration/FileContext.cs | 6 +- .../IisExpressServerManager.cs | 10 +- Microsoft.Web.Administration/JexusHelper.cs | 250 +++++++--------- .../JexusServerManager.cs | 2 +- Microsoft.Web.Administration/NativeMethods.cs | 16 +- .../ProtectedConfigurationProvider.cs | 20 +- .../ProtectedProviderSettings.cs | 2 +- Microsoft.Web.Administration/ServerManager.cs | 4 +- Microsoft.Web.Administration/Site.cs | 2 +- Microsoft.Web.Administration/SiteLogFile.cs | 8 +- Microsoft.Web.Administration/WorkerProcess.cs | 9 +- .../AesEncryptionProvider.cs | 2 +- .../AppHostFileProvider.cs | 2 +- .../IAppHostProvider.cs | 2 +- .../IAppHostProviderChangeHandler.cs | 2 +- .../IApplication.cs | 2 +- .../IApplicationPool.cs | 2 +- .../ICpu.cs | 2 +- .../ICustomField.cs | 2 +- .../ICustomFields.cs | 2 +- .../IEnumApplicationPool.cs | 2 +- .../IEnumApplications.cs | 2 +- .../IEnumBindings.cs | 2 +- .../IEnumCustomFields.cs | 2 +- .../IEnumEnvironmentVariables.cs | 2 +- .../IEnumListenerAdapter.cs | 2 +- .../IEnumLocation.cs | 2 +- .../IEnumSchedule.cs | 2 +- .../IEnumSite.cs | 2 +- .../IEnumVirtualDirectory.cs | 2 +- .../IEnvironmentVariable.cs | 2 +- .../IFailure.cs | 2 +- .../IListenerAdapter.cs | 2 +- .../ILocation.cs | 2 +- .../ILogSettings.cs | 2 +- .../IPeriodicRestart.cs | 2 +- .../IProcessModel.cs | 2 +- .../IRecycling.cs | 2 +- .../ISchedule.cs | 2 +- .../ISiteBinding.cs | 2 +- .../ISiteLimits.cs | 2 +- .../ISiteLogFile.cs | 2 +- .../ISiteTraceRequestsLogging.cs | 2 +- .../IVirtualDirectory.cs | 2 +- .../IWebLimits.cs | 2 +- .../NativeMethods.cs | 8 +- Microsoft.Web.Management/Client/Connection.cs | 2 +- .../Client/ConnectionActiveState.cs | 2 +- .../Client/ConnectionCredential.cs | 2 +- .../Client/ConnectionEventArgs.cs | 2 +- .../Client/ConnectionEventHandler.cs | 2 +- .../Client/ConnectionInfo.cs | 2 +- .../Client/ConnectionInfoCollection.cs | 2 +- .../Client/ControlPanelCategorization.cs | 2 +- .../Client/ControlPanelCategoryInfo.cs | 2 +- .../Client/CredentialInfo.cs | 2 +- .../Client/CredentialInfoEventArgs.cs | 2 +- ...AuthenticationSettingsSavedEventHandler.cs | 2 +- .../Client/Extensions/AuthenticationType.cs | 2 +- .../Client/Extensions/HomepageExtension.cs | 2 +- .../Extensions/IHomepageTaskListProvider.cs | 2 +- .../Client/Extensions/ProtocolProvider.cs | 2 +- .../Client/Extensions/ProviderFeature.cs | 2 +- .../Client/Extensions/SiteAction.cs | 2 +- .../Client/Extensions/SiteUpdatedEventArgs.cs | 2 +- .../Client/GroupTaskItem.cs | 2 +- .../Client/HierarchyCollectionEventArgs.cs | 2 +- .../Client/HierarchyCollectionEventHandler.cs | 2 +- .../Client/HierarchyInfo.cs | 2 +- .../Client/HierarchyInfoEventArgs.cs | 2 +- .../Client/HierarchyInfoEventHandler.cs | 2 +- .../HierarchyInfoSyncSelectionEventArgs.cs | 2 +- .../Client/HierarchyPriority.cs | 2 +- .../Client/HierarchyProvider.cs | 2 +- .../Client/HierarchyRenameEventArgs.cs | 2 +- .../Client/HierarchyService.cs | 2 +- .../Client/HierarchyVisibility.cs | 2 +- .../Client/ICertificateVerificationBuilder.cs | 2 +- .../Client/IConnectionBuilder.cs | 2 +- .../Client/IConnectionManager.cs | 2 +- .../Client/IControlPanel.cs | 2 +- .../Client/ICredentialBuilder.cs | 2 +- .../Client/IExtensibilityManager.cs | 2 +- .../Client/IModuleChildPage.cs | 2 +- .../Client/IModulePage.cs | 2 +- .../Client/INavigationService.cs | 2 +- .../Client/IPreferencesService.cs | 2 +- .../Client/IPropertyEditingService.cs | 2 +- .../Client/IPropertyEditingUser.cs | 2 +- .../Client/IProviderConfigurationService.cs | 2 +- .../Client/ManagementChannel.cs | 2 +- .../Client/ManagementScopePath.cs | 2 +- .../Client/MessageTaskItem.cs | 2 +- .../Client/MessageTaskItemType.cs | 2 +- .../Client/MethodTaskItemUsages.cs | 2 +- .../Client/ModuleHomepageAttribute.cs | 2 +- .../Client/ModuleListPageGrouping.cs | 2 +- .../Client/ModuleListPageSearchField.cs | 2 +- .../Client/ModuleListPageSearchOptions.cs | 2 +- .../Client/ModuleListPageViewModes.cs | 2 +- .../Client/ModulePageIdentifierAttribute.cs | 2 +- .../Client/ModulePageInfo.cs | 2 +- .../Client/ModuleServiceProxy.cs | 2 +- .../Client/NavigationEventArgs.cs | 2 +- .../Client/NavigationEventHandler.cs | 2 +- .../Client/NavigationItem.cs | 2 +- .../Client/PreferencesStore.cs | 2 +- .../Client/PropertyGridObject.cs | 2 +- .../Client/ProviderConfigurationSettings.cs | 2 +- Microsoft.Web.Management/Client/TaskItem.cs | 2 +- Microsoft.Web.Management/Client/TaskList.cs | 2 +- .../Client/TaskListCollection.cs | 2 +- .../Client/Win32/BaseTaskForm.cs | 2 +- .../Client/Win32/DialogForm.cs | 2 +- .../Client/Win32/IManagementUIService.cs | 2 +- .../Client/Win32/ManagementUIColorTable.cs | 2 +- .../Client/Win32/ModulePropertiesPage.cs | 2 +- .../Client/Win32/SortableListView.cs | 2 +- .../Client/Win32/TaskForm.cs | 2 +- .../Client/Win32/TextTaskItem.cs | 2 +- .../Client/Win32/WaitCursor.cs | 2 +- .../Host/IManagementHost.cs | 2 +- .../Host/Shell/ShellComponents.cs | 2 +- .../Server/AdministrationModule.cs | 2 +- .../Server/AdministrationModuleCollection.cs | 2 +- .../Server/AdministrationModuleProvider.cs | 2 +- .../Server/ApplicationManagementUnit.cs | 2 +- .../Server/BindingInfo.cs | 2 +- ...onfigurationAuthenticationModuleService.cs | 2 +- .../Server/ConfigurationModuleProvider.cs | 2 +- .../Server/ConfigurationPathType.cs | 2 +- .../Server/DelegationState.cs | 2 +- .../Server/IAuthenticationModuleService.cs | 2 +- .../Server/IGlobalConfigurationProvider.cs | 2 +- .../Server/IManagementContext.cs | 2 +- .../Server/ISiteStatusProvider.cs | 2 +- .../Server/InvalidPasswordReason.cs | 2 +- .../ManagementAdministrationConfiguration.cs | 2 +- .../Server/ManagementAuthentication.cs | 2 +- .../ManagementAuthenticationProvider.cs | 2 +- .../Server/ManagementAuthorization.cs | 2 +- .../Server/ManagementAuthorizationInfo.cs | 2 +- .../ManagementAuthorizationInfoCollection.cs | 2 +- .../Server/ManagementAuthorizationProvider.cs | 2 +- .../Server/ManagementConfiguration.cs | 2 +- .../Server/ManagementConfigurationPath.cs | 2 +- .../Server/ManagementContentNavigator.cs | 2 +- .../Server/ManagementFrameworkVersion.cs | 2 +- .../Server/ManagementScope.cs | 2 +- .../Server/ManagementUnit.cs | 2 +- .../Server/ManagementUserInfo.cs | 2 +- .../Server/ManagementUserInfoCollection.cs | 2 +- .../Server/ModuleDefinition.cs | 2 +- Microsoft.Web.Management/Server/ModuleInfo.cs | 2 +- .../Server/ModuleService.cs | 2 +- .../Server/ModuleServiceMethodAttribute.cs | 2 +- .../Server/ServerManagementUnit.cs | 2 +- .../Server/SimpleDelegatedModuleProvider.cs | 2 +- Microsoft.Web.Management/Server/SiteInfo.cs | 2 +- .../Server/SiteManagementUnit.cs | 2 +- .../Server/TypeInformationGenerator.cs | 2 +- .../Server/WebManagementEventLog.cs | 2 +- .../Server/WebManagementServiceException.cs | 2 +- ...estAuthenticationFeatureSiteTestFixture.cs | 2 +- .../Caching/CachingFeatureSiteTestFixture.cs | 2 +- .../StringUtilityTestFixture.cs | 6 +- Tests/TestCases.cs | 14 +- lib/CheckBoxComboBox/CheckBoxComboBox.cs | 36 +-- lib/CheckBoxComboBox/NativeMethods.cs | 2 +- lib/CheckBoxComboBox/Popup.cs | 6 +- .../ListSelectionWrapper.cs | 2 +- .../ObjectSelectionWrapper.cs | 4 +- 278 files changed, 1764 insertions(+), 1075 deletions(-) create mode 100644 .husky/pre-commit create mode 100644 .husky/task-runner.json create mode 100644 JexusManager.Features.Rewrite/AddProviderSettingDialog.Designer.cs create mode 100644 JexusManager.Features.Rewrite/AddProviderSettingDialog.cs create mode 100644 JexusManager.Features.Rewrite/SettingsFeature.cs create mode 100644 JexusManager.Features.Rewrite/SettingsPage.Designer.cs create mode 100644 JexusManager.Features.Rewrite/SettingsPage.cs delete mode 100644 JexusManager.sln diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..e1b1d7a4 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,3 @@ +#!/bin/sh +dotnet format +git add -A \ No newline at end of file diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 00000000..b56ea275 --- /dev/null +++ b/.husky/task-runner.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", + "tasks": [ + { + "name": "welcome-message-example", + "command": "bash", + "args": [ "-c", "echo Husky.Net is awesome!" ], + "windows": { + "command": "cmd", + "args": ["/c", "echo Husky.Net is awesome!" ] + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9fa61c3d..bf89e076 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,3 @@ -{ - "dotnet.preferCSharpExtension": true, - "dotnet.defaultSolution": "JexusManager.sln" +{ + "dotnet.defaultSolution": "JexusManager.slnx" } \ No newline at end of file diff --git a/JexusManager.Features.Access/AccessSettingsSavedEventHandler.cs b/JexusManager.Features.Access/AccessSettingsSavedEventHandler.cs index 2ddba5e9..4a5dd7ec 100644 --- a/JexusManager.Features.Access/AccessSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Access/AccessSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Access { public delegate void AccessSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Asp/AspItem.cs b/JexusManager.Features.Asp/AspItem.cs index 5ce06e4a..7e07d773 100644 --- a/JexusManager.Features.Asp/AspItem.cs +++ b/JexusManager.Features.Asp/AspItem.cs @@ -116,7 +116,7 @@ public void Apply() attribute.Delete(); } else - { + { attribute.Value = ComPlusProperties.SxsName; } diff --git a/JexusManager.Features.Asp/AspSettingsSavedEventHandler.cs b/JexusManager.Features.Asp/AspSettingsSavedEventHandler.cs index 16254c94..298567e1 100644 --- a/JexusManager.Features.Asp/AspSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Asp/AspSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Asp { public delegate void AspSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Authentication/AnonymousItem.cs b/JexusManager.Features.Authentication/AnonymousItem.cs index fd5b9df0..0ad338b1 100644 --- a/JexusManager.Features.Authentication/AnonymousItem.cs +++ b/JexusManager.Features.Authentication/AnonymousItem.cs @@ -26,4 +26,4 @@ public void Apply() Element["password"] = Password; } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.Authentication/BasicItem.cs b/JexusManager.Features.Authentication/BasicItem.cs index 82d266d4..e26e30cd 100644 --- a/JexusManager.Features.Authentication/BasicItem.cs +++ b/JexusManager.Features.Authentication/BasicItem.cs @@ -26,4 +26,4 @@ public void Apply() Element["realm"] = Realm; } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.Authentication/DigestItem.cs b/JexusManager.Features.Authentication/DigestItem.cs index a3e0599d..dce96888 100644 --- a/JexusManager.Features.Authentication/DigestItem.cs +++ b/JexusManager.Features.Authentication/DigestItem.cs @@ -23,4 +23,4 @@ public void Apply() Element["realm"] = Realm; } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.Authentication/ImpersonationEditDialog.cs b/JexusManager.Features.Authentication/ImpersonationEditDialog.cs index 05501bbe..32a2b3dd 100644 --- a/JexusManager.Features.Authentication/ImpersonationEditDialog.cs +++ b/JexusManager.Features.Authentication/ImpersonationEditDialog.cs @@ -61,8 +61,8 @@ public ImpersonationEditDialog(IServiceProvider serviceProvider, ImpersonationIt if (rbPool.Checked) { existing.Name = string.Empty; - // TODO: reset password. - existing.Password = null; + // TODO: reset password. + existing.Password = null; } existing.Apply(); diff --git a/JexusManager.Features.Authorization/AuthorizationSettingsSavedEventHandler.cs b/JexusManager.Features.Authorization/AuthorizationSettingsSavedEventHandler.cs index e042e1d0..b28e3305 100644 --- a/JexusManager.Features.Authorization/AuthorizationSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Authorization/AuthorizationSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Authorization { public delegate void AuthorizationSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Caching/CachingSettingsSavedEventHandler.cs b/JexusManager.Features.Caching/CachingSettingsSavedEventHandler.cs index 05cf21cd..951326c9 100644 --- a/JexusManager.Features.Caching/CachingSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Caching/CachingSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Caching { public delegate void CachingSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Certificates/CertificatesFeature.cs b/JexusManager.Features.Certificates/CertificatesFeature.cs index 49ee89b2..4c160711 100644 --- a/JexusManager.Features.Certificates/CertificatesFeature.cs +++ b/JexusManager.Features.Certificates/CertificatesFeature.cs @@ -337,7 +337,7 @@ private void DeleteCertificate() { var message = Microsoft.Web.Administration.NativeMethods.KnownCases(ex.NativeErrorCode); if (string.IsNullOrEmpty(message)) - { + { _logger.LogError(ex, "Win32 error deleting certificate. Native error code: {Code}", ex.NativeErrorCode); } else diff --git a/JexusManager.Features.Certificates/CertificatesSettingsSavedEventHandler.cs b/JexusManager.Features.Certificates/CertificatesSettingsSavedEventHandler.cs index 3fe2e50a..2352354b 100644 --- a/JexusManager.Features.Certificates/CertificatesSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Certificates/CertificatesSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Certificates { public delegate void CertificatesSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Certificates/SelfCertificateDialog.cs b/JexusManager.Features.Certificates/SelfCertificateDialog.cs index fb28cf60..61cb4b84 100644 --- a/JexusManager.Features.Certificates/SelfCertificateDialog.cs +++ b/JexusManager.Features.Certificates/SelfCertificateDialog.cs @@ -138,7 +138,7 @@ public SelfCertificateDialog(IServiceProvider serviceProvider, CertificatesFeatu string hashName = cbHashing.SelectedIndex == 0 ? "SHA1WithRSA" : "SHA256WithRSA"; var factory = new Asn1SignatureFactory(hashName, cerKp.Private, random); - + string p12File = Path.GetTempFileName(); string p12pwd = "test"; @@ -185,7 +185,7 @@ public SelfCertificateDialog(IServiceProvider serviceProvider, CertificatesFeatu var message = Microsoft.Web.Administration.NativeMethods.KnownCases(ex.NativeErrorCode); if (string.IsNullOrEmpty(message)) { - _logger.LogError(ex, "Win32 error installing certificate. Native error code: {Code}", ex.NativeErrorCode); + _logger.LogError(ex, "Win32 error installing certificate. Native error code: {Code}", ex.NativeErrorCode); } else { diff --git a/JexusManager.Features.Cgi/CgiSettingsSavedEventHandler.cs b/JexusManager.Features.Cgi/CgiSettingsSavedEventHandler.cs index 31789ef9..1d6b6677 100644 --- a/JexusManager.Features.Cgi/CgiSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Cgi/CgiSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Cgi { public delegate void CgiSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Compression/CompressionPage.cs b/JexusManager.Features.Compression/CompressionPage.cs index a706ad0a..c474c21c 100644 --- a/JexusManager.Features.Compression/CompressionPage.cs +++ b/JexusManager.Features.Compression/CompressionPage.cs @@ -141,9 +141,12 @@ protected override bool HasChanges protected override bool CanApplyChanges { - get { return !gbStatic.Visible || (!string.IsNullOrWhiteSpace(txtFileSize.Text) + get + { + return !gbStatic.Visible || (!string.IsNullOrWhiteSpace(txtFileSize.Text) && !string.IsNullOrWhiteSpace(txtPath.Text) - && !string.IsNullOrWhiteSpace(txtDiskspaceLimit.Text)); } + && !string.IsNullOrWhiteSpace(txtDiskspaceLimit.Text)); + } } private void InformChanges() diff --git a/JexusManager.Features.Compression/CompressionSettingsSavedEventHandler.cs b/JexusManager.Features.Compression/CompressionSettingsSavedEventHandler.cs index 9e5e1ba3..03dd61a0 100644 --- a/JexusManager.Features.Compression/CompressionSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Compression/CompressionSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Compression { public delegate void CompressionSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.DefaultDocument/DefaultDocumentSettingsSavedEventHandler.cs b/JexusManager.Features.DefaultDocument/DefaultDocumentSettingsSavedEventHandler.cs index fef86a2f..e86b1652 100644 --- a/JexusManager.Features.DefaultDocument/DefaultDocumentSettingsSavedEventHandler.cs +++ b/JexusManager.Features.DefaultDocument/DefaultDocumentSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.DefaultDocument { public delegate void DefaultDocumentSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.DirectoryBrowse/DirectoryBrowseSettingsSavedEventHandler.cs b/JexusManager.Features.DirectoryBrowse/DirectoryBrowseSettingsSavedEventHandler.cs index ba7ae2ba..f06854a4 100644 --- a/JexusManager.Features.DirectoryBrowse/DirectoryBrowseSettingsSavedEventHandler.cs +++ b/JexusManager.Features.DirectoryBrowse/DirectoryBrowseSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.DirectoryBrowse { public delegate void DirectoryBrowseSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Handlers/HandlersItem.cs b/JexusManager.Features.Handlers/HandlersItem.cs index af281838..a5bc95a2 100644 --- a/JexusManager.Features.Handlers/HandlersItem.cs +++ b/JexusManager.Features.Handlers/HandlersItem.cs @@ -150,4 +150,4 @@ public bool Match(HandlersItem other) return other != null && other.Name == this.Name; } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.Handlers/HandlersSettingsSavedEventHandler.cs b/JexusManager.Features.Handlers/HandlersSettingsSavedEventHandler.cs index eba701d4..67383cbe 100644 --- a/JexusManager.Features.Handlers/HandlersSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Handlers/HandlersSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Handlers { public delegate void HandlersSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Handlers/NewMappingDialog.cs b/JexusManager.Features.Handlers/NewMappingDialog.cs index 8868e648..b34694ad 100644 --- a/JexusManager.Features.Handlers/NewMappingDialog.cs +++ b/JexusManager.Features.Handlers/NewMappingDialog.cs @@ -58,13 +58,13 @@ public NewMappingDialog(IServiceProvider serviceProvider, HandlersItem existing, Item.Modules = txtModule.Text; Item.Name = txtName.Text; Item.Path = txtPath.Text; - if ((txtModule.Text == "FastCgiModule" || txtModule.Text == "CgiModule") + if ((txtModule.Text == "FastCgiModule" || txtModule.Text == "CgiModule") && !string.Equals(Path.GetExtension(Item.ScriptProcessor), ".exe", StringComparison.OrdinalIgnoreCase)) { ShowMessage("The executable specified for the CgiModule or the FastCgiModule should be a .exe file."); return; } - + if (!txtName.ReadOnly) { if (_feature.Items.Any(item => item.Match(Item))) diff --git a/JexusManager.Features.HttpErrors/HttpErrorsPage.cs b/JexusManager.Features.HttpErrors/HttpErrorsPage.cs index f510fff8..782b362c 100644 --- a/JexusManager.Features.HttpErrors/HttpErrorsPage.cs +++ b/JexusManager.Features.HttpErrors/HttpErrorsPage.cs @@ -111,7 +111,7 @@ private void ListView1_MouseDoubleClick(object sender, EventArgs e) { _feature.HandleMouseDoubleClick(listView1); } - + private void listView1_SelectedIndexChanged(object sender, EventArgs e) { _feature.HandleSelectedIndexChanged(listView1); diff --git a/JexusManager.Features.HttpErrors/HttpErrorsSettingsSavedEventHandler.cs b/JexusManager.Features.HttpErrors/HttpErrorsSettingsSavedEventHandler.cs index 350a05d8..9c117bcd 100644 --- a/JexusManager.Features.HttpErrors/HttpErrorsSettingsSavedEventHandler.cs +++ b/JexusManager.Features.HttpErrors/HttpErrorsSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.HttpErrors { public delegate void HttpErrorsSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.HttpRedirect/HttpRedirectSettingsSavedEventHandler.cs b/JexusManager.Features.HttpRedirect/HttpRedirectSettingsSavedEventHandler.cs index fd47d877..a13db0f0 100644 --- a/JexusManager.Features.HttpRedirect/HttpRedirectSettingsSavedEventHandler.cs +++ b/JexusManager.Features.HttpRedirect/HttpRedirectSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.HttpRedirect { public delegate void HttpRedirectSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.IpSecurity/IpSecurityPage.cs b/JexusManager.Features.IpSecurity/IpSecurityPage.cs index 103b65df..84d862a1 100644 --- a/JexusManager.Features.IpSecurity/IpSecurityPage.cs +++ b/JexusManager.Features.IpSecurity/IpSecurityPage.cs @@ -111,7 +111,7 @@ private void ListView1_MouseDoubleClick(object sender, EventArgs e) { _feature.HandleMouseDoubleClick(listView1); } - + private void listView1_SelectedIndexChanged(object sender, EventArgs e) { _feature.HandleSelectedIndexChanged(listView1); diff --git a/JexusManager.Features.IpSecurity/IpSecuritySettingsSavedEventHandler.cs b/JexusManager.Features.IpSecurity/IpSecuritySettingsSavedEventHandler.cs index 003f3509..46043454 100644 --- a/JexusManager.Features.IpSecurity/IpSecuritySettingsSavedEventHandler.cs +++ b/JexusManager.Features.IpSecurity/IpSecuritySettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.IpSecurity { public delegate void IpSecuritySettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs index c02f8f99..dbe53b50 100644 --- a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs +++ b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionPage.cs @@ -111,7 +111,7 @@ private void ListView1KeyDown(object sender, KeyEventArgs e) private void ListView1MouseDoubleClick(object sender, MouseEventArgs e) { _feature.HandleMouseDoubleClick(listView1); - } + } private void ListView1SelectedIndexChanged(object sender, EventArgs e) { diff --git a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionSettingsSavedEventHandler.cs b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionSettingsSavedEventHandler.cs index c0245317..ad204e7a 100644 --- a/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionSettingsSavedEventHandler.cs +++ b/JexusManager.Features.IsapiCgiRestriction/IsapiCgiRestrictionSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.IsapiCgiRestriction { public delegate void IsapiCgiRestrictionSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs index 1f0908c3..2ca04b79 100644 --- a/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs +++ b/JexusManager.Features.IsapiFilters/IsapiFiltersPage.cs @@ -69,7 +69,7 @@ protected override void Initialize(object navigationData) { item.Name = text; item.Apply(); - }, + }, text => { if (_feature.FindDuplicate(item => item.Name, text)) @@ -127,7 +127,7 @@ private void ListView1KeyDown(object sender, KeyEventArgs e) private void ListView1MouseDoubleClick(object sender, MouseEventArgs e) { _feature.HandleMouseDoubleClick(listView1); - } + } private void ListView1SelectedIndexChanged(object sender, EventArgs e) { diff --git a/JexusManager.Features.IsapiFilters/IsapiFiltersSettingsSavedEventHandler.cs b/JexusManager.Features.IsapiFilters/IsapiFiltersSettingsSavedEventHandler.cs index 026e00d0..fe0544e6 100644 --- a/JexusManager.Features.IsapiFilters/IsapiFiltersSettingsSavedEventHandler.cs +++ b/JexusManager.Features.IsapiFilters/IsapiFiltersSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.IsapiFilters { public delegate void IsapiFiltersSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Logging/AddFieldDialog.cs b/JexusManager.Features.Logging/AddFieldDialog.cs index b3b2227e..1866b55c 100644 --- a/JexusManager.Features.Logging/AddFieldDialog.cs +++ b/JexusManager.Features.Logging/AddFieldDialog.cs @@ -30,7 +30,7 @@ public AddFieldDialog(IServiceProvider serviceProvider, CustomLogField custom, F container.Add( Observable.FromEventPattern(this, "Load") .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => + .Subscribe(evt => { if (custom != null) { diff --git a/JexusManager.Features.Logging/LoggingFeature.cs b/JexusManager.Features.Logging/LoggingFeature.cs index eedc7160..3036d2ab 100644 --- a/JexusManager.Features.Logging/LoggingFeature.cs +++ b/JexusManager.Features.Logging/LoggingFeature.cs @@ -204,12 +204,10 @@ private void View() internal bool SelectFields() { - using (var dialog = new FieldsDialog(Module, Fields)) + using var dialog = new FieldsDialog(Module, Fields); + if (dialog.ShowDialog() != DialogResult.OK) { - if (dialog.ShowDialog() != DialogResult.OK) - { - return false; - } + return false; } return true; diff --git a/JexusManager.Features.Logging/LoggingSettingsSavedEventHandler.cs b/JexusManager.Features.Logging/LoggingSettingsSavedEventHandler.cs index d34e4924..a8b3378f 100644 --- a/JexusManager.Features.Logging/LoggingSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Logging/LoggingSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Logging { public delegate void LoggingSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.MimeMap/MimeMapFeature.cs b/JexusManager.Features.MimeMap/MimeMapFeature.cs index c42a1d4b..3b4d871e 100644 --- a/JexusManager.Features.MimeMap/MimeMapFeature.cs +++ b/JexusManager.Features.MimeMap/MimeMapFeature.cs @@ -135,7 +135,7 @@ public void Edit() } protected override void DoubleClick(MimeMapItem item) - { + { using var dialog = new NewMapItemDialog(Module, SelectedItem, this); if (dialog.ShowDialog() != DialogResult.OK) { diff --git a/JexusManager.Features.MimeMap/MimeMapPage.cs b/JexusManager.Features.MimeMap/MimeMapPage.cs index 1273f115..a6995883 100644 --- a/JexusManager.Features.MimeMap/MimeMapPage.cs +++ b/JexusManager.Features.MimeMap/MimeMapPage.cs @@ -112,7 +112,7 @@ private void ListView1_MouseDoubleClick(object sender, EventArgs e) { _feature.HandleMouseDoubleClick(listView1); } - + private void listView1_SelectedIndexChanged(object sender, EventArgs e) { _feature.HandleSelectedIndexChanged(listView1); diff --git a/JexusManager.Features.MimeMap/MimeMapSettingsSavedEventHandler.cs b/JexusManager.Features.MimeMap/MimeMapSettingsSavedEventHandler.cs index 2ed136af..5dc33043 100644 --- a/JexusManager.Features.MimeMap/MimeMapSettingsSavedEventHandler.cs +++ b/JexusManager.Features.MimeMap/MimeMapSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.MimeMap { public delegate void MimeMapSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Modules/ModulesItem.cs b/JexusManager.Features.Modules/ModulesItem.cs index 53166cb4..85973a2b 100644 --- a/JexusManager.Features.Modules/ModulesItem.cs +++ b/JexusManager.Features.Modules/ModulesItem.cs @@ -102,10 +102,10 @@ public string ModuleName { get { - return IsManaged - ? Type - : GlobalModule == null - ? string.Empty + return IsManaged + ? Type + : GlobalModule == null + ? string.Empty : GlobalModule.Image; } } diff --git a/JexusManager.Features.Modules/ModulesSettingsSavedEventHandler.cs b/JexusManager.Features.Modules/ModulesSettingsSavedEventHandler.cs index 74b1cdcc..45686fa5 100644 --- a/JexusManager.Features.Modules/ModulesSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Modules/ModulesSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Modules { public delegate void ModulesSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.RequestFiltering/AppliesToItem.cs b/JexusManager.Features.RequestFiltering/AppliesToItem.cs index 78d58169..55380895 100644 --- a/JexusManager.Features.RequestFiltering/AppliesToItem.cs +++ b/JexusManager.Features.RequestFiltering/AppliesToItem.cs @@ -39,4 +39,4 @@ public void AppendTo(ConfigurationElementCollection appliesToCollection) Apply(); } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.RequestFiltering/DenyStringsItem.cs b/JexusManager.Features.RequestFiltering/DenyStringsItem.cs index 4d3aa2d3..1ca21fe8 100644 --- a/JexusManager.Features.RequestFiltering/DenyStringsItem.cs +++ b/JexusManager.Features.RequestFiltering/DenyStringsItem.cs @@ -39,4 +39,4 @@ public void AppendTo(ConfigurationElementCollection denyStringsCollection) Apply(); } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.RequestFiltering/IRequestFilteringFeature.cs b/JexusManager.Features.RequestFiltering/IRequestFilteringFeature.cs index 9354a7fc..b447021b 100644 --- a/JexusManager.Features.RequestFiltering/IRequestFilteringFeature.cs +++ b/JexusManager.Features.RequestFiltering/IRequestFilteringFeature.cs @@ -14,4 +14,4 @@ internal interface IRequestFilteringFeature RequestFilteringSettingsSavedEventHandler RequestFilteringSettingsUpdate { get; } } -} \ No newline at end of file +} diff --git a/JexusManager.Features.RequestFiltering/RequestFilteringSettingsSavedEventHandler.cs b/JexusManager.Features.RequestFiltering/RequestFilteringSettingsSavedEventHandler.cs index 88ead1bc..23613977 100644 --- a/JexusManager.Features.RequestFiltering/RequestFilteringSettingsSavedEventHandler.cs +++ b/JexusManager.Features.RequestFiltering/RequestFilteringSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.RequestFiltering { public delegate void RequestFilteringSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs b/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs index 55598146..543c67e7 100644 --- a/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs +++ b/JexusManager.Features.ResponseHeaders/ResponseHeadersFeature.cs @@ -159,7 +159,7 @@ public override string GetGroupKey(ListViewItem item, string selectedGroup) switch (selectedGroup) { case "Entry Type": - return item.SubItems[2].Text; + return item.SubItems[2].Text; default: return "Unknown"; } diff --git a/JexusManager.Features.ResponseHeaders/ResponseHeadersSettingsSavedEventHandler.cs b/JexusManager.Features.ResponseHeaders/ResponseHeadersSettingsSavedEventHandler.cs index bfd7b533..6ee9e1d3 100644 --- a/JexusManager.Features.ResponseHeaders/ResponseHeadersSettingsSavedEventHandler.cs +++ b/JexusManager.Features.ResponseHeaders/ResponseHeadersSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.ResponseHeaders { public delegate void ResponseHeadersSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Rewrite/AddProviderDialog.cs b/JexusManager.Features.Rewrite/AddProviderDialog.cs index 574b1f0a..08f887b7 100644 --- a/JexusManager.Features.Rewrite/AddProviderDialog.cs +++ b/JexusManager.Features.Rewrite/AddProviderDialog.cs @@ -23,13 +23,13 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e { InitializeComponent(); _feature = feature; - + Text = existing == null ? "Add Provider" : "Edit Provider"; if (existing != null) { txtName.Text = existing.Name; txtName.ReadOnly = true; - + // Find the matching managed type if possible for (int i = 0; i < cbManagedType.Items.Count; i++) { @@ -39,7 +39,7 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e break; } } - + if (cbManagedType.SelectedIndex < 0) { cbManagedType.SelectedIndex = 0; @@ -49,12 +49,12 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e { cbManagedType.SelectedIndex = 0; } - + ProviderItem = existing; - + var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); - + container.Add( Observable.FromEventPattern(txtName, "TextChanged") .Sample(TimeSpan.FromSeconds(0.5)) @@ -63,7 +63,7 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text); })); - + container.Add( Observable.FromEventPattern(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) @@ -74,26 +74,26 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e ShowMessage("Provider name cannot be empty.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } - + // Check for duplicate provider names if (ProviderItem == null && _feature.Items.Exists(item => item.Name == txtName.Text)) { ShowMessage("A provider with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } - + if (ProviderItem == null) { // Create a new provider var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var section = service.GetSection("system.webServer/rewrite/providers"); var collection = section.GetCollection(); - + var element = collection.CreateElement(); ProviderItem = new ProviderItem(element); ProviderItem.Name = txtName.Text; ProviderItem.Type = cbManagedType.Text; - + _feature.AddProvider(ProviderItem); } else @@ -101,14 +101,14 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e // Update existing provider ProviderItem.Type = cbManagedType.Text; ProviderItem.Apply(); - + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); service.ServerManager.CommitChanges(); } - + DialogResult = DialogResult.OK; })); - + container.Add( Observable.FromEventPattern(this, "HelpButtonClicked") .ObserveOn(System.Threading.SynchronizationContext.Current) @@ -117,7 +117,7 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e _feature.ShowHelp(); })); } - + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public ProviderItem ProviderItem { get; private set; } } diff --git a/JexusManager.Features.Rewrite/AddProviderSettingDialog.Designer.cs b/JexusManager.Features.Rewrite/AddProviderSettingDialog.Designer.cs new file mode 100644 index 00000000..dc4b0319 --- /dev/null +++ b/JexusManager.Features.Rewrite/AddProviderSettingDialog.Designer.cs @@ -0,0 +1,139 @@ +namespace JexusManager.Features.Rewrite +{ + partial class AddProviderSettingDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.cbName = new System.Windows.Forms.ComboBox(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnOK = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.txtValue = new System.Windows.Forms.TextBox(); + this.cbEncrypt = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(38, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Name:"; + // + // cbName + // + this.cbName.FormattingEnabled = true; + this.cbName.Location = new System.Drawing.Point(12, 25); + this.cbName.Name = "cbName"; + this.cbName.Size = new System.Drawing.Size(446, 21); + this.cbName.TabIndex = 1; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(383, 151); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 6; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // btnOK + // + this.btnOK.Enabled = false; + this.btnOK.Location = new System.Drawing.Point(302, 151); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 5; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 71); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(37, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Value:"; + // + // txtValue + // + this.txtValue.Location = new System.Drawing.Point(12, 87); + this.txtValue.Name = "txtValue"; + this.txtValue.Size = new System.Drawing.Size(446, 20); + this.txtValue.TabIndex = 3; + // + // cbEncrypt + // + this.cbEncrypt.AutoSize = true; + this.cbEncrypt.Location = new System.Drawing.Point(12, 113); + this.cbEncrypt.Name = "cbEncrypt"; + this.cbEncrypt.Size = new System.Drawing.Size(87, 17); + this.cbEncrypt.TabIndex = 4; + this.cbEncrypt.Text = "Encrypt value"; + this.cbEncrypt.UseVisualStyleBackColor = true; + // + // AddProviderSettingDialog + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(470, 186); + this.Controls.Add(this.cbEncrypt); + this.Controls.Add(this.txtValue); + this.Controls.Add(this.label2); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.cbName); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.HelpButton = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AddProviderSettingDialog"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Add Provider Setting"; + this.ResumeLayout(false); + this.PerformLayout(); + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox cbName; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtValue; + private System.Windows.Forms.CheckBox cbEncrypt; + } +} diff --git a/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs b/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs new file mode 100644 index 00000000..47b8ef9e --- /dev/null +++ b/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs @@ -0,0 +1,125 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.ComponentModel; + using System.Linq; + using System.Reactive.Disposables; + using System.Reactive.Linq; + using System.Windows.Forms; + using JexusManager.Services; + using Microsoft.Web.Administration; + using Microsoft.Web.Management.Client; + using Microsoft.Web.Management.Client.Win32; + + internal partial class AddProviderSettingDialog : DialogForm + { + private readonly ProviderItem _provider; + + public AddProviderSettingDialog(Module module, ProviderItem provider, SettingItem existing = null) + : base(module) + { + InitializeComponent(); + _provider = provider; + + Text = existing == null ? "Add Provider Setting" : "Edit Provider Setting"; + + // Add common setting names to the combo box + cbName.Items.Add("connectionString"); + cbName.Items.Add("defaultProvider"); + cbName.Items.Add("providerName"); + + if (existing != null) + { + cbName.Text = existing.Key; + cbName.Enabled = false; + txtValue.Text = existing.Value; + // Note: SettingItem doesn't have an Encrypted property + // So we'll disable this feature when editing existing items + cbEncrypt.Enabled = false; + } + else + { + cbName.SelectedIndex = 0; + } + + SettingItem = existing; + + var container = new CompositeDisposable(); + FormClosed += (sender, args) => container.Dispose(); + + container.Add( + Observable.FromEventPattern(cbName, "TextChanged") + .Merge(Observable.FromEventPattern(txtValue, "TextChanged")) + .Sample(TimeSpan.FromSeconds(0.5)) + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + btnOK.Enabled = !string.IsNullOrWhiteSpace(cbName.Text); + })); + + container.Add( + Observable.FromEventPattern(btnOK, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + if (string.IsNullOrEmpty(cbName.Text)) + { + ShowMessage("Setting name cannot be empty.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + return; + } + // Check for duplicate setting names if adding a new setting + if (SettingItem == null && _provider != null && + _provider.Settings != null && + _provider.Settings.Any(item => item.Key == cbName.Text)) + { + ShowMessage("A setting with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + return; + } + + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + if (SettingItem == null) + { + var settingsCollection = _provider.Element.GetCollection("settings"); + var element = settingsCollection.CreateElement(); + + SettingItem = new SettingItem(element); + SettingItem.Key = cbName.Text; + SettingItem.Value = txtValue.Text; + + // Handle encryption if needed + if (cbEncrypt.Checked) + { + // TODO: Implement encryption logic if required + // Since SettingItem doesn't have built-in encryption support + } + + SettingItem.Apply(); + settingsCollection.Add(element); + service.ServerManager.CommitChanges(); + } + else + { + // Update existing setting + SettingItem.Value = txtValue.Text; + SettingItem.Apply(); + service.ServerManager.CommitChanges(); + } + + DialogResult = DialogResult.OK; + })); + container.Add(Observable.FromEventPattern(this, "HelpButtonClicked") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403&clcid=0x409"); + })); + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public SettingItem SettingItem { get; private set; } + } +} diff --git a/JexusManager.Features.Rewrite/Inbound/MapPage.cs b/JexusManager.Features.Rewrite/Inbound/MapPage.cs index 390cebe3..72128f3f 100644 --- a/JexusManager.Features.Rewrite/Inbound/MapPage.cs +++ b/JexusManager.Features.Rewrite/Inbound/MapPage.cs @@ -158,7 +158,7 @@ protected override void InitializeListPage() } } } - + private void ListView1KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) diff --git a/JexusManager.Features.Rewrite/Inbound/MapSettingsUpdatedEventHandler.cs b/JexusManager.Features.Rewrite/Inbound/MapSettingsUpdatedEventHandler.cs index e8fa61cb..dbf10c45 100644 --- a/JexusManager.Features.Rewrite/Inbound/MapSettingsUpdatedEventHandler.cs +++ b/JexusManager.Features.Rewrite/Inbound/MapSettingsUpdatedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Rewrite.Inbound { internal delegate void MapSettingsUpdatedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Rewrite/Inbound/MapsPage.cs b/JexusManager.Features.Rewrite/Inbound/MapsPage.cs index 1c209804..cfd9592f 100644 --- a/JexusManager.Features.Rewrite/Inbound/MapsPage.cs +++ b/JexusManager.Features.Rewrite/Inbound/MapsPage.cs @@ -37,7 +37,7 @@ public PageTaskList(MapsPage owner) public override ICollection GetTaskItems() { return new TaskItem[] - { + { GetBackTaskItem("Back", "Back to Rules"), MethodTaskItem.CreateSeparator().SetUsage(), RevertTaskItem, diff --git a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs index 3b5d977e..e1cedc8b 100644 --- a/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs +++ b/JexusManager.Features.Rewrite/Outbound/CustomTagsPage.cs @@ -141,7 +141,7 @@ private void ListView1MouseDoubleClick(object sender, MouseEventArgs e) { _feature.HandleMouseDoubleClick(listView1); } - + private void ListView1KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) diff --git a/JexusManager.Features.Rewrite/ProviderItem.cs b/JexusManager.Features.Rewrite/ProviderItem.cs index 5cc48201..7205c056 100644 --- a/JexusManager.Features.Rewrite/ProviderItem.cs +++ b/JexusManager.Features.Rewrite/ProviderItem.cs @@ -18,8 +18,8 @@ public class ProviderItem : IItem /// /// Gets or sets the name of the provider. /// - public string Name - { + public string Name + { get { return (string)Element["name"]; } set { Element["name"] = value; } } @@ -56,7 +56,7 @@ public ProviderItem(ConfigurationElement element) { Element = element ?? throw new ArgumentNullException(nameof(element)); Flag = element.IsLocallyStored ? "Local" : "Inherited"; - + // Load settings from the provider's settings collection var settingsCollection = Element.GetChildElement("settings")?.GetCollection(); if (settingsCollection != null) @@ -93,7 +93,7 @@ public bool Equals(ProviderItem other) { return Match(other) && Type == other.Type; } - + /// /// Determines whether this provider item has the same key values as another provider item. /// @@ -103,7 +103,7 @@ public bool Match(ProviderItem other) { if (other is null) return false; - + return Name == other.Name; } } diff --git a/JexusManager.Features.Rewrite/ProvidersFeature.cs b/JexusManager.Features.Rewrite/ProvidersFeature.cs index 2e29ebf8..76d12e0a 100644 --- a/JexusManager.Features.Rewrite/ProvidersFeature.cs +++ b/JexusManager.Features.Rewrite/ProvidersFeature.cs @@ -34,10 +34,10 @@ public override ICollection GetTaskItems() { var result = new ArrayList(); result.Add(new MethodTaskItem("Add", "Add Provider...", string.Empty).SetUsage()); - + if (_owner.SelectedItem != null) { - result.Add(new MethodTaskItem("AddSetting", "Add Provider Setting...", string.Empty).SetUsage()); + result.Add(new MethodTaskItem("ViewSettings", "View Settings", string.Empty).SetUsage()); result.Add(MethodTaskItem.CreateSeparator().SetUsage()); result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage()); result.Add(new MethodTaskItem("Rename", "Rename", string.Empty).SetUsage()); @@ -60,17 +60,17 @@ public void Add() } [Obfuscation(Exclude = true)] - public void AddSetting() + public void ViewSettings() { - _owner.AddSetting(); + _owner.ViewSettings(); } - + [Obfuscation(Exclude = true)] public void Edit() { _owner.Edit(); } - + [Obfuscation(Exclude = true)] public void Rename() { @@ -114,7 +114,7 @@ public void Load() { Items = new List(); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - + try { var section = service.GetSection("system.webServer/rewrite/providers"); @@ -132,7 +132,7 @@ public void Load() var managementUIService = (IManagementUIService)GetService(typeof(IManagementUIService)); managementUIService.ShowError(ex, "Error loading rewrite providers", Name, false); } - + OnRewriteSettingsSaved(); } @@ -156,21 +156,12 @@ public void Add() } } - public void AddSetting() + public void ViewSettings() { - if (SelectedItem == null) - { - return; - } - - // TODO: - //using var dialog = new AddSettingDialog(Module, this, SelectedItem); - //if (dialog.ShowDialog() == DialogResult.OK) - //{ - // OnRewriteSettingsSaved(); - //} + var navigationService = (INavigationService)GetService(typeof(INavigationService)); + navigationService.Navigate(null, null, typeof(SettingsPage), SelectedItem); } - + public void Edit() { DoubleClick(SelectedItem); @@ -194,14 +185,14 @@ public void Rename() { RenameInline(SelectedItem); } - + public void Remove() { if (SelectedItem == null) { return; } - + var service = (IManagementUIService)GetService(typeof(IManagementUIService)); if (service.ShowMessage( "Are you sure you want to remove this provider?", @@ -216,7 +207,7 @@ public void Remove() var configService = (IConfigurationService)GetService(typeof(IConfigurationService)); var section = configService.GetSection("system.webServer/rewrite/providers"); var collection = section.GetCollection(); - + // Find and remove the item from the configuration foreach (ConfigurationElement element in collection) { @@ -226,13 +217,13 @@ public void Remove() break; } } - + configService.ServerManager.CommitChanges(); - + // Remove from the UI Items.Remove(SelectedItem); SelectedItem = null; - + OnRewriteSettingsSaved(); } @@ -264,22 +255,22 @@ public void AddProvider(ProviderItem provider) { return; } - + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var section = service.GetSection("system.webServer/rewrite/providers"); var collection = section.GetCollection(); - + ConfigurationElement element = collection.CreateElement(); provider.Element = element; provider.Apply(); collection.Add(element); - + service.ServerManager.CommitChanges(); - + Items.Add(provider); OnRewriteSettingsSaved(); } - + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { var section = service.GetSection("system.webServer/rewrite/providers"); @@ -292,17 +283,17 @@ protected override void OnSettingsSaved() } public RewriteSettingsSavedEventHandler RewriteSettingsUpdated { get; set; } - + public string Name { get { return "URL Rewrite Providers"; } } - + public virtual Version MinimumFrameworkVersion { get { return FxVersionNotRequired; } } - + private static readonly Version FxVersionNotRequired = new Version(); } } diff --git a/JexusManager.Features.Rewrite/ProvidersPage.cs b/JexusManager.Features.Rewrite/ProvidersPage.cs index 553eae6e..021e7ba6 100644 --- a/JexusManager.Features.Rewrite/ProvidersPage.cs +++ b/JexusManager.Features.Rewrite/ProvidersPage.cs @@ -72,7 +72,7 @@ public ProviderListViewItem(ProviderItem item, ProvidersPage page) public ProvidersPage() { InitializeComponent(); - + // Set the labels from resources if needed label3.Text = "Rewrite Providers"; label2.Text = "Providers implement custom rewrite logic and can be invoked from inbound and outbound rewrite rules."; @@ -92,7 +92,7 @@ protected override void Initialize(object navigationData) { item.Name = text; item.Apply(); - }, + }, text => { if (_feature.FindDuplicate(item => item.Name, text)) @@ -154,7 +154,7 @@ private void ListView1_SelectedIndexChanged(object sender, EventArgs e) _feature.HandleSelectedIndexChanged(listView1); Refresh(); } - + private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) { if (splitContainer1.Panel2.Width > 500) diff --git a/JexusManager.Features.Rewrite/RewriteSettingsSavedEventHandler.cs b/JexusManager.Features.Rewrite/RewriteSettingsSavedEventHandler.cs index 9da356b4..74c3b174 100644 --- a/JexusManager.Features.Rewrite/RewriteSettingsSavedEventHandler.cs +++ b/JexusManager.Features.Rewrite/RewriteSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Rewrite { public delegate void RewriteSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Rewrite/RuleSettingsUpdatedEventHandler.cs b/JexusManager.Features.Rewrite/RuleSettingsUpdatedEventHandler.cs index 5eea43c0..ca372ba8 100644 --- a/JexusManager.Features.Rewrite/RuleSettingsUpdatedEventHandler.cs +++ b/JexusManager.Features.Rewrite/RuleSettingsUpdatedEventHandler.cs @@ -5,4 +5,4 @@ namespace JexusManager.Features.Rewrite { public delegate void RuleSettingsUpdatedEventHandler(); -} \ No newline at end of file +} diff --git a/JexusManager.Features.Rewrite/SettingItem.cs b/JexusManager.Features.Rewrite/SettingItem.cs index aeaa2a3d..6a1fb995 100644 --- a/JexusManager.Features.Rewrite/SettingItem.cs +++ b/JexusManager.Features.Rewrite/SettingItem.cs @@ -22,19 +22,36 @@ public SettingItem(ConfigurationElement element) Key = (string)element["key"]; Value = (string)element["value"]; - // TODO: encryptedValue + // TODO: + //var temp = (string)element["encryptedValue"]; + //if (temp != null) + //{ + // Encrypted = true; + // Value = temp; + //} } public string Key { get; set; } public string Value { get; set; } + public bool Encrypted { get; set; } + public string Flag { get; set; } public void Apply() { Element["key"] = Key; - Element["value"] = Value; + if (Encrypted) + { + Element["encryptedValue"] = Value; + Element["value"] = null; + } + else + { + Element["encryptedValue"] = null; + Element["value"] = Value; + } } public bool Match(SettingItem other) diff --git a/JexusManager.Features.Rewrite/SettingsFeature.cs b/JexusManager.Features.Rewrite/SettingsFeature.cs new file mode 100644 index 00000000..6624ff64 --- /dev/null +++ b/JexusManager.Features.Rewrite/SettingsFeature.cs @@ -0,0 +1,192 @@ +// Copyright (c) Lex Li. All rights reserved. +// +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace JexusManager.Features.Rewrite +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using System.Windows.Forms; + using JexusManager.Services; + using Microsoft.Web.Administration; + using Microsoft.Web.Management.Client; + using Microsoft.Web.Management.Client.Win32; + using Module = Microsoft.Web.Management.Client.Module; + + internal class SettingsFeature : FeatureBase + { + private sealed class FeatureTaskList : DefaultTaskList + { + private readonly SettingsFeature _owner; + + public FeatureTaskList(SettingsFeature owner) + { + _owner = owner; + } + + public override ICollection GetTaskItems() + { + var result = new ArrayList(); + result.Add(new MethodTaskItem("Add", "Add Setting...", string.Empty).SetUsage()); + + if (_owner.SelectedItem != null) + { + result.Add(MethodTaskItem.CreateSeparator().SetUsage()); + result.Add(new MethodTaskItem("Edit", "Edit...", string.Empty).SetUsage()); + result.Add(RemoveTaskItem); + } + + return result.ToArray(typeof(TaskItem)) as TaskItem[]; + } + + [Obfuscation(Exclude = true)] + public void Add() + { + _owner.Add(); + } + + [Obfuscation(Exclude = true)] + public void Edit() + { + _owner.Edit(); + } + + [Obfuscation(Exclude = true)] + public override void Remove() + { + _owner.Remove(); + } + } + + private FeatureTaskList _taskList; + private readonly ProviderItem _provider; + + public SettingsFeature(Module module, ProviderItem provider) + : base(module) + { + _provider = provider; + } + + public TaskList GetTaskList() + { + return _taskList ?? (_taskList = new FeatureTaskList(this)); + } + + public void Load() + { + Items = _provider.Settings.ToList(); + OnSettingsUpdated(); + } + + public void Add() + { + using var dialog = new AddProviderSettingDialog(Module, _provider); + if (dialog.ShowDialog() != DialogResult.OK) + { + return; + } + + _provider.Settings.Add(dialog.SettingItem); + Items = new List(_provider.Settings); + OnSettingsUpdated(); + } + + public void Edit() + { + if (SelectedItem == null) + { + return; + } + + using var dialog = new AddProviderSettingDialog(Module, _provider, SelectedItem); + if (dialog.ShowDialog() != DialogResult.OK) + { + return; + } + + OnSettingsUpdated(); + } + + public void Remove() + { + if (SelectedItem == null) + { + return; + } + + var service = (IManagementUIService)GetService(typeof(IManagementUIService)); + if (service.ShowMessage( + "Are you sure you want to remove this setting?", + "Confirm Remove", + MessageBoxButtons.YesNoCancel, + MessageBoxIcon.Question, + MessageBoxDefaultButton.Button1) != DialogResult.Yes) + { + return; + } + + _provider.Settings.Remove(SelectedItem); + Items.Remove(SelectedItem); + SelectedItem = null; + OnSettingsUpdated(); + } + + protected override void DoubleClick(SettingItem item) + { + Edit(); + } + + protected override ConfigurationElementCollection GetCollection(IConfigurationService service) + { + // Settings are managed through the provider's Settings collection + return null; + } + + protected override void OnSettingsSaved() + { + OnSettingsUpdated(); + } + + public bool ShowHelp() + { + DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403"); + return false; + } + + private void OnSettingsUpdated() + { + SettingsUpdated?.Invoke(); + } + + public SettingsUpdatedEventHandler SettingsUpdated { get; set; } + + public string Description => "Configure provider settings"; + + public virtual Version MinimumFrameworkVersion => new Version(); + + public string Name => "Provider Settings"; + + public override void InitializeGrouping(ToolStripComboBox cbGroup) + { + cbGroup.Items.AddRange(new object[] { + "No Grouping", + "Encrypted" + }); + } + + public override string GetGroupKey(ListViewItem item, string selectedGroup) + { + if (selectedGroup == "Encrypted") + { + return item.SubItems[2].Text == "Yes" ? "Encrypted" : "Unencrypted"; + } + + return "Unknown"; + } + } + + public delegate void SettingsUpdatedEventHandler(); +} diff --git a/JexusManager.Features.Rewrite/SettingsPage.Designer.cs b/JexusManager.Features.Rewrite/SettingsPage.Designer.cs new file mode 100644 index 00000000..73b5b930 --- /dev/null +++ b/JexusManager.Features.Rewrite/SettingsPage.Designer.cs @@ -0,0 +1,282 @@ +namespace JexusManager.Features.Rewrite +{ + partial class SettingsPage + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.cmsActionPanel = new System.Windows.Forms.ContextMenuStrip(this.components); + this.panel2 = new System.Windows.Forms.Panel(); + this.listView1 = new System.Windows.Forms.ListView(); + this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.chEncrypted = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.label2 = new System.Windows.Forms.Label(); + this.toolStrip2 = new System.Windows.Forms.ToolStrip(); + this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); + this.cbGroup = new System.Windows.Forms.ToolStripComboBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label3 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.tsActionPanel = new System.Windows.Forms.ToolStrip(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.toolStrip2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.tableLayoutPanel1.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel1.ContextMenuStrip = this.cmsActionPanel; + this.splitContainer1.Panel1.Controls.Add(this.panel2); + this.splitContainer1.Panel1.Controls.Add(this.pictureBox1); + this.splitContainer1.Panel1.Controls.Add(this.label3); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tableLayoutPanel1); + this.splitContainer1.Panel2MinSize = 200; + this.splitContainer1.Size = new System.Drawing.Size(800, 600); + this.splitContainer1.SplitterDistance = 580; + this.splitContainer1.TabIndex = 3; + this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved); + // + // cmsActionPanel + // + this.cmsActionPanel.Name = "cmsActionPanel"; + this.cmsActionPanel.Size = new System.Drawing.Size(61, 4); + // + // panel2 + // + this.panel2.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.panel2.Controls.Add(this.toolStrip2); + this.panel2.Controls.Add(this.listView1); + this.panel2.Controls.Add(this.label2); + this.panel2.Location = new System.Drawing.Point(10, 50); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(560, 540); + this.panel2.TabIndex = 8; + // + // listView1 + // + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.chName, + this.chValue, + this.chEncrypted}); + this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.listView1.FullRowSelect = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(0, 45); + this.listView1.Margin = new System.Windows.Forms.Padding(5); + this.listView1.MultiSelect = false; + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(560, 495); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + this.listView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ListView1_KeyDown); + this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.ListView1_MouseDoubleClick); + this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged); + // + // chName + // + this.chName.Text = "Name"; + this.chName.Width = 200; + // + // chValue + // + this.chValue.Text = "Value"; + this.chValue.Width = 200; + // + // chEncrypted + // + this.chEncrypted.Text = "Encrypted"; + this.chEncrypted.Width = 100; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 0); + this.label2.Margin = new System.Windows.Forms.Padding(5); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(324, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Configure settings for the selected provider."; + // + // toolStrip2 + // + this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripLabel2, + this.cbGroup}); + this.toolStrip2.Location = new System.Drawing.Point(0, 13); + this.toolStrip2.Name = "toolStrip2"; + this.toolStrip2.Size = new System.Drawing.Size(560, 25); + this.toolStrip2.TabIndex = 2; + this.toolStrip2.Text = "toolStrip2"; + // + // toolStripLabel2 + // + this.toolStripLabel2.Name = "toolStripLabel2"; + this.toolStripLabel2.Size = new System.Drawing.Size(55, 22); + this.toolStripLabel2.Text = "Group by:"; + // + // cbGroup + // + this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbGroup.Name = "cbGroup"; + this.cbGroup.Size = new System.Drawing.Size(200, 25); + this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); + // + // pictureBox1 + // + this.pictureBox1.Location = new System.Drawing.Point(10, 10); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(32, 32); + this.pictureBox1.TabIndex = 9; + this.pictureBox1.TabStop = false; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label3.Location = new System.Drawing.Point(48, 10); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(106, 25); + this.label3.TabIndex = 2; + this.label3.Text = "Settings"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tsActionPanel, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 23F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(216, 600); + this.tableLayoutPanel1.TabIndex = 1; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.SystemColors.ActiveBorder; + this.panel1.Controls.Add(this.label1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Margin = new System.Windows.Forms.Padding(0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(216, 23); + this.panel1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(3, 5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(49, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Actions"; + // + // tsActionPanel + // + this.tsActionPanel.CanOverflow = false; + this.tsActionPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.tsActionPanel.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; + this.tsActionPanel.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow; + this.tsActionPanel.Location = new System.Drawing.Point(0, 23); + this.tsActionPanel.Name = "tsActionPanel"; + this.tsActionPanel.Size = new System.Drawing.Size(216, 577); + this.tsActionPanel.TabIndex = 2; + this.tsActionPanel.Text = "toolStrip1"; + // + // SettingsPage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "SettingsPage"; + this.Size = new System.Drawing.Size(800, 600); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.toolStrip2.ResumeLayout(false); + this.toolStrip2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.ColumnHeader chName; + private System.Windows.Forms.ColumnHeader chValue; + private System.Windows.Forms.ColumnHeader chEncrypted; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ToolStrip tsActionPanel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.ContextMenuStrip cmsActionPanel; + private System.Windows.Forms.ToolStripComboBox cbGroup; + private System.Windows.Forms.ToolStrip toolStrip2; + private System.Windows.Forms.ToolStripLabel toolStripLabel2; + } +} diff --git a/JexusManager.Features.Rewrite/SettingsPage.cs b/JexusManager.Features.Rewrite/SettingsPage.cs new file mode 100644 index 00000000..51f07a73 --- /dev/null +++ b/JexusManager.Features.Rewrite/SettingsPage.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections; +using System.ComponentModel; +using System.Reflection; +using System.Windows.Forms; +using JexusManager.Services; +using Microsoft.Web.Management.Client; +using Microsoft.Web.Management.Client.Win32; + +namespace JexusManager.Features.Rewrite +{ + internal partial class SettingsPage : ModuleListPage, IModuleChildPage + { + private sealed class PageTaskList : ShowHelpTaskList + { + private readonly SettingsPage _owner; + + public PageTaskList(SettingsPage owner) + { + _owner = owner; + } + + public override ICollection GetTaskItems() + { + return new TaskItem[] + { + GetBackTaskItem("BackToProviders", "Back to Providers"), + GetBackTaskItem("BackToRules", "Back to Rules"), + MethodTaskItem.CreateSeparator().SetUsage(), + HelpTaskItem + }; + } + + [Obfuscation(Exclude = true)] + public override void ShowHelp() + { + _owner.ShowHelp(); + } + + [Obfuscation(Exclude = true)] + public void Back() + { + _owner.Back(); + } + + [Obfuscation(Exclude = true)] + public void BackToProviders() + { + _owner.BackToProviders(); + } + + [Obfuscation(Exclude = true)] + public void BackToRules() + { + _owner.BackToRules(); + } + } + + private sealed class SettingListViewItem : ListViewItem, IFeatureListViewItem + { + public SettingItem Item { get; } + private readonly SettingsPage _page; + + public SettingListViewItem(SettingItem item, SettingsPage page) + : base(item.Key) + { + Item = item; + _page = page; + SubItems.Add(new ListViewSubItem(this, item.Value)); + SubItems.Add(new ListViewSubItem(this, item.Encrypted ? "Yes" : "No")); + } + } + + private SettingsFeature _feature; + private PageTaskList _taskList; + private ProviderItem _provider; + + public SettingsPage() + { + InitializeComponent(); + + label3.Text = "Provider Settings"; + label2.Text = "Configure settings for the selected provider."; + } + + protected override void Initialize(object navigationData) + { + base.Initialize(navigationData); + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); + pictureBox1.Image = service.Scope.GetImage(); + + _provider = navigationData as ProviderItem; + if (_provider == null) + { + throw new InvalidOperationException("Provider must be specified for settings page"); + } + + _feature = new SettingsFeature(Module, _provider); + _feature.SettingsUpdated = InitializeListPage; + _feature.Load(); + } + + protected override void InitializeListPage() + { + listView1.Items.Clear(); + foreach (var setting in _feature.Items) + { + listView1.Items.Add(new SettingListViewItem(setting, this)); + } + + _feature.InitializeColumnClick(listView1); + + // Initialize grouping support + _feature?.InitializeGrouping(cbGroup); + + if (_feature.SelectedItem != null) + { + foreach (SettingListViewItem item in listView1.Items) + { + if (item.Item == _feature.SelectedItem) + { + item.Selected = true; + } + } + } + + Refresh(); + } + + protected override void Refresh() + { + Tasks.Fill(tsActionPanel, cmsActionPanel); + base.Refresh(); + } + private void ListView1_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Delete) + { + _feature.Remove(); + } + } + + private void ListView1_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (listView1.SelectedItems.Count <= 0) + { + return; + } + + var item = listView1.SelectedItems[0] as SettingListViewItem; + _feature.SelectedItem = item?.Item; + _feature.HandleMouseDoubleClick(listView1); + } + + private void ListView1_SelectedIndexChanged(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count <= 0) + { + _feature.SelectedItem = null; + } + else + { + var item = listView1.SelectedItems[0] as SettingListViewItem; + _feature.SelectedItem = item?.Item; + } + + Refresh(); + } + + private void splitContainer1_SplitterMoved(object sender, SplitterEventArgs e) + { + if (splitContainer1.Panel2.Width > 500) + { + splitContainer1.SplitterDistance = splitContainer1.Width - 500; + } + } + + protected override bool ShowHelp() + { + return _feature.ShowHelp(); + } + + private void Back() + { + Back(1); + } + + [Obfuscation(Exclude = true)] + public void BackToProviders() + { + Back(1); + } + + [Obfuscation(Exclude = true)] + public void BackToRules() + { + Back(2); + } + + private void Back(int levels) + { + var service = (INavigationService)GetService(typeof(INavigationService)); + service?.NavigateBack(levels); + } + + protected override TaskListCollection Tasks + { + get + { + if (_taskList == null) + { + _taskList = new PageTaskList(this); + } + + base.Tasks.Add(_feature.GetTaskList()); + base.Tasks.Add(_taskList); + return base.Tasks; + } + } + + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public IModulePage ParentPage { get; set; } + + private void CbGroup_SelectedIndexChanged(object sender, EventArgs e) + { + DialogHelper.HandleGrouping(listView1, cbGroup.SelectedItem.ToString(), _feature.GetGroupKey); + } + } +} diff --git a/JexusManager.Features.TraceFailedRequests/SettingsDialog.cs b/JexusManager.Features.TraceFailedRequests/SettingsDialog.cs index 26aa5208..f799ae70 100644 --- a/JexusManager.Features.TraceFailedRequests/SettingsDialog.cs +++ b/JexusManager.Features.TraceFailedRequests/SettingsDialog.cs @@ -44,7 +44,7 @@ public SettingsDialog(IServiceProvider serviceProvider, SiteTraceFailedRequestsL .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { - if (uint.TryParse(txtNumber.Text, out uint number) && number > 0 && number <=10000) + if (uint.TryParse(txtNumber.Text, out uint number) && number > 0 && number <= 10000) { element.MaxLogFiles = number; element.Enabled = cbEnabled.Checked; diff --git a/JexusManager.Features.TraceFailedRequests/Wizards/AddTraceWizard/ConditionsPage.cs b/JexusManager.Features.TraceFailedRequests/Wizards/AddTraceWizard/ConditionsPage.cs index 29e4013b..62d7c97a 100644 --- a/JexusManager.Features.TraceFailedRequests/Wizards/AddTraceWizard/ConditionsPage.cs +++ b/JexusManager.Features.TraceFailedRequests/Wizards/AddTraceWizard/ConditionsPage.cs @@ -99,7 +99,7 @@ public override bool OnNext() data.Time = time; if (cbEventSeverity.Checked) { - switch(cbSeverity.SelectedIndex) + switch (cbSeverity.SelectedIndex) { case 0: data.Verbosity = 2; diff --git a/JexusManager.Shared/BindingUtility.cs b/JexusManager.Shared/BindingUtility.cs index 4524c3fa..7e5de6ec 100644 --- a/JexusManager.Shared/BindingUtility.cs +++ b/JexusManager.Shared/BindingUtility.cs @@ -22,12 +22,12 @@ namespace Microsoft.Web.Administration public enum CertificateMappingState { - HostNameNotMatched, + HostNameNotMatched, RegistrationFailed, RegistrationSucceeded, UacCancelled, Win32ErrorOccurred, - GenericErrorOccurred, + GenericErrorOccurred, CertificateHashNotMatched, CertificateStoreNotMatched, IpEndPointInvalid, @@ -81,7 +81,7 @@ internal static (CertificateMappingState state, string message) FixCertificateMa // handle SNI var sni = NativeMethods.QuerySslSniInfo(new Tuple(binding.Host, binding.EndPoint.Port)); - return AddMapping(binding, sni, true); + return AddMapping(binding, sni, true); } } @@ -139,7 +139,7 @@ private static (CertificateMappingState state, string message) ManipulateCertifi start.Verb = "runas"; start.UseShellExecute = true; start.FileName = "cmd"; - start.Arguments = arguments; + start.Arguments = arguments; start.CreateNoWindow = true; start.WindowStyle = ProcessWindowStyle.Hidden; process.Start(); @@ -284,7 +284,7 @@ private static string RemoveMapping(this Binding binding, bool sni) } catch (NullReferenceException ex) { - _logger.LogError(ex, "Null reference during mapping removal. Binding: {Binding}, EndPoint null: {IsNull}", + _logger.LogError(ex, "Null reference during mapping removal. Binding: {Binding}, EndPoint null: {IsNull}", binding.ToString(), binding.EndPoint == null); return $"Remove SNI certificate failed: unknown ({ex.Message})"; } @@ -375,7 +375,7 @@ public static bool MatchHostName(this X509Certificate2 certificate, string host) private static string ToAddMappingArguments(this Binding binding, bool sni) { - return sni + return sni ? $"/c \"\"{CertificateInstallerLocator.FileName}\" /h:\"{Hex.ToHexString(binding.CertificateHash)}\" /s:{binding.CertificateStoreName}\" /i:{AppIdIisExpress} /a:{binding.EndPoint.Address} /o:{binding.EndPoint.Port} /x:{binding.Host}" : $"/c \"\"{CertificateInstallerLocator.FileName}\" /h:\"{Hex.ToHexString(binding.CertificateHash)}\" /s:{binding.CertificateStoreName}\" /i:{AppIdIisExpress} /a:{binding.EndPoint.Address} /o:{binding.EndPoint.Port}"; } diff --git a/JexusManager.Shared/ColumnClickHook.cs b/JexusManager.Shared/ColumnClickHook.cs index 384dd4fd..5f253d56 100644 --- a/JexusManager.Shared/ColumnClickHook.cs +++ b/JexusManager.Shared/ColumnClickHook.cs @@ -39,7 +39,7 @@ public int Compare(object x, object y) return _order == SortOrder.Descending ? -result : result; } } - + private int _sortColumn = -1; public void HandleColumnClick(ListView listView1) diff --git a/JexusManager.Shared/DialogHelper.cs b/JexusManager.Shared/DialogHelper.cs index 6aed935f..22a665e8 100644 --- a/JexusManager.Shared/DialogHelper.cs +++ b/JexusManager.Shared/DialogHelper.cs @@ -375,7 +375,7 @@ public static void ProcessStart(string url) { StartInfo = new ProcessStartInfo { - FileName = useDefault ? url: browser, + FileName = useDefault ? url : browser, Arguments = useDefault ? string.Empty : url, UseShellExecute = true } @@ -463,6 +463,6 @@ public static void HandleGrouping(ListView listView1, string selectedGroup, Func // Assign the item to the appropriate group item.Group = groups[groupKey]; } - } + } } } diff --git a/JexusManager.Shared/Features/TaskItemExtensions.cs b/JexusManager.Shared/Features/TaskItemExtensions.cs index 68989b56..b65149d5 100644 --- a/JexusManager.Shared/Features/TaskItemExtensions.cs +++ b/JexusManager.Shared/Features/TaskItemExtensions.cs @@ -90,7 +90,7 @@ private static void TaskItemFill(this TaskItem item, TaskList list, ToolStrip ac list.InvokeMethod(method.MethodName, method.UserData); } catch (TargetInvocationException ex) - { + { if (ex.InnerException is UnauthorizedAccessException) { _logger.LogError(ex.InnerException, "Error invoking task method {Method}", method.MethodName); @@ -119,7 +119,7 @@ private static void TaskItemFill(this TaskItem item, TaskList list, ToolStrip ac list.InvokeMethod(method.MethodName, method.UserData); } catch (TargetInvocationException ex) - { + { if (ex.InnerException is UnauthorizedAccessException) { _logger.LogError(ex.InnerException, "Error invoking task method {Method}", method.MethodName); diff --git a/JexusManager.Shared/NativeMethods.cs b/JexusManager.Shared/NativeMethods.cs index 77792d5d..5d53f056 100644 --- a/JexusManager.Shared/NativeMethods.cs +++ b/JexusManager.Shared/NativeMethods.cs @@ -40,7 +40,7 @@ public static void RemoveShieldFromButton(Button b) SendMessage(b.Handle, BCM_SETSHIELD, IntPtr.Zero, (IntPtr)0); } - + // BOOL WINAPI CryptAcquireCertificatePrivateKey( // PCCERT_CONTEXT pCert, // DWORD dwFlags, @@ -58,7 +58,7 @@ public static extern bool CryptAcquireCertificatePrivateKey( ref IntPtr phCryptProv, ref int pdwKeySpec, ref bool pfCallerFreeProv); - + [System.Runtime.InteropServices.DllImport("Kernel32")] public static extern bool CloseHandle(IntPtr handle); diff --git a/JexusManager.Shared/StringUtility.cs b/JexusManager.Shared/StringUtility.cs index 66c2174f..39e7f73f 100644 --- a/JexusManager.Shared/StringUtility.cs +++ b/JexusManager.Shared/StringUtility.cs @@ -39,7 +39,7 @@ public static bool IsWildcard(this string host) { return true; } - + var index = host.IndexOf('.'); if (index != 1) { diff --git a/JexusManager.sln b/JexusManager.sln deleted file mode 100644 index 904fce15..00000000 --- a/JexusManager.sln +++ /dev/null @@ -1,270 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.13.35828.75 d17.13 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager", "JexusManager\JexusManager.csproj", "{5203A38D-6A1D-4785-8E83-54081AD2ADAA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{1CD001BD-53C3-4A20-9CE4-6C69BDCFD393}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Management", "Microsoft.Web.Management\Microsoft.Web.Management.csproj", "{17E994B0-5A31-4F79-9796-83A45E87853D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Configuration.AppHostFileProvider", "Microsoft.Web.Configuration.AppHostFileProvider\Microsoft.Web.Configuration.AppHostFileProvider.csproj", "{E4DAB2F5-AF63-413C-886A-09BC4353ADB6}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Controls", "Controls", "{678654EE-C2A2-49A5-ACE3-ECB31288C2F7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckBoxComboBox", "lib\CheckBoxComboBox\CheckBoxComboBox.csproj", "{70A25201-8EA4-48F8-A4A6-ED13ADF8823C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CertificateInstaller", "CertificateInstaller\CertificateInstaller.csproj", "{54BEC09A-B32F-4A66-A871-749E0621D822}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.JexusManager", "Tests.JexusManager\Tests.JexusManager.csproj", "{AEF03715-1847-4BA7-BFDC-7D3E738E552C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Shared", "JexusManager.Shared\JexusManager.Shared.csproj", "{E4040A45-B156-4048-B1A4-BD262BA18047}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Access", "JexusManager.Features.Access\JexusManager.Features.Access.csproj", "{B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "Features", "{02EA3ED9-4B28-4CD2-9461-00111A75D6F7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Authentication", "JexusManager.Features.Authentication\JexusManager.Features.Authentication.csproj", "{AA7CCFC5-B695-4773-BA79-77CF6C36908F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Authorization", "JexusManager.Features.Authorization\JexusManager.Features.Authorization.csproj", "{FEFD62BE-AA83-42B9-A79D-2DF0150F4F81}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Caching", "JexusManager.Features.Caching\JexusManager.Features.Caching.csproj", "{30A30352-CA83-446E-8AF8-598EA7397988}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Certificates", "JexusManager.Features.Certificates\JexusManager.Features.Certificates.csproj", "{D37CF28B-10F1-4F28-B933-C5E18D7F09AA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Cgi", "JexusManager.Features.Cgi\JexusManager.Features.Cgi.csproj", "{0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Compression", "JexusManager.Features.Compression\JexusManager.Features.Compression.csproj", "{CD9A8535-A6B1-46BB-8ACB-73D5E393147E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.DefaultDocument", "JexusManager.Features.DefaultDocument\JexusManager.Features.DefaultDocument.csproj", "{1E54F67A-3538-4F8D-B2EE-5DA6A821A528}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.DirectoryBrowse", "JexusManager.Features.DirectoryBrowse\JexusManager.Features.DirectoryBrowse.csproj", "{5FB94CD1-AF29-4396-A27F-891243F12E8C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.FastCgi", "JexusManager.Features.FastCgi\JexusManager.Features.FastCgi.csproj", "{AA816B3F-8B23-4440-A276-898958204A6D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Handlers", "JexusManager.Features.Handlers\JexusManager.Features.Handlers.csproj", "{BD450763-248D-4117-9AF0-51A625667B61}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Modules", "JexusManager.Features.Modules\JexusManager.Features.Modules.csproj", "{8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.HttpApi", "JexusManager.Features.HttpApi\JexusManager.Features.HttpApi.csproj", "{2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.HttpErrors", "JexusManager.Features.HttpErrors\JexusManager.Features.HttpErrors.csproj", "{76F1FA9F-3E56-4D5C-9324-D69DB260EFA9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.HttpRedirect", "JexusManager.Features.HttpRedirect\JexusManager.Features.HttpRedirect.csproj", "{C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.IpSecurity", "JexusManager.Features.IpSecurity\JexusManager.Features.IpSecurity.csproj", "{361E2F47-289F-480F-B976-A6E3F7D96EDC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.IsapiCgiRestriction", "JexusManager.Features.IsapiCgiRestriction\JexusManager.Features.IsapiCgiRestriction.csproj", "{1571B862-8CD9-4314-9CCF-B1339D50298B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.IsapiFilters", "JexusManager.Features.IsapiFilters\JexusManager.Features.IsapiFilters.csproj", "{DBA682A8-0579-4F41-A852-18235A9A4A93}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Jexus", "JexusManager.Features.Jexus\JexusManager.Features.Jexus.csproj", "{EA333EE8-6551-4B5B-A733-119C5560608D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Logging", "JexusManager.Features.Logging\JexusManager.Features.Logging.csproj", "{5C2AE18D-D829-481B-8FCA-8AD0F69E68C8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.MimeMap", "JexusManager.Features.MimeMap\JexusManager.Features.MimeMap.csproj", "{FD1A63C6-458F-496B-9923-80ECA082C7EC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.RequestFiltering", "JexusManager.Features.RequestFiltering\JexusManager.Features.RequestFiltering.csproj", "{56D44318-5979-4FC5-9F01-4D7F78709A0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Rewrite", "JexusManager.Features.Rewrite\JexusManager.Features.Rewrite.csproj", "{425CEE66-72B3-42C0-989C-685B28B05230}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.ResponseHeaders", "JexusManager.Features.ResponseHeaders\JexusManager.Features.ResponseHeaders.csproj", "{7184AE3D-12D2-444D-B75A-2589F66E6B54}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Web.Administration", "Microsoft.Web.Administration\Microsoft.Web.Administration.csproj", "{BD24AFDA-292F-4F41-BA80-C48F21D4D9F2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.IIS", "Tests.IIS\Tests.IIS.csproj", "{4BB387EE-FE05-4215-AEA4-F7BECABBB9A9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{763C6B9C-29E4-4638-965B-7E49041A6B41}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.Asp", "JexusManager.Features.Asp\JexusManager.Features.Asp.csproj", "{7FAAFA3B-A3E7-4339-A69F-102177FD5097}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JexusManager.Features.TraceFailedRequests", "JexusManager.Features.TraceFailedRequests\JexusManager.Features.TraceFailedRequests.csproj", "{EB518EB5-2DFC-430B-90F8-D87124BE17DE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5203A38D-6A1D-4785-8E83-54081AD2ADAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5203A38D-6A1D-4785-8E83-54081AD2ADAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5203A38D-6A1D-4785-8E83-54081AD2ADAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5203A38D-6A1D-4785-8E83-54081AD2ADAA}.Release|Any CPU.Build.0 = Release|Any CPU - {17E994B0-5A31-4F79-9796-83A45E87853D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {17E994B0-5A31-4F79-9796-83A45E87853D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {17E994B0-5A31-4F79-9796-83A45E87853D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {17E994B0-5A31-4F79-9796-83A45E87853D}.Release|Any CPU.Build.0 = Release|Any CPU - {E4DAB2F5-AF63-413C-886A-09BC4353ADB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E4DAB2F5-AF63-413C-886A-09BC4353ADB6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E4DAB2F5-AF63-413C-886A-09BC4353ADB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E4DAB2F5-AF63-413C-886A-09BC4353ADB6}.Release|Any CPU.Build.0 = Release|Any CPU - {70A25201-8EA4-48F8-A4A6-ED13ADF8823C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {70A25201-8EA4-48F8-A4A6-ED13ADF8823C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {70A25201-8EA4-48F8-A4A6-ED13ADF8823C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {70A25201-8EA4-48F8-A4A6-ED13ADF8823C}.Release|Any CPU.Build.0 = Release|Any CPU - {54BEC09A-B32F-4A66-A871-749E0621D822}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {54BEC09A-B32F-4A66-A871-749E0621D822}.Debug|Any CPU.Build.0 = Debug|Any CPU - {54BEC09A-B32F-4A66-A871-749E0621D822}.Release|Any CPU.ActiveCfg = Release|Any CPU - {54BEC09A-B32F-4A66-A871-749E0621D822}.Release|Any CPU.Build.0 = Release|Any CPU - {AEF03715-1847-4BA7-BFDC-7D3E738E552C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AEF03715-1847-4BA7-BFDC-7D3E738E552C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AEF03715-1847-4BA7-BFDC-7D3E738E552C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AEF03715-1847-4BA7-BFDC-7D3E738E552C}.Release|Any CPU.Build.0 = Release|Any CPU - {E4040A45-B156-4048-B1A4-BD262BA18047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E4040A45-B156-4048-B1A4-BD262BA18047}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E4040A45-B156-4048-B1A4-BD262BA18047}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E4040A45-B156-4048-B1A4-BD262BA18047}.Release|Any CPU.Build.0 = Release|Any CPU - {B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9}.Release|Any CPU.Build.0 = Release|Any CPU - {AA7CCFC5-B695-4773-BA79-77CF6C36908F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA7CCFC5-B695-4773-BA79-77CF6C36908F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA7CCFC5-B695-4773-BA79-77CF6C36908F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA7CCFC5-B695-4773-BA79-77CF6C36908F}.Release|Any CPU.Build.0 = Release|Any CPU - {FEFD62BE-AA83-42B9-A79D-2DF0150F4F81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FEFD62BE-AA83-42B9-A79D-2DF0150F4F81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FEFD62BE-AA83-42B9-A79D-2DF0150F4F81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FEFD62BE-AA83-42B9-A79D-2DF0150F4F81}.Release|Any CPU.Build.0 = Release|Any CPU - {30A30352-CA83-446E-8AF8-598EA7397988}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {30A30352-CA83-446E-8AF8-598EA7397988}.Debug|Any CPU.Build.0 = Debug|Any CPU - {30A30352-CA83-446E-8AF8-598EA7397988}.Release|Any CPU.ActiveCfg = Release|Any CPU - {30A30352-CA83-446E-8AF8-598EA7397988}.Release|Any CPU.Build.0 = Release|Any CPU - {D37CF28B-10F1-4F28-B933-C5E18D7F09AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D37CF28B-10F1-4F28-B933-C5E18D7F09AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D37CF28B-10F1-4F28-B933-C5E18D7F09AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D37CF28B-10F1-4F28-B933-C5E18D7F09AA}.Release|Any CPU.Build.0 = Release|Any CPU - {0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16}.Release|Any CPU.Build.0 = Release|Any CPU - {CD9A8535-A6B1-46BB-8ACB-73D5E393147E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CD9A8535-A6B1-46BB-8ACB-73D5E393147E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CD9A8535-A6B1-46BB-8ACB-73D5E393147E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CD9A8535-A6B1-46BB-8ACB-73D5E393147E}.Release|Any CPU.Build.0 = Release|Any CPU - {1E54F67A-3538-4F8D-B2EE-5DA6A821A528}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E54F67A-3538-4F8D-B2EE-5DA6A821A528}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E54F67A-3538-4F8D-B2EE-5DA6A821A528}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E54F67A-3538-4F8D-B2EE-5DA6A821A528}.Release|Any CPU.Build.0 = Release|Any CPU - {5FB94CD1-AF29-4396-A27F-891243F12E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5FB94CD1-AF29-4396-A27F-891243F12E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FB94CD1-AF29-4396-A27F-891243F12E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5FB94CD1-AF29-4396-A27F-891243F12E8C}.Release|Any CPU.Build.0 = Release|Any CPU - {AA816B3F-8B23-4440-A276-898958204A6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA816B3F-8B23-4440-A276-898958204A6D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA816B3F-8B23-4440-A276-898958204A6D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA816B3F-8B23-4440-A276-898958204A6D}.Release|Any CPU.Build.0 = Release|Any CPU - {BD450763-248D-4117-9AF0-51A625667B61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD450763-248D-4117-9AF0-51A625667B61}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD450763-248D-4117-9AF0-51A625667B61}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD450763-248D-4117-9AF0-51A625667B61}.Release|Any CPU.Build.0 = Release|Any CPU - {8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F}.Release|Any CPU.Build.0 = Release|Any CPU - {2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED}.Release|Any CPU.Build.0 = Release|Any CPU - {76F1FA9F-3E56-4D5C-9324-D69DB260EFA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {76F1FA9F-3E56-4D5C-9324-D69DB260EFA9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {76F1FA9F-3E56-4D5C-9324-D69DB260EFA9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {76F1FA9F-3E56-4D5C-9324-D69DB260EFA9}.Release|Any CPU.Build.0 = Release|Any CPU - {C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53}.Release|Any CPU.Build.0 = Release|Any CPU - {361E2F47-289F-480F-B976-A6E3F7D96EDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {361E2F47-289F-480F-B976-A6E3F7D96EDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {361E2F47-289F-480F-B976-A6E3F7D96EDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {361E2F47-289F-480F-B976-A6E3F7D96EDC}.Release|Any CPU.Build.0 = Release|Any CPU - {1571B862-8CD9-4314-9CCF-B1339D50298B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1571B862-8CD9-4314-9CCF-B1339D50298B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1571B862-8CD9-4314-9CCF-B1339D50298B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1571B862-8CD9-4314-9CCF-B1339D50298B}.Release|Any CPU.Build.0 = Release|Any CPU - {DBA682A8-0579-4F41-A852-18235A9A4A93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DBA682A8-0579-4F41-A852-18235A9A4A93}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DBA682A8-0579-4F41-A852-18235A9A4A93}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DBA682A8-0579-4F41-A852-18235A9A4A93}.Release|Any CPU.Build.0 = Release|Any CPU - {EA333EE8-6551-4B5B-A733-119C5560608D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EA333EE8-6551-4B5B-A733-119C5560608D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EA333EE8-6551-4B5B-A733-119C5560608D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EA333EE8-6551-4B5B-A733-119C5560608D}.Release|Any CPU.Build.0 = Release|Any CPU - {5C2AE18D-D829-481B-8FCA-8AD0F69E68C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5C2AE18D-D829-481B-8FCA-8AD0F69E68C8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C2AE18D-D829-481B-8FCA-8AD0F69E68C8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5C2AE18D-D829-481B-8FCA-8AD0F69E68C8}.Release|Any CPU.Build.0 = Release|Any CPU - {FD1A63C6-458F-496B-9923-80ECA082C7EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FD1A63C6-458F-496B-9923-80ECA082C7EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD1A63C6-458F-496B-9923-80ECA082C7EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FD1A63C6-458F-496B-9923-80ECA082C7EC}.Release|Any CPU.Build.0 = Release|Any CPU - {56D44318-5979-4FC5-9F01-4D7F78709A0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {56D44318-5979-4FC5-9F01-4D7F78709A0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {56D44318-5979-4FC5-9F01-4D7F78709A0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {56D44318-5979-4FC5-9F01-4D7F78709A0E}.Release|Any CPU.Build.0 = Release|Any CPU - {425CEE66-72B3-42C0-989C-685B28B05230}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {425CEE66-72B3-42C0-989C-685B28B05230}.Debug|Any CPU.Build.0 = Debug|Any CPU - {425CEE66-72B3-42C0-989C-685B28B05230}.Release|Any CPU.ActiveCfg = Release|Any CPU - {425CEE66-72B3-42C0-989C-685B28B05230}.Release|Any CPU.Build.0 = Release|Any CPU - {7184AE3D-12D2-444D-B75A-2589F66E6B54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7184AE3D-12D2-444D-B75A-2589F66E6B54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7184AE3D-12D2-444D-B75A-2589F66E6B54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7184AE3D-12D2-444D-B75A-2589F66E6B54}.Release|Any CPU.Build.0 = Release|Any CPU - {BD24AFDA-292F-4F41-BA80-C48F21D4D9F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BD24AFDA-292F-4F41-BA80-C48F21D4D9F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BD24AFDA-292F-4F41-BA80-C48F21D4D9F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BD24AFDA-292F-4F41-BA80-C48F21D4D9F2}.Release|Any CPU.Build.0 = Release|Any CPU - {4BB387EE-FE05-4215-AEA4-F7BECABBB9A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4BB387EE-FE05-4215-AEA4-F7BECABBB9A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4BB387EE-FE05-4215-AEA4-F7BECABBB9A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4BB387EE-FE05-4215-AEA4-F7BECABBB9A9}.Release|Any CPU.Build.0 = Release|Any CPU - {763C6B9C-29E4-4638-965B-7E49041A6B41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {763C6B9C-29E4-4638-965B-7E49041A6B41}.Debug|Any CPU.Build.0 = Debug|Any CPU - {763C6B9C-29E4-4638-965B-7E49041A6B41}.Release|Any CPU.ActiveCfg = Release|Any CPU - {763C6B9C-29E4-4638-965B-7E49041A6B41}.Release|Any CPU.Build.0 = Release|Any CPU - {7FAAFA3B-A3E7-4339-A69F-102177FD5097}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7FAAFA3B-A3E7-4339-A69F-102177FD5097}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7FAAFA3B-A3E7-4339-A69F-102177FD5097}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7FAAFA3B-A3E7-4339-A69F-102177FD5097}.Release|Any CPU.Build.0 = Release|Any CPU - {EB518EB5-2DFC-430B-90F8-D87124BE17DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EB518EB5-2DFC-430B-90F8-D87124BE17DE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EB518EB5-2DFC-430B-90F8-D87124BE17DE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EB518EB5-2DFC-430B-90F8-D87124BE17DE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {70A25201-8EA4-48F8-A4A6-ED13ADF8823C} = {678654EE-C2A2-49A5-ACE3-ECB31288C2F7} - {B756B3A0-CFC8-4E71-A95A-0E9DC2A8D0C9} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {AA7CCFC5-B695-4773-BA79-77CF6C36908F} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {FEFD62BE-AA83-42B9-A79D-2DF0150F4F81} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {30A30352-CA83-446E-8AF8-598EA7397988} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {D37CF28B-10F1-4F28-B933-C5E18D7F09AA} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {0ADF28C5-377F-4AA3-B732-AA8C8AEEBB16} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {CD9A8535-A6B1-46BB-8ACB-73D5E393147E} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {1E54F67A-3538-4F8D-B2EE-5DA6A821A528} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {5FB94CD1-AF29-4396-A27F-891243F12E8C} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {AA816B3F-8B23-4440-A276-898958204A6D} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {BD450763-248D-4117-9AF0-51A625667B61} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {8BFAB6BC-57C1-44FC-88E2-B3CE5B75BE9F} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {2B03E7FE-3DBD-4914-AD8C-4CB7007A9EED} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {76F1FA9F-3E56-4D5C-9324-D69DB260EFA9} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {C0C1DDE1-6447-4D3E-BC1A-F62CABBDBB53} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {361E2F47-289F-480F-B976-A6E3F7D96EDC} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {1571B862-8CD9-4314-9CCF-B1339D50298B} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {DBA682A8-0579-4F41-A852-18235A9A4A93} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {EA333EE8-6551-4B5B-A733-119C5560608D} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {5C2AE18D-D829-481B-8FCA-8AD0F69E68C8} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {FD1A63C6-458F-496B-9923-80ECA082C7EC} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {56D44318-5979-4FC5-9F01-4D7F78709A0E} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {425CEE66-72B3-42C0-989C-685B28B05230} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {7184AE3D-12D2-444D-B75A-2589F66E6B54} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {7FAAFA3B-A3E7-4339-A69F-102177FD5097} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - {EB518EB5-2DFC-430B-90F8-D87124BE17DE} = {02EA3ED9-4B28-4CD2-9461-00111A75D6F7} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7363EF70-243E-4614-9C23-FCF14D370A8A} - EndGlobalSection -EndGlobal diff --git a/JexusManager.slnx b/JexusManager.slnx index 21f2e04d..da841c50 100644 --- a/JexusManager.slnx +++ b/JexusManager.slnx @@ -1,7 +1,7 @@ - + diff --git a/JexusManager/BindingExtensions.cs b/JexusManager/BindingExtensions.cs index 0b464e7e..d0d37212 100644 --- a/JexusManager/BindingExtensions.cs +++ b/JexusManager/BindingExtensions.cs @@ -73,7 +73,7 @@ public static ListViewItem ToListViewItem(this Binding binding) address, binding.CanBrowse ? string.Empty : binding.BindingInformation }) - { Tag = binding }; + { Tag = binding }; } #endif } diff --git a/JexusManager/Dialogs/NewSiteDialog.cs b/JexusManager/Dialogs/NewSiteDialog.cs index 26682006..53b2f35b 100644 --- a/JexusManager/Dialogs/NewSiteDialog.cs +++ b/JexusManager/Dialogs/NewSiteDialog.cs @@ -38,7 +38,7 @@ public NewSiteDialog(IServiceProvider serviceProvider, SiteCollection collection { throw new InvalidOperationException("null server for site collection"); } - + btnBrowse.Visible = collection.Parent.IsLocalhost; txtPool.Text = collection.Parent.ApplicationDefaults.ApplicationPoolName; btnChoose.Enabled = collection.Parent.Mode != WorkingMode.Jexus; @@ -183,7 +183,7 @@ public NewSiteDialog(IServiceProvider serviceProvider, SiteCollection collection if (collection.Parent.Mode == WorkingMode.IisExpress || collection.Parent.Mode == WorkingMode.Iis) { - var (state, message) = binding.FixCertificateMapping(info?.Certificate); + var (state, message) = binding.FixCertificateMapping(info?.Certificate); if (state != CertificateMappingState.RegistrationSucceeded) { if (state == CertificateMappingState.HostNameNotMatched) diff --git a/JexusManager/Dialogs/NewVirtualDirectoryDialog.cs b/JexusManager/Dialogs/NewVirtualDirectoryDialog.cs index f4d376a9..7319f535 100644 --- a/JexusManager/Dialogs/NewVirtualDirectoryDialog.cs +++ b/JexusManager/Dialogs/NewVirtualDirectoryDialog.cs @@ -63,83 +63,83 @@ public NewVirtualDirectoryDialog(IServiceProvider serviceProvider, VirtualDirect RefreshButton(); })); - container.Add( - Observable.FromEventPattern(btnOK, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - foreach (var ch in ApplicationCollection.InvalidApplicationPathCharacters()) - { - if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture))) - { - ShowMessage("The application path cannot contain the following characters: \\, ?, ;, :, @, &, =, +, $, ,, |, \", <, >, *.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); - return; - } - } - - foreach (var ch in SiteCollection.InvalidSiteNameCharactersJexus()) - { - if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture))) - { - ShowMessage("The site name cannot contain the following characters: ' '.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); - return; - } - } - - if (!application.Server.Verify(txtPhysicalPath.Text, application.GetActualExecutable())) - { - ShowMessage("The specified directory does not exist on the server.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); - return; - } - - if (VirtualDirectory == null) - { - string path = "/" + txtAlias.Text; - foreach (VirtualDirectory virtualDirectory in application.VirtualDirectories) - { - if (string.Equals(virtualDirectory.Path, path, StringComparison.OrdinalIgnoreCase)) - { - ShowMessage("This virtual directory already exists.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); - return; - } - } - - var fullPath = $"{txtPath.Text}{path}"; - foreach (Application app in application.Site.Applications) - { - if (string.Equals(fullPath, app.Path)) - { - ShowMessage("An application with this virtual path already exists.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); - return; - } - } - - try - { - VirtualDirectory = new VirtualDirectory(null, application.VirtualDirectories) - { - Path = path - }; - } - catch (COMException ex) - { - ShowError(ex, Text, false); - return; - } - - VirtualDirectory.PhysicalPath = txtPhysicalPath.Text; - VirtualDirectory.Parent.Add(VirtualDirectory); - - item.Element = VirtualDirectory; - item.Apply(); - } - else - { - VirtualDirectory.PhysicalPath = txtPhysicalPath.Text; - } - - DialogResult = DialogResult.OK; - })); + container.Add( + Observable.FromEventPattern(btnOK, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + foreach (var ch in ApplicationCollection.InvalidApplicationPathCharacters()) + { + if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture))) + { + ShowMessage("The application path cannot contain the following characters: \\, ?, ;, :, @, &, =, +, $, ,, |, \", <, >, *.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + return; + } + } + + foreach (var ch in SiteCollection.InvalidSiteNameCharactersJexus()) + { + if (txtAlias.Text.Contains(ch.ToString(CultureInfo.InvariantCulture))) + { + ShowMessage("The site name cannot contain the following characters: ' '.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + return; + } + } + + if (!application.Server.Verify(txtPhysicalPath.Text, application.GetActualExecutable())) + { + ShowMessage("The specified directory does not exist on the server.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + return; + } + + if (VirtualDirectory == null) + { + string path = "/" + txtAlias.Text; + foreach (VirtualDirectory virtualDirectory in application.VirtualDirectories) + { + if (string.Equals(virtualDirectory.Path, path, StringComparison.OrdinalIgnoreCase)) + { + ShowMessage("This virtual directory already exists.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + return; + } + } + + var fullPath = $"{txtPath.Text}{path}"; + foreach (Application app in application.Site.Applications) + { + if (string.Equals(fullPath, app.Path)) + { + ShowMessage("An application with this virtual path already exists.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); + return; + } + } + + try + { + VirtualDirectory = new VirtualDirectory(null, application.VirtualDirectories) + { + Path = path + }; + } + catch (COMException ex) + { + ShowError(ex, Text, false); + return; + } + + VirtualDirectory.PhysicalPath = txtPhysicalPath.Text; + VirtualDirectory.Parent.Add(VirtualDirectory); + + item.Element = VirtualDirectory; + item.Apply(); + } + else + { + VirtualDirectory.PhysicalPath = txtPhysicalPath.Text; + } + + DialogResult = DialogResult.OK; + })); container.Add( Observable.FromEventPattern(btnConnect, "Click") diff --git a/JexusManager/Dialogs/SelectPoolDialog.cs b/JexusManager/Dialogs/SelectPoolDialog.cs index e35b4934..cf870ee2 100644 --- a/JexusManager/Dialogs/SelectPoolDialog.cs +++ b/JexusManager/Dialogs/SelectPoolDialog.cs @@ -26,7 +26,7 @@ public SelectPoolDialog(string name, ServerManager server) { continue; } - + selected = index; btnOK.Enabled = true; } diff --git a/JexusManager/Features/Main/ApplicationPoolAdvancedSettings.cs b/JexusManager/Features/Main/ApplicationPoolAdvancedSettings.cs index c72edd82..94c57b4e 100644 --- a/JexusManager/Features/Main/ApplicationPoolAdvancedSettings.cs +++ b/JexusManager/Features/Main/ApplicationPoolAdvancedSettings.cs @@ -177,7 +177,7 @@ internal void Apply(ApplicationPool pool) pool.ProcessModel.PingingEnabled = PingingEnabled; pool.ProcessModel.PingResponseTime = TimeSpan.FromSeconds(PingResponseTime); pool.ProcessModel.PingInterval = TimeSpan.FromSeconds(PingInterval); - pool.ProcessModel.ShutdownTimeLimit = TimeSpan.FromSeconds( ShutdownTimeLimit); + pool.ProcessModel.ShutdownTimeLimit = TimeSpan.FromSeconds(ShutdownTimeLimit); pool.ProcessModel.StartupTimeLimit = TimeSpan.FromSeconds(StartupTimeLimit); pool.Failure.OrphanWorkerProcess = OrphanWorkerProcess; diff --git a/JexusManager/Features/Main/ApplicationPoolsFeature.cs b/JexusManager/Features/Main/ApplicationPoolsFeature.cs index d02f4f40..09fb53df 100644 --- a/JexusManager/Features/Main/ApplicationPoolsFeature.cs +++ b/JexusManager/Features/Main/ApplicationPoolsFeature.cs @@ -298,10 +298,10 @@ private void Applications() { return; } - + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var mainForm = (MainForm)service.Form; - + // Find all applications using this pool var applications = new List(); foreach (Site container in _serverManager.Sites) @@ -314,18 +314,18 @@ private void Applications() } } } - + if (applications.Count == 0) { var dialog = (IManagementUIService)GetService(typeof(IManagementUIService)); - dialog.ShowMessage("No applications are using this application pool.", "Applications", + dialog.ShowMessage("No applications are using this application pool.", "Applications", MessageBoxButtons.OK, MessageBoxIcon.Information); return; - } - + } + var page = new ApplicationsPage(); ((IModulePage)page).Initialize(Module, null, new Tuple, Site>(applications, null)); - + mainForm.LoadPageAndSelectNode(page, service.Server); } diff --git a/JexusManager/Features/Main/ApplicationPoolsPage.cs b/JexusManager/Features/Main/ApplicationPoolsPage.cs index 0b8b1729..544a643a 100644 --- a/JexusManager/Features/Main/ApplicationPoolsPage.cs +++ b/JexusManager/Features/Main/ApplicationPoolsPage.cs @@ -198,6 +198,6 @@ private void ListView1_SelectedIndexChanged(object sender, EventArgs e) { _feature.HandleSelectedIndexChanged(listView1); Refresh(); - } + } } } diff --git a/JexusManager/Features/Main/ApplicationsFeature.cs b/JexusManager/Features/Main/ApplicationsFeature.cs index d77c53c8..e52b67c3 100644 --- a/JexusManager/Features/Main/ApplicationsFeature.cs +++ b/JexusManager/Features/Main/ApplicationsFeature.cs @@ -212,7 +212,7 @@ private void Add() _site.Server.CommitChanges(); Items = _site.Applications.Where(app => app.Path != "/").ToList(); } - + OnApplicationsSettingsSaved(); } @@ -224,9 +224,9 @@ internal void Remove() } var service = (IManagementUIService)GetService(typeof(IManagementUIService)); - var result = service.ShowMessage("Are you sure that you want to remove the selected application?", + var result = service.ShowMessage("Are you sure that you want to remove the selected application?", "Confirm Remove", - MessageBoxButtons.YesNoCancel, + MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result != DialogResult.Yes) { @@ -235,15 +235,15 @@ internal void Remove() var index = _site.Applications.IndexOf(SelectedItem); _site.Applications.Remove(SelectedItem); - + if (_site.Applications.Count <= 1) // Count is 1 means only root application { SelectedItem = null; } else { - SelectedItem = index > _site.Applications.Count - 1 - ? _site.Applications[_site.Applications.Count - 1] + SelectedItem = index > _site.Applications.Count - 1 + ? _site.Applications[_site.Applications.Count - 1] : _site.Applications[index]; // Ensure we don't select the root application @@ -288,14 +288,14 @@ private void VirtualDirectories() { return; } - + var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var mainForm = (MainForm)service.Form; - + // Create a new VirtualDirectoriesPage and initialize it with the application var page = new VirtualDirectoriesPage(); ((IModulePage)page).Initialize(Module, null, SelectedItem); - + // Load the page in the main form mainForm.LoadPage(page); } @@ -350,7 +350,7 @@ private void Browse(object uri) { return; } - + // Help users launch IIS Express instance if needed var site = _site; if (site.Server.Mode == WorkingMode.IisExpress && site.State != ObjectState.Started) diff --git a/JexusManager/Features/Main/BindingDiagDialog.cs b/JexusManager/Features/Main/BindingDiagDialog.cs index 69a39315..3b5c94c3 100644 --- a/JexusManager/Features/Main/BindingDiagDialog.cs +++ b/JexusManager/Features/Main/BindingDiagDialog.cs @@ -43,19 +43,19 @@ public BindingDiagDialog(IServiceProvider provider, Site site) AnalyzeBinding(site, (Module)provider); })); - container.Add( - Observable.FromEventPattern(btnSave, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); - if (string.IsNullOrEmpty(fileName)) - { - return; - } - - File.WriteAllText(fileName, txtResult.Text); - })); + container.Add( + Observable.FromEventPattern(btnSave, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + File.WriteAllText(fileName, txtResult.Text); + })); } private void Debug(string text) diff --git a/JexusManager/Features/Main/HomePage.cs b/JexusManager/Features/Main/HomePage.cs index 37599b53..f6901dfe 100644 --- a/JexusManager/Features/Main/HomePage.cs +++ b/JexusManager/Features/Main/HomePage.cs @@ -33,7 +33,7 @@ private async void LoadUpdateInfo() lblUpdateStatus.ForeColor = Color.Black; btnDownloadUpdate.Visible = false; btnRetry.Visible = false; - + _updateInfo = await UpdateHelper.CheckForUpdate(); UpdateVersionDisplay(); } @@ -60,7 +60,7 @@ private void UpdateVersionDisplay() // Create a more helpful message for connectivity issues lblUpdateStatus.Text = "Cannot connect to GitHub. You can check for updates manually at:"; lblUpdateStatus.ForeColor = Color.Red; - + // Show link label for manual update check lblManualUpdate.Text = _updateInfo.ReleaseUrl; lblManualUpdate.Visible = true; @@ -71,7 +71,7 @@ private void UpdateVersionDisplay() lblUpdateStatus.ForeColor = Color.Red; lblManualUpdate.Visible = false; } - + btnDownloadUpdate.Visible = false; btnRetry.Visible = true; return; @@ -125,7 +125,7 @@ private void btnRetry_Click(object sender, EventArgs e) { // Hide the manual update link when retrying lblManualUpdate.Visible = false; - + // Reload update info LoadUpdateInfo(); } @@ -144,9 +144,9 @@ private void ConfigureManualUpdateLink() lblManualUpdate.MaximumSize = new System.Drawing.Size( groupBox2.Width - lblManualUpdate.Left - 30, 0); lblManualUpdate.AutoSize = true; - + // Ensure the link resizes when the container resizes - groupBox2.SizeChanged += (sender, e) => + groupBox2.SizeChanged += (sender, e) => { lblManualUpdate.MaximumSize = new System.Drawing.Size( groupBox2.Width - lblManualUpdate.Left - 30, 0); diff --git a/JexusManager/Features/Main/KestrelDiagDialog.cs b/JexusManager/Features/Main/KestrelDiagDialog.cs index 44ac64f3..4aa0cf73 100644 --- a/JexusManager/Features/Main/KestrelDiagDialog.cs +++ b/JexusManager/Features/Main/KestrelDiagDialog.cs @@ -296,7 +296,7 @@ public KestrelDiagDialog(IServiceProvider provider, Application application) Error($"To run ASP.NET Core on IIS, please refer to https://docs.microsoft.com/aspnet/core/host-and-deploy/iis/index for more details."); return; } - + var pool = application.GetPool(); if (pool == null) { @@ -508,27 +508,27 @@ public KestrelDiagDialog(IServiceProvider provider, Application application) } })); - container.Add( - Observable.FromEventPattern(btnSave, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", application.GetActualExecutable()); - if (string.IsNullOrEmpty(fileName)) - { - return; - } - - File.WriteAllText(fileName, txtResult.Text); - })); + container.Add( + Observable.FromEventPattern(btnSave, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", application.GetActualExecutable()); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + File.WriteAllText(fileName, txtResult.Text); + })); - container.Add( - Observable.FromEventPattern(btnVerify, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - txtResult.Clear(); - })); + container.Add( + Observable.FromEventPattern(btnVerify, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + txtResult.Clear(); + })); } private void Debug(string text) diff --git a/JexusManager/Features/Main/ModulePageInfoListViewItem.cs b/JexusManager/Features/Main/ModulePageInfoListViewItem.cs index 20af530c..9823f16c 100644 --- a/JexusManager/Features/Main/ModulePageInfoListViewItem.cs +++ b/JexusManager/Features/Main/ModulePageInfoListViewItem.cs @@ -30,4 +30,4 @@ public IModulePage Page } } } -} \ No newline at end of file +} diff --git a/JexusManager/Features/Main/PhpDiagDialog.cs b/JexusManager/Features/Main/PhpDiagDialog.cs index e1673549..bfffd1b9 100644 --- a/JexusManager/Features/Main/PhpDiagDialog.cs +++ b/JexusManager/Features/Main/PhpDiagDialog.cs @@ -73,27 +73,27 @@ public PhpDiagDialog(IServiceProvider provider, ServerManager server) AnalyzePhpConfig(server, (Module)provider, knownPhpVersions); })); - container.Add( - Observable.FromEventPattern(btnSave, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); - if (string.IsNullOrEmpty(fileName)) - { - return; - } - - File.WriteAllText(fileName, txtResult.Text); - })); + container.Add( + Observable.FromEventPattern(btnSave, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + File.WriteAllText(fileName, txtResult.Text); + })); - container.Add( - Observable.FromEventPattern(btnVerify, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - txtResult.Clear(); - })); + container.Add( + Observable.FromEventPattern(btnVerify, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + txtResult.Clear(); + })); } private void Debug(string text) @@ -215,7 +215,7 @@ private void AnalyzePhpConfig(ServerManager server, Module module, Dictionary, Site>(null, SelectedItem)); - + // Load the page in the main form and synchronize tree selection mainForm.LoadPageAndSelectNode(page, SelectedItem); } @@ -503,7 +503,7 @@ public override string GetGroupKey(ListViewItem item, string selectedGroup) { case "Status": return item.SubItems[2].Text; - // TODO: + // TODO: //case "IP Address": // return site.Bindings; //case "Protocol": diff --git a/JexusManager/Features/Main/SslDiagDialog.cs b/JexusManager/Features/Main/SslDiagDialog.cs index 9d8444c4..e0577ad7 100644 --- a/JexusManager/Features/Main/SslDiagDialog.cs +++ b/JexusManager/Features/Main/SslDiagDialog.cs @@ -166,7 +166,7 @@ public SslDiagDialog(IServiceProvider provider, ServerManager server) Debug(string.Empty); continue; } - + var hashString = Hex.ToHexString(binding.CertificateHash); Debug($"SSLCertHash: {hashString}"); if (site.Server.SupportsSni) @@ -376,27 +376,27 @@ public SslDiagDialog(IServiceProvider provider, ServerManager server) } })); - container.Add( - Observable.FromEventPattern(btnSave, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); - if (string.IsNullOrEmpty(fileName)) - { - return; - } - - File.WriteAllText(fileName, txtResult.Text); - })); + container.Add( + Observable.FromEventPattern(btnSave, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", null); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + File.WriteAllText(fileName, txtResult.Text); + })); - container.Add( - Observable.FromEventPattern(btnVerify, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - txtResult.Clear(); - })); + container.Add( + Observable.FromEventPattern(btnVerify, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + txtResult.Clear(); + })); } private void Debug(string text) diff --git a/JexusManager/Features/Main/VirtualDirectoriesFeature.cs b/JexusManager/Features/Main/VirtualDirectoriesFeature.cs index a5bb1268..d2e60773 100644 --- a/JexusManager/Features/Main/VirtualDirectoriesFeature.cs +++ b/JexusManager/Features/Main/VirtualDirectoriesFeature.cs @@ -71,7 +71,7 @@ public override ICollection GetTaskItems() Resources.browse_16, uri).SetUsage()); } } - } + } result.Add(MethodTaskItem.CreateSeparator().SetUsage()); result.Add(new TextTaskItem("Edit Virtual Directory", string.Empty, true)); @@ -80,7 +80,7 @@ public override ICollection GetTaskItems() Resources.basic_settings_16).SetUsage()); result.Add( new MethodTaskItem("Advanced", "Advanced Settings...", string.Empty).SetUsage()); - + } return result.ToArray(typeof(TaskItem)) as TaskItem[]; @@ -203,9 +203,9 @@ internal void Remove() } var service = (IManagementUIService)GetService(typeof(IManagementUIService)); - var result = service.ShowMessage("Are you sure that you want to remove the selected virtual directory?", + var result = service.ShowMessage("Are you sure that you want to remove the selected virtual directory?", "Confirm Remove", - MessageBoxButtons.YesNoCancel, + MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result != DialogResult.Yes) { @@ -214,15 +214,15 @@ internal void Remove() var index = _application.VirtualDirectories.IndexOf(SelectedItem); _application.VirtualDirectories.Remove(SelectedItem); - + if (_application.VirtualDirectories.Count == 0) { SelectedItem = null; } else { - SelectedItem = index > _application.VirtualDirectories.Count - 1 - ? _application.VirtualDirectories[_application.VirtualDirectories.Count - 1] + SelectedItem = index > _application.VirtualDirectories.Count - 1 + ? _application.VirtualDirectories[_application.VirtualDirectories.Count - 1] : _application.VirtualDirectories[index]; } diff --git a/JexusManager/Features/Main/VirtualDirectoriesPage.cs b/JexusManager/Features/Main/VirtualDirectoriesPage.cs index c6a4cb9a..fdb02acb 100644 --- a/JexusManager/Features/Main/VirtualDirectoriesPage.cs +++ b/JexusManager/Features/Main/VirtualDirectoriesPage.cs @@ -49,7 +49,7 @@ private sealed class VirtualDirectoriesListViewItem : ListViewItem, IFeatureList private readonly VirtualDirectoriesPage _page; public VirtualDirectoriesListViewItem(VirtualDirectory item, VirtualDirectoriesPage page) - : base(item.Application.IsRoot() ? "Root Application": item.Application.Path) // TODO: miss the icon in this column. + : base(item.Application.IsRoot() ? "Root Application" : item.Application.Path) // TODO: miss the icon in this column. { Item = item; _page = page; @@ -94,7 +94,7 @@ protected override void InitializeListPage() { listView1.Items.Add(new VirtualDirectoriesListViewItem(vdir, this)); } - + _feature.InitializeColumnClick(listView1); if (_feature.SelectedItem != null) diff --git a/JexusManager/Features/Main/VsDiagDialog.cs b/JexusManager/Features/Main/VsDiagDialog.cs index 9d488276..b4ad28e5 100644 --- a/JexusManager/Features/Main/VsDiagDialog.cs +++ b/JexusManager/Features/Main/VsDiagDialog.cs @@ -111,27 +111,27 @@ public VsDiagDialog(IServiceProvider provider, Site site) } })); - container.Add( - Observable.FromEventPattern(btnSave, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", site.Applications[0].GetActualExecutable()); - if (string.IsNullOrEmpty(fileName)) - { - return; - } - - File.WriteAllText(fileName, txtResult.Text); - })); + container.Add( + Observable.FromEventPattern(btnSave, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + var fileName = DialogHelper.ShowSaveFileDialog(null, "Text Files|*.txt|All Files|*.*", site.Applications[0].GetActualExecutable()); + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + File.WriteAllText(fileName, txtResult.Text); + })); - container.Add( - Observable.FromEventPattern(btnVerify, "Click") - .ObserveOn(System.Threading.SynchronizationContext.Current) - .Subscribe(evt => - { - txtResult.Clear(); - })); + container.Add( + Observable.FromEventPattern(btnVerify, "Click") + .ObserveOn(System.Threading.SynchronizationContext.Current) + .Subscribe(evt => + { + txtResult.Clear(); + })); } private void AnalyzeAspNetCoreProject(string project, Site site) diff --git a/JexusManager/LoggingService.cs b/JexusManager/LoggingService.cs index cdc40307..2422db48 100644 --- a/JexusManager/LoggingService.cs +++ b/JexusManager/LoggingService.cs @@ -132,7 +132,7 @@ public void Log(LogLevel logLevel, EventId eventId, TState state, Except LogLevel.Critical => ("crt", Color.Magenta), _ => ("unk", Color.DarkGray) }; - + var message = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{levelText}] {formatter(state, exception)}"; if (exception != null) message += Environment.NewLine + exception; diff --git a/JexusManager/MainForm.cs b/JexusManager/MainForm.cs index f9ef554d..1df21297 100644 --- a/JexusManager/MainForm.cs +++ b/JexusManager/MainForm.cs @@ -81,7 +81,7 @@ public MainForm(List files, RichTextBox textBox) _logPanel.Controls.Add(textBox); - LogHelper.GetLogger().LogInformation("Jexus Manager starting up. Version: {Version}", + LogHelper.GetLogger().LogInformation("Jexus Manager starting up. Version: {Version}", Assembly.GetExecutingAssembly().GetName().Version); // Add toggle logging menu item @@ -277,7 +277,7 @@ private void LoadIisExpress() this, _serviceContainer, name: parts[0], - fileName: parts[1], + fileName: parts[1], server: null, ignoreInCache: false); RegisterServer(data); @@ -373,9 +373,9 @@ private void LoadJexus() foreach (var item in lines) { var parts = item.Split(','); - var data = ServerTreeNode.CreateJexusNode( + var data = ServerTreeNode.CreateJexusNode( this, - _serviceContainer, + _serviceContainer, name: parts[0], hostName: parts[1], credentials: parts[4], @@ -416,14 +416,14 @@ private void actCreateSite_Execute(object sender, EventArgs e) if (data.ServerManager == null) { - LogHelper.GetLogger().LogWarning("Null server: {DisplayName} : {Mode} : {Text} : {Type}", + LogHelper.GetLogger().LogWarning("Null server: {DisplayName} : {Mode} : {Text} : {Type}", data.DisplayName, data.Mode, selected.Text, selected.GetType().FullName); return; } if (data.ServerManager.Sites == null) { - LogHelper.GetLogger().LogWarning("Null sites collection: {DisplayName} : {Mode} : {Text} : {Type} : {FileName}", + LogHelper.GetLogger().LogWarning("Null sites collection: {DisplayName} : {Mode} : {Text} : {Type} : {FileName}", data.DisplayName, data.Mode, selected.Text, selected.GetType().FullName, data.ServerManager.FileName); return; } @@ -645,7 +645,7 @@ internal void RemoveSiteNode(Site site) { return; } - + var data = GetCurrentData(selected); if (data.IsBusy) { @@ -792,7 +792,7 @@ internal void UpdateSiteNode(Site site) { return; } - + var data = GetCurrentData(selected); if (data.IsBusy) { @@ -816,7 +816,7 @@ internal void ShowSite(Site site) { return; } - + var data = GetCurrentData(selected); if (data.IsBusy) { @@ -840,7 +840,7 @@ internal void AddSiteNode(Site site) { return; } - + var server = GetCurrentData(selected); if (server.IsBusy) { @@ -1323,7 +1323,7 @@ public void SelectNodeForPage(IModulePage page, object navigationData) // Temporarily suspend the AfterSelect event to prevent duplicate loading bool wasHandlingEvents = _handleEvents; _handleEvents = false; - + try { // Find the appropriate node based on page type and navigation data @@ -1332,7 +1332,7 @@ public void SelectNodeForPage(IModulePage page, object navigationData) { // Expand parent nodes to make the target node visible EnsureNodeVisible(targetNode); - + // Select the node treeView1.SelectedNode = targetNode; } @@ -1352,7 +1352,7 @@ private void EnsureNodeVisible(TreeNode node) { if (node == null) return; - + TreeNode parent = node.Parent; while (parent != null) { @@ -1370,7 +1370,7 @@ private TreeNode FindNodeForPage(IModulePage page, object navigationData) { if (page == null || navigationData == null) return null; - + // Handle ApplicationsPage if (page is ApplicationsPage && navigationData is Site site) { @@ -1404,7 +1404,7 @@ private TreeNode FindNodeForPage(IModulePage page, object navigationData) { return FindSitesNode(); } - + return null; } @@ -1462,7 +1462,7 @@ private TreeNode FindSiteNode(Site site) { if (site == null) return null; - + // Look through all server nodes foreach (TreeNode serverNode in treeView1.Nodes) { @@ -1496,25 +1496,25 @@ private TreeNode FindApplicationNode(Application application) { if (application == null) return null; - + // First find the site node TreeNode siteNode = FindSiteNode(application.Site); if (siteNode == null) return null; - + // Expand to make sure the application nodes are loaded siteNode.Expand(); - + // Look for the application node by path foreach (TreeNode node in siteNode.Nodes) { - if (node is ApplicationTreeNode applicationNode && + if (node is ApplicationTreeNode applicationNode && applicationNode.Application.Path == application.Path) { return node; } } - + return null; } @@ -1526,7 +1526,7 @@ public void LoadPageAndSelectNode(IModulePage page, object navigationData) { // First load the page LoadPage(page); - + // Then select the corresponding node in the tree view SelectNodeForPage(page, navigationData); } diff --git a/JexusManager/Program.cs b/JexusManager/Program.cs index 7af9ab5e..d2060ab9 100644 --- a/JexusManager/Program.cs +++ b/JexusManager/Program.cs @@ -34,7 +34,7 @@ private static void Main(string[] args) OptionSet p = new OptionSet() .Add("h|help|?", "Display help", delegate (string v) { if (v != null) help = true; }) - .Add("j|jexus", "Enable Jexus web server support", delegate(string v) { if (v != null) jexus = true; }); + .Add("j|jexus", "Enable Jexus web server support", delegate (string v) { if (v != null) jexus = true; }); List extra; try diff --git a/JexusManager/Services/NavigationService.cs b/JexusManager/Services/NavigationService.cs index 8e75f344..d4e2eb30 100644 --- a/JexusManager/Services/NavigationService.cs +++ b/JexusManager/Services/NavigationService.cs @@ -38,9 +38,9 @@ public bool Navigate(Connection connection, ManagementConfigurationPath configur internal bool NavigateToItem(NavigationItem item, bool initializing) { - _logger.LogDebug("NavigateToItem - item: {PageType}, initializing: {IsInitializing}", + _logger.LogDebug("NavigateToItem - item: {PageType}, initializing: {IsInitializing}", item.PageType.Name, initializing); - + var previousItem = this.CurrentItem; var previous = previousItem?.Page; if (previous != null && previous.HasChanges) @@ -48,7 +48,7 @@ internal bool NavigateToItem(NavigationItem item, bool initializing) var basic = (ModulePage)previous; string msg = "The changes you have made will be lost. Do you want to save changes?"; _logger.LogDebug("Page has unsaved changes: {PageName}", basic.Text); - + if ( _host.UIService.ShowMessage( msg, @@ -69,7 +69,7 @@ internal bool NavigateToItem(NavigationItem item, bool initializing) } } } - else if (_host.UIService.ShowMessage(msg, basic.Text, MessageBoxButtons.YesNoCancel, + else if (_host.UIService.ShowMessage(msg, basic.Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button3) == DialogResult.Cancel) { // User cancelled navigation, so don't continue @@ -86,7 +86,7 @@ internal bool NavigateToItem(NavigationItem item, bool initializing) var current = _items.IndexOf(CurrentItem); if (current >= 0) // Only truncate if we have a current item { - _logger.LogDebug("Removing forward history from index {CurrentIndex} (current size: {HistorySize})", + _logger.LogDebug("Removing forward history from index {CurrentIndex} (current size: {HistorySize})", current + 1, _items.Count); _items.RemoveRange(current + 1, _items.Count - 1 - current); } @@ -98,14 +98,14 @@ internal bool NavigateToItem(NavigationItem item, bool initializing) CurrentItem = item; _logger.LogDebug("Current item set to: {PageType}", item.PageType.Name); - + var page = CurrentItem.Page; if (typeof(IModuleChildPage).IsAssignableFrom(item.PageType)) { var pageInfo = previous?.PageInfo; if (initializing) { - _logger.LogDebug("Initializing child page with parent: {ParentType}", + _logger.LogDebug("Initializing child page with parent: {ParentType}", pageInfo?.GetType().Name ?? "null"); page.Initialize(pageInfo?.AssociatedModule, pageInfo, item.NavigationData); } @@ -116,10 +116,10 @@ internal bool NavigateToItem(NavigationItem item, bool initializing) _host.LoadInner(page); OnNavigationPerformed(new NavigationEventArgs(this.CurrentItem, previousItem, initializing)); - + // Log the current navigation stack LogNavigationHistory(); - + return true; } @@ -128,7 +128,7 @@ public bool NavigateBack(int steps) var current = _items.IndexOf(CurrentItem); if (steps > current) { - _logger.LogWarning("Attempted to navigate back {Steps} steps but only {Available} available", + _logger.LogWarning("Attempted to navigate back {Steps} steps but only {Available} available", steps, current); throw new ArgumentOutOfRangeException(); } @@ -147,7 +147,7 @@ public bool NavigateForward() return false; } - _logger.LogDebug("Navigating forward from index {CurrentIndex} to {NewIndex}", + _logger.LogDebug("Navigating forward from index {CurrentIndex} to {NewIndex}", current, current + 1); CurrentItem = _items[current + 1]; return NavigateToItem(CurrentItem, false); @@ -155,21 +155,21 @@ public bool NavigateForward() public bool CanNavigateBack { - get - { + get + { var canNavigate = _items.IndexOf(CurrentItem) > 0; _logger.LogTrace("CanNavigateBack: {Result}", canNavigate); - return canNavigate; + return canNavigate; } } public bool CanNavigateForward { - get - { + get + { var canNavigate = _items.IndexOf(CurrentItem) < _items.Count - 1; _logger.LogTrace("CanNavigateForward: {Result}", canNavigate); - return canNavigate; + return canNavigate; } } @@ -189,20 +189,20 @@ private void OnNavigationPerformed(NavigationEventArgs e) e.NewItem?.PageType.Name ?? "null", e.OldItem?.PageType.Name ?? "null", e.IsNew); - + this.NavigationPerformed?.Invoke(this, e); } - + private void LogNavigationHistory() { var currentIndex = _items.IndexOf(CurrentItem); - var history = string.Join(" -> ", - _items.Select((item, index) => + var history = string.Join(" -> ", + _items.Select((item, index) => $"{(index == currentIndex ? "[" : "")}" + $"{item.PageType.Name}" + $"{(index == currentIndex ? "]" : "")}")); - - _logger.LogDebug("Navigation history (current index: {CurrentIndex}): {History}", + + _logger.LogDebug("Navigation history (current index: {CurrentIndex}): {History}", currentIndex, history); } } diff --git a/JexusManager/Tree/Hierarchy/ManagerHierarchyInfo.cs b/JexusManager/Tree/Hierarchy/ManagerHierarchyInfo.cs index 311e74c6..ea01fc25 100644 --- a/JexusManager/Tree/Hierarchy/ManagerHierarchyInfo.cs +++ b/JexusManager/Tree/Hierarchy/ManagerHierarchyInfo.cs @@ -115,7 +115,7 @@ public override void Refresh() { // Refresh the tree node _treeNode.Nodes.Clear(); - + if (_treeNode.TreeView != null && _treeNode.TreeView.IsHandleCreated) { // Add a temporary node to ensure the node can be expanded diff --git a/JexusManager/Tree/PlaceholderTreeNode.cs b/JexusManager/Tree/PlaceholderTreeNode.cs index 3b68d9ca..5a329188 100644 --- a/JexusManager/Tree/PlaceholderTreeNode.cs +++ b/JexusManager/Tree/PlaceholderTreeNode.cs @@ -42,7 +42,7 @@ public override void LoadPanels(MainForm mainForm, ServiceContainer serviceConta { _homePage = new HomePage(); } - + mainForm.LoadInner(_homePage); } diff --git a/JexusManager/UpdateHelper.cs b/JexusManager/UpdateHelper.cs index 7b142818..b07dab34 100644 --- a/JexusManager/UpdateHelper.cs +++ b/JexusManager/UpdateHelper.cs @@ -76,7 +76,7 @@ public static async Task CheckForUpdate() updateInfo.LatestVersion = latest; updateInfo.UpdateAvailable = updateInfo.CurrentVersion < latest; - + return updateInfo; } } diff --git a/JexusManager/Wizards/ConnectionWizard/BrowsePage.cs b/JexusManager/Wizards/ConnectionWizard/BrowsePage.cs index 89a27b1a..6d43e249 100644 --- a/JexusManager/Wizards/ConnectionWizard/BrowsePage.cs +++ b/JexusManager/Wizards/ConnectionWizard/BrowsePage.cs @@ -68,7 +68,7 @@ public override bool OnNext() var iisExpressX86 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IIS Express", "AppServer", "applicationhost.config"); var iisExpress2 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "IIS Express", "config", "templates", "PersonalWebServer", "applicationhost.config"); var iisExpress2X86 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IIS Express", "config", "templates", "PersonalWebServer", "applicationhost.config"); - if (string.Equals(iisExpress, data.FileName, StringComparison.OrdinalIgnoreCase) + if (string.Equals(iisExpress, data.FileName, StringComparison.OrdinalIgnoreCase) || string.Equals(iisExpressX86, data.FileName, StringComparison.OrdinalIgnoreCase) || string.Equals(iisExpress2, data.FileName, StringComparison.OrdinalIgnoreCase) || string.Equals(iisExpress2X86, data.FileName, StringComparison.OrdinalIgnoreCase)) diff --git a/Microsoft.Web.Administration/Application.cs b/Microsoft.Web.Administration/Application.cs index 8d0d83fc..e627e188 100644 --- a/Microsoft.Web.Administration/Application.cs +++ b/Microsoft.Web.Administration/Application.cs @@ -155,8 +155,8 @@ public string ApplicationPoolName get { var attribute = GetAttribute("applicationPool"); - return attribute.IsInheritedFromDefaultValue - ? Server.ApplicationDefaults.ApplicationPoolName + return attribute.IsInheritedFromDefaultValue + ? Server.ApplicationDefaults.ApplicationPoolName : (string)attribute.Value; } diff --git a/Microsoft.Web.Administration/ApplicationCollection.cs b/Microsoft.Web.Administration/ApplicationCollection.cs index e2e3b78f..1c5dc17e 100644 --- a/Microsoft.Web.Administration/ApplicationCollection.cs +++ b/Microsoft.Web.Administration/ApplicationCollection.cs @@ -16,7 +16,7 @@ internal ApplicationCollection(Site site) public Application Add(string path, string physicalPath) { - var result = new Application(this) {Path = path}; + var result = new Application(this) { Path = path }; result.Load(VirtualDirectory.RootPath, physicalPath); Add(result); return result; diff --git a/Microsoft.Web.Administration/AspNetCoreHelper.cs b/Microsoft.Web.Administration/AspNetCoreHelper.cs index ccb2f160..11061c38 100644 --- a/Microsoft.Web.Administration/AspNetCoreHelper.cs +++ b/Microsoft.Web.Administration/AspNetCoreHelper.cs @@ -25,7 +25,7 @@ internal static void FixConfigFile(string fileName) var doc = XDocument.Load(fileName); var virturalDirectories = doc.Descendants("virtualDirectory"); var fixSection = false; - foreach (var vDir in virturalDirectories) + foreach (var vDir in virturalDirectories) { string[] projects; try @@ -55,7 +55,7 @@ internal static void FixConfigFile(string fileName) var siteName = vDir.Ancestors("site").Select(s => s.Attribute("name").Value).FirstOrDefault(); FixSite(doc, siteName); } - + if (fixSection) { FixSection(doc); diff --git a/Microsoft.Web.Administration/Binding.cs b/Microsoft.Web.Administration/Binding.cs index ce8259b1..6d3f0698 100644 --- a/Microsoft.Web.Administration/Binding.cs +++ b/Microsoft.Web.Administration/Binding.cs @@ -227,8 +227,8 @@ internal string ToUri() return $"{Protocol}://{domain}"; } - domain = !string.IsNullOrWhiteSpace(host) - ? host + domain = !string.IsNullOrWhiteSpace(host) + ? host : address == "*" || address == "0.0.0.0" ? Parent.Parent.Parent.Parent.HostName.ExtractName() : address; @@ -360,7 +360,7 @@ public void RefreshCertificate() CertificateStoreName = string.Empty; return; } - + CertificateHash = certificate.Hash; CertificateStoreName = certificate.StoreName; } diff --git a/Microsoft.Web.Administration/ConfigurationAttribute.cs b/Microsoft.Web.Administration/ConfigurationAttribute.cs index 8c69542d..ef364ed1 100644 --- a/Microsoft.Web.Administration/ConfigurationAttribute.cs +++ b/Microsoft.Web.Administration/ConfigurationAttribute.cs @@ -186,19 +186,19 @@ private string Encrypt(string value) if (IsProtected) { var protectedInfo = _element.FileContext.ProtectedConfiguration; - + // Get all available providers var providers = protectedInfo.Providers.Items; - + if (providers.Count > 0) { string selectedProvider = null; - + // Determine which provider to use based on the element context - bool isAppPoolPassword = _element.ParentElement != null && - _element.ParentElement.ElementTagName == "processModel" && + bool isAppPoolPassword = _element.ParentElement != null && + _element.ParentElement.ElementTagName == "processModel" && Name == "password"; - + if (isAppPoolPassword) { // For application pool passwords, prefer IISWASOnlyCngProvider @@ -223,7 +223,7 @@ private string Encrypt(string value) selectedProvider = "IISWASOnlyCngProvider"; } } - + // If no preferred provider is found, fall back to any available provider if (selectedProvider == null) { @@ -233,7 +233,7 @@ private string Encrypt(string value) break; } } - + if (selectedProvider != null) { try @@ -255,7 +255,7 @@ private string Encrypt(string value) return value; } - + private object Decrypt(object value) { if (value is string && IsProtected) diff --git a/Microsoft.Web.Administration/ConfigurationAttributeSchema.cs b/Microsoft.Web.Administration/ConfigurationAttributeSchema.cs index 528d08f9..588367f8 100644 --- a/Microsoft.Web.Administration/ConfigurationAttributeSchema.cs +++ b/Microsoft.Web.Administration/ConfigurationAttributeSchema.cs @@ -310,7 +310,7 @@ private object CheckRawType(object value) { return value; } - + var valueType = value.GetType(); if (Type == "enum" && valueType.BaseType?.FullName == "System.Enum") { diff --git a/Microsoft.Web.Administration/ConfigurationElement.cs b/Microsoft.Web.Administration/ConfigurationElement.cs index 95c4e3a7..21e2ba1d 100644 --- a/Microsoft.Web.Administration/ConfigurationElement.cs +++ b/Microsoft.Web.Administration/ConfigurationElement.cs @@ -249,8 +249,8 @@ public ConfigurationElement GetChildElement(string elementName, Type elementType public ConfigurationElementCollection GetCollection() { - return this is ConfigurationSection section - ? section.Root.ForceLoad() + return this is ConfigurationSection section + ? section.Root.ForceLoad() : (this as ConfigurationElementCollection)?.ForceLoad(); } @@ -324,7 +324,7 @@ public object this[string attributeName] } public ConfigurationMethodCollection Methods { get; } - public IDictionary RawAttributes + public IDictionary RawAttributes => ConfigSource == null ? _rawAttributes : ConfigSource.RawAttributes; public ConfigurationElementSchema Schema { get; } diff --git a/Microsoft.Web.Administration/FileContext.cs b/Microsoft.Web.Administration/FileContext.cs index 8ccaba8e..46637b42 100644 --- a/Microsoft.Web.Administration/FileContext.cs +++ b/Microsoft.Web.Administration/FileContext.cs @@ -55,7 +55,7 @@ private void Initialize() _initialized = true; if (Parent != null) { - foreach(var item in Parent.DefinitionCache) + foreach (var item in Parent.DefinitionCache) { DefinitionCache.Add(item); } @@ -217,7 +217,7 @@ public SectionGroup GetEffectiveSectionGroup() { _effective.Sections.Add(item); } - + core = core.Parent; } @@ -712,7 +712,7 @@ private ConfigurationSection CreateSection(string sectionPath, string locationPa locationPath, core, null) - {OverrideMode = OverrideMode.Inherit}; + { OverrideMode = OverrideMode.Inherit }; if (locationPath == null) { section.OverrideModeEffective = (OverrideMode)Enum.Parse(typeof(OverrideMode), definition.OverrideModeDefault); diff --git a/Microsoft.Web.Administration/IisExpressServerManager.cs b/Microsoft.Web.Administration/IisExpressServerManager.cs index fd25c2ee..56655b6a 100644 --- a/Microsoft.Web.Administration/IisExpressServerManager.cs +++ b/Microsoft.Web.Administration/IisExpressServerManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Lex Li. All rights reserved. +// Copyright (c) Lex Li. All rights reserved. // // Licensed under the MIT license. See LICENSE file in the project root for full license information. @@ -23,10 +23,10 @@ public sealed class IisExpressServerManager : ServerManager public string PrimaryExecutable { get; } - public override bool SupportsSni => Version >= Version.Parse("8.0") && Environment.OSVersion.Version >= Version.Parse("6.2"); + public override bool SupportsSni => Version >= Version.Parse("8.0") && Environment.OSVersion.Version >= Version.Parse("6.2"); + + public override bool SupportsWildcard => Version >= Version.Parse("10.0") && Environment.OSVersion.Version >= Version.Parse("10.0"); - public override bool SupportsWildcard => Version >= Version.Parse("10.0") && Environment.OSVersion.Version >= Version.Parse("10.0"); - public static bool ServerInstalled { get @@ -150,7 +150,7 @@ private void StartInner(Site site, bool restart) var actualExecutable = application.GetActualExecutable(); var pool = application.GetPool() ?? throw new InvalidOperationException($"The application pool {application.ApplicationPoolName} does not exist."); var x64Tool = CertificateInstallerLocator.AlternativeFileName; - var tool = x64Tool != null && !pool.Enable32BitAppOnWin64 && pool.EnableEmulationOnWinArm64 + var tool = x64Tool != null && !pool.Enable32BitAppOnWin64 && pool.EnableEmulationOnWinArm64 ? x64Tool : CertificateInstallerLocator.FileName; var temp = Path.GetTempFileName(); diff --git a/Microsoft.Web.Administration/JexusHelper.cs b/Microsoft.Web.Administration/JexusHelper.cs index 8b404d58..29a698d8 100644 --- a/Microsoft.Web.Administration/JexusHelper.cs +++ b/Microsoft.Web.Administration/JexusHelper.cs @@ -37,47 +37,41 @@ public partial class JexusServerManager public async Task SaveKeyAsync(string key) { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/key/save", key); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/key/save", key); - if (response.IsSuccessStatusCode) - { - var result = (string)await response.Content.ReadAsAsync(typeof(string)); - return result; - } - - return string.Empty; + var result = (string)await response.Content.ReadAsAsync(typeof(string)); + return result; } + + return string.Empty; } public async Task SaveCertificateAsync(string text) { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/cert/save", text); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/cert/save", text); - if (response.IsSuccessStatusCode) - { - var result = (string)await response.Content.ReadAsAsync(typeof(string)); - return result; - } - - return string.Empty; + var result = (string)await response.Content.ReadAsAsync(typeof(string)); + return result; } + + return string.Empty; } public async Task GetCertificateAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/cert", _certificateCache); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/cert", _certificateCache); - if (response.IsSuccessStatusCode) - { - var result = (X509Certificate2)await response.Content.ReadAsAsync(typeof(X509Certificate2)); - return result; - } - - return null; + var result = (X509Certificate2)await response.Content.ReadAsAsync(typeof(X509Certificate2)); + return result; } + + return null; } public void SetCertificate(string certificate) @@ -94,7 +88,7 @@ internal HttpClient GetClient() { var requestHandler = new HttpClientHandler(); requestHandler.ServerCertificateCustomValidationCallback = ServerCertificateValidationCallback; - var client = new HttpClient(requestHandler) {BaseAddress = new Uri($"{s_protocol}://{HostName}/")}; + var client = new HttpClient(requestHandler) { BaseAddress = new Uri($"{s_protocol}://{HostName}/") }; client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("X-HTTP-Authorization", Credentials); @@ -104,62 +98,54 @@ internal HttpClient GetClient() public async Task GetVersionAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/server/version"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/server/version"); - if (response.IsSuccessStatusCode) - { - var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); - return new Version(succeeded); - } - - return null; + var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); + return new Version(succeeded); } + + return null; } public async Task HelloAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/hello", Environment.MachineName); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/hello", Environment.MachineName); - if (response.IsSuccessStatusCode) - { - var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); - return succeeded; - } - - return string.Empty; + var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); + return succeeded; } + + return string.Empty; } public async Task ByeAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/bye", Environment.MachineName); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/bye", Environment.MachineName); - if (response.IsSuccessStatusCode) - { - var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); - return succeeded; - } - - return string.Empty; + var succeeded = (string)await response.Content.ReadAsAsync(typeof(string)); + return succeeded; } + + return string.Empty; } public async Task LocalhostTestAsync(string path, string random) { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/server/test", path); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/server/test", path); - if (response.IsSuccessStatusCode) - { - var value = (string)await response.Content.ReadAsAsync(typeof(string)); - return value == random; - } - - return false; + var value = (string)await response.Content.ReadAsAsync(typeof(string)); + return value == random; } + + return false; } internal override bool Verify(string path, string executable) @@ -169,17 +155,15 @@ internal override bool Verify(string path, string executable) private async Task VerifyAsync(string path) { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PostAsJsonAsync("api/site/verify", path); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PostAsJsonAsync("api/site/verify", path); - if (response.IsSuccessStatusCode) - { - var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); - return succeeded; - } - - return false; + var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); + return succeeded; } + + return false; } public async Task LoadAsync() @@ -213,20 +197,18 @@ public async Task LoadAsync() } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/server/"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/server/"); - if (response.IsSuccessStatusCode) - { - variables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); - } + variables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); } } var newPool = new ApplicationPool(null, ApplicationPools) { Name = "DefaultAppPool", - ManagedRuntimeVersion = variables.Load(new List {ApplicationPool.ManagedRuntimeVersion20}, "runtime")[0] + ManagedRuntimeVersion = variables.Load(new List { ApplicationPool.ManagedRuntimeVersion20 }, "runtime")[0] }; newPool.ProcessModel.MaxProcesses = long.Parse(variables.Load(new List { "1" }, "httpd.processes")[0]); newPool.ProcessModel.UserName = variables.Load(new List { string.Empty }, "httpd.user")[0]; @@ -245,13 +227,11 @@ public async Task LoadAsync() } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/site/"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/site/"); - if (response.IsSuccessStatusCode) - { - sites = (List)await response.Content.ReadAsAsync(typeof(List)); - } + sites = (List)await response.Content.ReadAsAsync(typeof(List)); } } @@ -300,60 +280,52 @@ public async Task SaveAsync() } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PutAsJsonAsync("api/server/", variables); + var content = await response.Content.ReadAsStringAsync(); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PutAsJsonAsync("api/server/", variables); - var content = await response.Content.ReadAsStringAsync(); - if (response.IsSuccessStatusCode) - { - } } } } public async Task GetStatusAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/server/state"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/server/state"); - if (response.IsSuccessStatusCode) - { - var result = (bool)await response.Content.ReadAsAsync(typeof(bool)); - return result; - } - - return false; + var result = (bool)await response.Content.ReadAsAsync(typeof(bool)); + return result; } + + return false; } public async Task StopAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/server/stop"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/server/stop"); - if (response.IsSuccessStatusCode) - { - var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); - return succeeded; - } - - return false; + var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); + return succeeded; } + + return false; } public async Task StartAsync() { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync("api/server/start"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync("api/server/start"); - if (response.IsSuccessStatusCode) - { - var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); - return succeeded; - } - - return false; + var succeeded = (bool)await response.Content.ReadAsAsync(typeof(bool)); + return succeeded; } + + return false; } public async Task LoadAsync(Site site, long count, string file, string siteFolder) @@ -386,13 +358,11 @@ public async Task LoadAsync(Site site, long count, string file, string sit } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync($"api/site/{file}"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync($"api/site/{file}"); - if (response.IsSuccessStatusCode) - { - siteVariables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); - } + siteVariables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); } } @@ -434,13 +404,11 @@ public async Task LoadAsync(Site site, long count, string file, string sit } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync($"api/app/{site.Name}"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync($"api/app/{site.Name}"); - if (response.IsSuccessStatusCode) - { - appNames = (IEnumerable)await response.Content.ReadAsAsync(typeof(IEnumerable)); - } + appNames = (IEnumerable)await response.Content.ReadAsAsync(typeof(IEnumerable)); } } @@ -492,13 +460,11 @@ public async Task LoadAsync(Application application, string file, string appName } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.GetAsync($"api/app/get/{appName}"); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.GetAsync($"api/app/get/{appName}"); - if (response.IsSuccessStatusCode) - { - variables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); - } + variables = (SortedDictionary>)await response.Content.ReadAsAsync(typeof(SortedDictionary>)); } } } @@ -699,7 +665,7 @@ public async Task SaveAsync(Application application) variables.Add("addr", new List { application.Site.Bindings[0].EndPoint.Address.ToString() }); variables.Add("port", new List { application.Site.Bindings[0].EndPoint.Port.ToString() }); variables.Add("hosts", new List { application.Site.Bindings[0].Host }); - variables.Add("root", new List {$"{vDir.Path} {vDir.PhysicalPath}"}); + variables.Add("root", new List { $"{vDir.Path} {vDir.PhysicalPath}" }); variables.Add("nolog", new List { httpLoggingSection["dontLog"].ToString() }); variables.Add("keep_alive", new List { httpProtocolSection["allowKeepAlive"].ToString() }); @@ -770,12 +736,10 @@ public async Task SaveAsync(Application application) } else { - using (var client = GetClient()) + using var client = GetClient(); + HttpResponseMessage response = await client.PutAsJsonAsync($"api/site/{application.ToFileName()}", variables); + if (response.IsSuccessStatusCode) { - HttpResponseMessage response = await client.PutAsJsonAsync($"api/site/{application.ToFileName()}", variables); - if (response.IsSuccessStatusCode) - { - } } } } diff --git a/Microsoft.Web.Administration/JexusServerManager.cs b/Microsoft.Web.Administration/JexusServerManager.cs index 839e092b..9d11282d 100644 --- a/Microsoft.Web.Administration/JexusServerManager.cs +++ b/Microsoft.Web.Administration/JexusServerManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) Lex Li. All rights reserved. +// Copyright (c) Lex Li. All rights reserved. // // Licensed under the MIT license. See LICENSE file in the project root for full license information. diff --git a/Microsoft.Web.Administration/NativeMethods.cs b/Microsoft.Web.Administration/NativeMethods.cs index 6d2222f6..4f66e21d 100644 --- a/Microsoft.Web.Administration/NativeMethods.cs +++ b/Microsoft.Web.Administration/NativeMethods.cs @@ -995,9 +995,9 @@ public static void BindHttpNamespaceAcl(string networkURL, string securityDescri { if ((uint)WIN32_ERROR.NO_ERROR == retVal) { - var keyDesc = new HTTP_SERVICE_CONFIG_URLACL_KEY {pUrlPrefix = networkURL}; + var keyDesc = new HTTP_SERVICE_CONFIG_URLACL_KEY { pUrlPrefix = networkURL }; var paramDesc = - new HTTP_SERVICE_CONFIG_URLACL_PARAM {pStringSecurityDescriptor = securityDescriptor}; + new HTTP_SERVICE_CONFIG_URLACL_PARAM { pStringSecurityDescriptor = securityDescriptor }; var inputConfigInfoSet = new HTTP_SERVICE_CONFIG_URLACL_SET(); inputConfigInfoSet.KeyDesc = keyDesc; @@ -1056,9 +1056,9 @@ public static void DeleteHttpNamespaceAcl(string networkURL, string securityDesc { if ((uint)WIN32_ERROR.NO_ERROR == retVal) { - var keyDesc = new HTTP_SERVICE_CONFIG_URLACL_KEY {pUrlPrefix = networkURL}; + var keyDesc = new HTTP_SERVICE_CONFIG_URLACL_KEY { pUrlPrefix = networkURL }; var paramDesc = - new HTTP_SERVICE_CONFIG_URLACL_PARAM {pStringSecurityDescriptor = securityDescriptor}; + new HTTP_SERVICE_CONFIG_URLACL_PARAM { pStringSecurityDescriptor = securityDescriptor }; var inputConfigInfoSet = new HTTP_SERVICE_CONFIG_URLACL_SET(); inputConfigInfoSet.KeyDesc = keyDesc; @@ -1140,7 +1140,7 @@ private static GCHandle CreateSockaddrStructure(IPEndPoint ipEndPoint) private static SOCKADDR_STORAGE CreateSockAddrStorageStructure(int port) { var address = new SOCKADDR_IN - { + { sin_family = ADDRESS_FAMILY.AF_INET, sin_port = PInvoke.ntohs((ushort)port) }; @@ -1155,7 +1155,7 @@ private static SOCKADDR_STORAGE CreateSockAddrStorageStructure(int port) private static IPEndPoint ReadSockaddrStructure(IntPtr pSockaddrStructure) { short sAddressFamily = Marshal.ReadInt16(pSockaddrStructure); - AddressFamily addressFamily = (AddressFamily) sAddressFamily; + AddressFamily addressFamily = (AddressFamily)sAddressFamily; int sockAddrSructureSize; IPEndPoint ipEndPointAny; @@ -1187,7 +1187,7 @@ private static IPEndPoint ReadSockaddrStructure(IntPtr pSockaddrStructure) } // create IPEndPoint from SocketAddress - IPEndPoint result = (IPEndPoint) ipEndPointAny.Create(socketAddress); + IPEndPoint result = (IPEndPoint)ipEndPointAny.Create(socketAddress); return result; } @@ -1199,7 +1199,7 @@ private static IPEndPoint ReadSockaddrStructure(IntPtr pSockaddrStructure) private static IPEndPoint ReadSockAddrStorageStructure(SOCKADDR_STORAGE sockAddrStorageStructure) { var sAddressFamily = sockAddrStorageStructure.ss_family; - AddressFamily addressFamily = (AddressFamily) sAddressFamily; + AddressFamily addressFamily = (AddressFamily)sAddressFamily; switch (addressFamily) { case AddressFamily.InterNetwork: diff --git a/Microsoft.Web.Administration/ProtectedConfigurationProvider.cs b/Microsoft.Web.Administration/ProtectedConfigurationProvider.cs index 4d55ce4e..46477481 100644 --- a/Microsoft.Web.Administration/ProtectedConfigurationProvider.cs +++ b/Microsoft.Web.Administration/ProtectedConfigurationProvider.cs @@ -64,7 +64,7 @@ public ProtectedConfigurationProvider(ProviderSettings ps) _useMachineContainer = value2 != null && bool.Parse(value2.ToString()); _cspProviderName = (string)ps["cspProviderName"]; _providerType = (string)ps["type"]; - + try { // Determine which type to use - if providerType is empty, try to use cspProviderName @@ -106,26 +106,26 @@ private void InitializeProvider() { // Find the constructors var constructors = _providerClassType.GetConstructors(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); - + if (constructors.Length > 0) { // Try to find a constructor that takes parameters matching what we have foreach (var constructor in constructors) { var parameters = constructor.GetParameters(); - + // Look for the constructor with 5 parameters (sessionKey, keyContainerName, cspProviderName, useOAEP, useMachineContainer) // as seen in the CngEncryptionProvider class if (parameters.Length == 5) { - _nativeProvider = (IEncryptionProvider)constructor.Invoke(new object[] { - _sessionKey, - _keyContainerName, - _cspProviderName, - _useOAEP, - _useMachineContainer + _nativeProvider = (IEncryptionProvider)constructor.Invoke(new object[] { + _sessionKey, + _keyContainerName, + _cspProviderName, + _useOAEP, + _useMachineContainer }); - + System.Diagnostics.Debug.WriteLine($"Successfully loaded native provider: {_providerType}"); break; } diff --git a/Microsoft.Web.Administration/ProtectedProviderSettings.cs b/Microsoft.Web.Administration/ProtectedProviderSettings.cs index 95bd456b..487d0871 100644 --- a/Microsoft.Web.Administration/ProtectedProviderSettings.cs +++ b/Microsoft.Web.Administration/ProtectedProviderSettings.cs @@ -51,4 +51,4 @@ internal ProtectedProviderSettings(ConfigurationElement element, string name, Co { } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Administration/ServerManager.cs b/Microsoft.Web.Administration/ServerManager.cs index ed528cab..06eec585 100644 --- a/Microsoft.Web.Administration/ServerManager.cs +++ b/Microsoft.Web.Administration/ServerManager.cs @@ -44,7 +44,7 @@ public abstract class ServerManager : IFeatureDetection : HostName.ExtractName(); public abstract bool SupportsSni { get; } - + public abstract bool SupportsWildcard { get; } public WorkingMode Mode { get; protected set; } @@ -94,7 +94,7 @@ private void Initialize() Initialized = true; PreInitialize(); - + var machine = new Configuration( new FileContext( diff --git a/Microsoft.Web.Administration/Site.cs b/Microsoft.Web.Administration/Site.cs index 61cef0f4..db39df78 100644 --- a/Microsoft.Web.Administration/Site.cs +++ b/Microsoft.Web.Administration/Site.cs @@ -187,7 +187,7 @@ internal void Save() } public void Apply() - { + { } public bool Match(Site other) diff --git a/Microsoft.Web.Administration/SiteLogFile.cs b/Microsoft.Web.Administration/SiteLogFile.cs index 95b3c1d3..2c4a0442 100644 --- a/Microsoft.Web.Administration/SiteLogFile.cs +++ b/Microsoft.Web.Administration/SiteLogFile.cs @@ -40,13 +40,13 @@ public Guid CustomLogPluginClsid Guid guid; Guid.TryParse(attribute.Value.ToString(), out guid); return guid; - }, + }, this); } set { - _processor.Set("customLogPluginClsid", + _processor.Set("customLogPluginClsid", value, () => _processor.SiteDefault.CustomLogPluginClsid, attribute => attribute.Value = value.ToString(), @@ -60,7 +60,7 @@ public string Directory { return _processor.Get("directory", () => _processor.SiteDefault.Directory, - attribute => (string) attribute.Value, + attribute => (string)attribute.Value, this); } @@ -80,7 +80,7 @@ public bool Enabled { return _processor.Get("enabled", () => _processor.SiteDefault.Enabled, - attribute => (bool) attribute.Value, + attribute => (bool)attribute.Value, this); } diff --git a/Microsoft.Web.Administration/WorkerProcess.cs b/Microsoft.Web.Administration/WorkerProcess.cs index e8ab24b0..c6276440 100644 --- a/Microsoft.Web.Administration/WorkerProcess.cs +++ b/Microsoft.Web.Administration/WorkerProcess.cs @@ -20,17 +20,20 @@ public RequestCollection GetRequests(int timeElapsedFilter) public ApplicationDomainCollection ApplicationDomains { get; private set; } - public string AppPoolName { + public string AppPoolName + { get { return (string)this["appPoolName"]; } set { this["appPoolName"] = value; } } - public string ProcessGuid { + public string ProcessGuid + { get { return (string)this["guid"]; } set { this["guid"] = value; } } - public int ProcessId { + public int ProcessId + { get { return Convert.ToInt32(this["processId"]); } set { this["processId"] = Convert.ToUInt32(value); } } diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/AesEncryptionProvider.cs b/Microsoft.Web.Configuration.AppHostFileProvider/AesEncryptionProvider.cs index c3eb547e..1dcbf168 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/AesEncryptionProvider.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/AesEncryptionProvider.cs @@ -42,7 +42,7 @@ public string Encrypt(string data) return EncodingHelper.Encode(AesEncrypt(data, _keyContainerName, _cspProviderName, EncodingHelper.Decode(_sessionKey), _useOAEP, _userMachineContainer)); } - public unsafe static string AesDecrypt(byte[] encrypted, string keyContainer, string cspProvider, byte[] sessionKey, bool useOAEP, bool useMachineContainer) + public unsafe static string AesDecrypt(byte[] encrypted, string keyContainer, string cspProvider, byte[] sessionKey, bool useOAEP, bool useMachineContainer) { using NativeMethods.SafeCryptProvHandle safeCryptProvHandle = NativeMethods.SafeCryptProvHandle.AcquireMachineContext(keyContainer, cspProvider, 24u, useMachineContainer); nuint hKey = 0; diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/AppHostFileProvider.cs b/Microsoft.Web.Configuration.AppHostFileProvider/AppHostFileProvider.cs index f5582dc3..1f9b167d 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/AppHostFileProvider.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/AppHostFileProvider.cs @@ -90,4 +90,4 @@ public void Terminate() public string TempFilePath { get; set; } public IWebLimits WebLimits { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProvider.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProvider.cs index e765bb03..6c5bd507 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProvider.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProvider.cs @@ -70,4 +70,4 @@ string TempFilePath [DispId(19)] void Terminate(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProviderChangeHandler.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProviderChangeHandler.cs index 2782fd57..54279731 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProviderChangeHandler.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IAppHostProviderChangeHandler.cs @@ -11,4 +11,4 @@ public interface IAppHostProviderChangeHandler { void OnSectionChanges(string sectionName, string configPath); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IApplication.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IApplication.cs index a9d2d0d2..c9b83291 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IApplication.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IApplication.cs @@ -47,4 +47,4 @@ IVirtualDirectory VirtualDirectoryDefaults [DispId(8)] IEnumVirtualDirectory GetVirtualDirectoryEnumerator(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IApplicationPool.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IApplicationPool.cs index 5023827e..95f548ac 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IApplicationPool.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IApplicationPool.cs @@ -92,4 +92,4 @@ uint State [DispId(17)] IEnumEnvironmentVariables GetEnvironmentVariablesEnumerator(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ICpu.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ICpu.cs index 52583dc8..b69a6200 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ICpu.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ICpu.cs @@ -55,4 +55,4 @@ uint NumaNodeAffinityMode get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ICustomField.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ICustomField.cs index 641357f9..23cb3a53 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ICustomField.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ICustomField.cs @@ -25,4 +25,4 @@ uint SourceType get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ICustomFields.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ICustomFields.cs index a5c6cb22..783a60cd 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ICustomFields.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ICustomFields.cs @@ -17,4 +17,4 @@ uint MaxCustomFieldLength [DispId(2)] IEnumCustomFields GetCustomFieldsEnumerator(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplicationPool.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplicationPool.cs index 1bed598d..84e19232 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplicationPool.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplicationPool.cs @@ -12,4 +12,4 @@ public interface IEnumApplicationPool [DispId(1)] IApplicationPool GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplications.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplications.cs index 260b0124..951c2959 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplications.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumApplications.cs @@ -12,4 +12,4 @@ public interface IEnumApplications [DispId(1)] IApplication GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumBindings.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumBindings.cs index a44ca0af..4677f774 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumBindings.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumBindings.cs @@ -12,4 +12,4 @@ public interface IEnumBindings [DispId(1)] ISiteBinding GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumCustomFields.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumCustomFields.cs index 20ffe732..4c8931ee 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumCustomFields.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumCustomFields.cs @@ -12,4 +12,4 @@ public interface IEnumCustomFields [DispId(1)] ICustomField GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumEnvironmentVariables.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumEnvironmentVariables.cs index 9b39c9b2..42f322ec 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumEnvironmentVariables.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumEnvironmentVariables.cs @@ -12,4 +12,4 @@ public interface IEnumEnvironmentVariables [DispId(1)] IEnvironmentVariable GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumListenerAdapter.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumListenerAdapter.cs index c25d97ef..8fe0da36 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumListenerAdapter.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumListenerAdapter.cs @@ -12,4 +12,4 @@ public interface IEnumListenerAdapter [DispId(1)] IListenerAdapter GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumLocation.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumLocation.cs index 5ba41e47..c62cc2a8 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumLocation.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumLocation.cs @@ -12,4 +12,4 @@ public interface IEnumLocation [DispId(1)] ILocation GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSchedule.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSchedule.cs index b0fbbf88..19e5fe5a 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSchedule.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSchedule.cs @@ -12,4 +12,4 @@ public interface IEnumSchedule [DispId(1)] ISchedule GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSite.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSite.cs index f6836dfd..0ff48189 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSite.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumSite.cs @@ -12,4 +12,4 @@ public interface IEnumSite [DispId(1)] IAppHostSite GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumVirtualDirectory.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumVirtualDirectory.cs index e3019121..87c129f1 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnumVirtualDirectory.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnumVirtualDirectory.cs @@ -12,4 +12,4 @@ public interface IEnumVirtualDirectory [DispId(1)] IVirtualDirectory GetNext(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IEnvironmentVariable.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IEnvironmentVariable.cs index c77f72a9..883f68aa 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IEnvironmentVariable.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IEnvironmentVariable.cs @@ -20,4 +20,4 @@ string Value get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IFailure.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IFailure.cs index 824c7991..5a529c22 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IFailure.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IFailure.cs @@ -55,4 +55,4 @@ string AutoShutdownParameters get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IListenerAdapter.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IListenerAdapter.cs index 9f8be12f..14f38138 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IListenerAdapter.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IListenerAdapter.cs @@ -30,4 +30,4 @@ string ProtocolManagerDllInitFunction get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ILocation.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ILocation.cs index e6bc7359..f48fe405 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ILocation.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ILocation.cs @@ -15,4 +15,4 @@ string Path get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ILogSettings.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ILogSettings.cs index 81e66466..960a23d3 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ILogSettings.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ILogSettings.cs @@ -75,4 +75,4 @@ uint W3CLogExtFileFlags get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IPeriodicRestart.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IPeriodicRestart.cs index e4181ba5..326bb358 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IPeriodicRestart.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IPeriodicRestart.cs @@ -32,4 +32,4 @@ long Time [DispId(5)] IEnumSchedule GetScheduleEnumerator(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IProcessModel.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IProcessModel.cs index 6f037ba1..4197c02c 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IProcessModel.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IProcessModel.cs @@ -90,4 +90,4 @@ uint IdleTimeoutAction get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IRecycling.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IRecycling.cs index 7a3a5f3c..81259e8e 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IRecycling.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IRecycling.cs @@ -30,4 +30,4 @@ IPeriodicRestart PeriodicRestart get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ISchedule.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ISchedule.cs index aaef34fc..ffc3eb94 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ISchedule.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ISchedule.cs @@ -15,4 +15,4 @@ long Item get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteBinding.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteBinding.cs index 5813f9d7..89aa6dbb 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteBinding.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteBinding.cs @@ -25,4 +25,4 @@ uint SslFlags get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLimits.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLimits.cs index c228f670..b61eebb4 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLimits.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLimits.cs @@ -30,4 +30,4 @@ uint MaxUrlSegments get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLogFile.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLogFile.cs index fd507f27..aa39f971 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLogFile.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteLogFile.cs @@ -75,4 +75,4 @@ ICustomFields CustomFields get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteTraceRequestsLogging.cs b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteTraceRequestsLogging.cs index cef898fc..79167a17 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/ISiteTraceRequestsLogging.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/ISiteTraceRequestsLogging.cs @@ -35,4 +35,4 @@ bool CustomActionsEnabled get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IVirtualDirectory.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IVirtualDirectory.cs index 7aaa030b..7d5675cd 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IVirtualDirectory.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IVirtualDirectory.cs @@ -40,4 +40,4 @@ bool AllowSubdirectoryConfig get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/IWebLimits.cs b/Microsoft.Web.Configuration.AppHostFileProvider/IWebLimits.cs index 72e3c73b..dbf0a95b 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/IWebLimits.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/IWebLimits.cs @@ -45,4 +45,4 @@ uint DynamicRegistrationThreshold get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Configuration.AppHostFileProvider/NativeMethods.cs b/Microsoft.Web.Configuration.AppHostFileProvider/NativeMethods.cs index d6bd8ae5..80826995 100644 --- a/Microsoft.Web.Configuration.AppHostFileProvider/NativeMethods.cs +++ b/Microsoft.Web.Configuration.AppHostFileProvider/NativeMethods.cs @@ -31,7 +31,7 @@ internal unsafe static SafeCryptProvHandle AcquireMachineContext(string keyConta { uint dwFlags = useMachineContainer ? (uint)CRYPT_KEY_FLAGS.CRYPT_MACHINE_KEYSET : 0u; SafeCryptProvHandle hCryptProv; - + unsafe { nuint phProv; @@ -41,9 +41,9 @@ internal unsafe static SafeCryptProvHandle AcquireMachineContext(string keyConta providerName, providerType, dwFlags); - + hCryptProv = new SafeCryptProvHandle(phProv); - + if (!success) { int lastWin32Error = Marshal.GetLastWin32Error(); @@ -53,7 +53,7 @@ internal unsafe static SafeCryptProvHandle AcquireMachineContext(string keyConta } } } - + return hCryptProv; } diff --git a/Microsoft.Web.Management/Client/Connection.cs b/Microsoft.Web.Management/Client/Connection.cs index 06bf78d8..10474cdb 100644 --- a/Microsoft.Web.Management/Client/Connection.cs +++ b/Microsoft.Web.Management/Client/Connection.cs @@ -101,4 +101,4 @@ void IDisposable.Dispose() public event EventHandler Initialized; } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionActiveState.cs b/Microsoft.Web.Management/Client/ConnectionActiveState.cs index 456227d4..c9ff986a 100644 --- a/Microsoft.Web.Management/Client/ConnectionActiveState.cs +++ b/Microsoft.Web.Management/Client/ConnectionActiveState.cs @@ -10,4 +10,4 @@ public sealed class ConnectionActiveState public bool DifferentCredentials { get; } public ConnectionInfo SimilarConnection { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionCredential.cs b/Microsoft.Web.Management/Client/ConnectionCredential.cs index c07ce209..e74310ce 100644 --- a/Microsoft.Web.Management/Client/ConnectionCredential.cs +++ b/Microsoft.Web.Management/Client/ConnectionCredential.cs @@ -37,4 +37,4 @@ public override int GetHashCode() public string UserName { get; } public bool UseSystemAccount { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionEventArgs.cs b/Microsoft.Web.Management/Client/ConnectionEventArgs.cs index b56c2d5a..91e96e5a 100644 --- a/Microsoft.Web.Management/Client/ConnectionEventArgs.cs +++ b/Microsoft.Web.Management/Client/ConnectionEventArgs.cs @@ -11,4 +11,4 @@ public sealed class ConnectionEventArgs : EventArgs public Connection Connection { get; } public bool IsNewConnection { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionEventHandler.cs b/Microsoft.Web.Management/Client/ConnectionEventHandler.cs index 7a4796ea..09ac2835 100644 --- a/Microsoft.Web.Management/Client/ConnectionEventHandler.cs +++ b/Microsoft.Web.Management/Client/ConnectionEventHandler.cs @@ -10,4 +10,4 @@ public delegate void ConnectionEventHandler( Object sender, ConnectionEventArgs e ); -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionInfo.cs b/Microsoft.Web.Management/Client/ConnectionInfo.cs index 12b4eeeb..760316d1 100644 --- a/Microsoft.Web.Management/Client/ConnectionInfo.cs +++ b/Microsoft.Web.Management/Client/ConnectionInfo.cs @@ -31,4 +31,4 @@ public override int GetHashCode() public event EventHandler RenamedEventHandler; } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ConnectionInfoCollection.cs b/Microsoft.Web.Management/Client/ConnectionInfoCollection.cs index 686bbae3..682b6857 100644 --- a/Microsoft.Web.Management/Client/ConnectionInfoCollection.cs +++ b/Microsoft.Web.Management/Client/ConnectionInfoCollection.cs @@ -19,4 +19,4 @@ string name ] { get { throw new NotImplementedException(); } } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ControlPanelCategorization.cs b/Microsoft.Web.Management/Client/ControlPanelCategorization.cs index 5a7000cc..3ae6c7d9 100644 --- a/Microsoft.Web.Management/Client/ControlPanelCategorization.cs +++ b/Microsoft.Web.Management/Client/ControlPanelCategorization.cs @@ -35,4 +35,4 @@ public override int GetHashCode() public string DisplayName { get; } public string Key { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ControlPanelCategoryInfo.cs b/Microsoft.Web.Management/Client/ControlPanelCategoryInfo.cs index 0c011c20..2f786349 100644 --- a/Microsoft.Web.Management/Client/ControlPanelCategoryInfo.cs +++ b/Microsoft.Web.Management/Client/ControlPanelCategoryInfo.cs @@ -39,4 +39,4 @@ public override string ToString() public string Name { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/CredentialInfo.cs b/Microsoft.Web.Management/Client/CredentialInfo.cs index d7ca79a2..7e4f467e 100644 --- a/Microsoft.Web.Management/Client/CredentialInfo.cs +++ b/Microsoft.Web.Management/Client/CredentialInfo.cs @@ -14,4 +14,4 @@ public override string ToString() public string Password { get; set; } public string UserName { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/CredentialInfoEventArgs.cs b/Microsoft.Web.Management/Client/CredentialInfoEventArgs.cs index 0047370e..8510c083 100644 --- a/Microsoft.Web.Management/Client/CredentialInfoEventArgs.cs +++ b/Microsoft.Web.Management/Client/CredentialInfoEventArgs.cs @@ -17,4 +17,4 @@ CredentialInfo credentials public CredentialInfo Credentials { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/AuthenticationSettingsSavedEventHandler.cs b/Microsoft.Web.Management/Client/Extensions/AuthenticationSettingsSavedEventHandler.cs index db1b43db..83f04e84 100644 --- a/Microsoft.Web.Management/Client/Extensions/AuthenticationSettingsSavedEventHandler.cs +++ b/Microsoft.Web.Management/Client/Extensions/AuthenticationSettingsSavedEventHandler.cs @@ -5,4 +5,4 @@ namespace Microsoft.Web.Management.Client.Extensions { public delegate void AuthenticationSettingsSavedEventHandler(); -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/AuthenticationType.cs b/Microsoft.Web.Management/Client/Extensions/AuthenticationType.cs index 93984dd5..84d67f9c 100644 --- a/Microsoft.Web.Management/Client/Extensions/AuthenticationType.cs +++ b/Microsoft.Web.Management/Client/Extensions/AuthenticationType.cs @@ -11,4 +11,4 @@ public enum AuthenticationType ClientCertificateBased = 2, Other = 3 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/HomepageExtension.cs b/Microsoft.Web.Management/Client/Extensions/HomepageExtension.cs index 40545b73..32e358ba 100644 --- a/Microsoft.Web.Management/Client/Extensions/HomepageExtension.cs +++ b/Microsoft.Web.Management/Client/Extensions/HomepageExtension.cs @@ -20,4 +20,4 @@ TaskList IHomepageTaskListProvider.GetTaskList(IServiceProvider serviceProvider, throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/IHomepageTaskListProvider.cs b/Microsoft.Web.Management/Client/Extensions/IHomepageTaskListProvider.cs index 54a97a32..d275e0cd 100644 --- a/Microsoft.Web.Management/Client/Extensions/IHomepageTaskListProvider.cs +++ b/Microsoft.Web.Management/Client/Extensions/IHomepageTaskListProvider.cs @@ -13,4 +13,4 @@ TaskList GetTaskList( ModulePageInfo selectedModulePage ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/ProtocolProvider.cs b/Microsoft.Web.Management/Client/Extensions/ProtocolProvider.cs index f5219a36..b8365ecb 100644 --- a/Microsoft.Web.Management/Client/Extensions/ProtocolProvider.cs +++ b/Microsoft.Web.Management/Client/Extensions/ProtocolProvider.cs @@ -41,4 +41,4 @@ public delegate void SiteUpdatedEventHandler( SiteUpdatedEventArgs e ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/ProviderFeature.cs b/Microsoft.Web.Management/Client/Extensions/ProviderFeature.cs index 90299141..3b955dd7 100644 --- a/Microsoft.Web.Management/Client/Extensions/ProviderFeature.cs +++ b/Microsoft.Web.Management/Client/Extensions/ProviderFeature.cs @@ -17,4 +17,4 @@ public abstract class ProviderFeature public abstract string SelectedProviderPropertyName { get; } public abstract ProviderConfigurationSettings Settings { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/SiteAction.cs b/Microsoft.Web.Management/Client/Extensions/SiteAction.cs index 71cb7ef4..30842153 100644 --- a/Microsoft.Web.Management/Client/Extensions/SiteAction.cs +++ b/Microsoft.Web.Management/Client/Extensions/SiteAction.cs @@ -9,4 +9,4 @@ public enum SiteAction Create = 0, Edit = 1 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Extensions/SiteUpdatedEventArgs.cs b/Microsoft.Web.Management/Client/Extensions/SiteUpdatedEventArgs.cs index d804836d..83f0b753 100644 --- a/Microsoft.Web.Management/Client/Extensions/SiteUpdatedEventArgs.cs +++ b/Microsoft.Web.Management/Client/Extensions/SiteUpdatedEventArgs.cs @@ -11,4 +11,4 @@ public sealed class SiteUpdatedEventArgs : EventArgs public SiteAction Action { get; } public string SiteName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/GroupTaskItem.cs b/Microsoft.Web.Management/Client/GroupTaskItem.cs index dca99626..78a324e7 100644 --- a/Microsoft.Web.Management/Client/GroupTaskItem.cs +++ b/Microsoft.Web.Management/Client/GroupTaskItem.cs @@ -24,4 +24,4 @@ public GroupTaskItem(string memberName, string text, string category, bool isHea public IList Items { get; } public string MemberName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyCollectionEventArgs.cs b/Microsoft.Web.Management/Client/HierarchyCollectionEventArgs.cs index ae971161..2d233cbe 100644 --- a/Microsoft.Web.Management/Client/HierarchyCollectionEventArgs.cs +++ b/Microsoft.Web.Management/Client/HierarchyCollectionEventArgs.cs @@ -21,4 +21,4 @@ IEnumerable childrenAdded public IEnumerable ChildrenAdded { get; } public HierarchyInfo HierarchyInfo { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyCollectionEventHandler.cs b/Microsoft.Web.Management/Client/HierarchyCollectionEventHandler.cs index 0142cfeb..f047a6ca 100644 --- a/Microsoft.Web.Management/Client/HierarchyCollectionEventHandler.cs +++ b/Microsoft.Web.Management/Client/HierarchyCollectionEventHandler.cs @@ -10,4 +10,4 @@ public delegate void HierarchyCollectionEventHandler( Object sender, HierarchyCollectionEventArgs e ); -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyInfo.cs b/Microsoft.Web.Management/Client/HierarchyInfo.cs index e36c0c00..50a58179 100644 --- a/Microsoft.Web.Management/Client/HierarchyInfo.cs +++ b/Microsoft.Web.Management/Client/HierarchyInfo.cs @@ -119,4 +119,4 @@ object IServiceProvider.GetService(Type serviceType) public virtual string ToolTip { get; } public virtual HierarchyVisibility Visibility { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyInfoEventArgs.cs b/Microsoft.Web.Management/Client/HierarchyInfoEventArgs.cs index 774d8fd9..3114b1cc 100644 --- a/Microsoft.Web.Management/Client/HierarchyInfoEventArgs.cs +++ b/Microsoft.Web.Management/Client/HierarchyInfoEventArgs.cs @@ -15,4 +15,4 @@ public HierarchyInfoEventArgs(HierarchyInfo hierarchyInfo) public HierarchyInfo HierarchyInfo { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyInfoEventHandler.cs b/Microsoft.Web.Management/Client/HierarchyInfoEventHandler.cs index 610a116b..ee7d4eeb 100644 --- a/Microsoft.Web.Management/Client/HierarchyInfoEventHandler.cs +++ b/Microsoft.Web.Management/Client/HierarchyInfoEventHandler.cs @@ -5,4 +5,4 @@ namespace Microsoft.Web.Management.Client { public delegate void HierarchyInfoEventHandler(object sender, HierarchyInfoEventArgs e); -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyInfoSyncSelectionEventArgs.cs b/Microsoft.Web.Management/Client/HierarchyInfoSyncSelectionEventArgs.cs index 57defb10..bd1864ff 100644 --- a/Microsoft.Web.Management/Client/HierarchyInfoSyncSelectionEventArgs.cs +++ b/Microsoft.Web.Management/Client/HierarchyInfoSyncSelectionEventArgs.cs @@ -21,4 +21,4 @@ public HierarchyInfoSyncSelectionEventArgs(Connection connection, HierarchyInfo public Type PageType { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyPriority.cs b/Microsoft.Web.Management/Client/HierarchyPriority.cs index 0de1f04f..96565b66 100644 --- a/Microsoft.Web.Management/Client/HierarchyPriority.cs +++ b/Microsoft.Web.Management/Client/HierarchyPriority.cs @@ -12,4 +12,4 @@ public enum HierarchyPriority Higher = 3, Higest = 4 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyProvider.cs b/Microsoft.Web.Management/Client/HierarchyProvider.cs index 91409a53..547671ab 100644 --- a/Microsoft.Web.Management/Client/HierarchyProvider.cs +++ b/Microsoft.Web.Management/Client/HierarchyProvider.cs @@ -35,4 +35,4 @@ object IServiceProvider.GetService(Type serviceType) return GetService(serviceType); } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyRenameEventArgs.cs b/Microsoft.Web.Management/Client/HierarchyRenameEventArgs.cs index 4ef2b2b4..c66e6683 100644 --- a/Microsoft.Web.Management/Client/HierarchyRenameEventArgs.cs +++ b/Microsoft.Web.Management/Client/HierarchyRenameEventArgs.cs @@ -16,4 +16,4 @@ public HierarchyRenameEventArgs(string label) public bool Cancel { get; set; } public string Label { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyService.cs b/Microsoft.Web.Management/Client/HierarchyService.cs index e59669dc..9c719203 100644 --- a/Microsoft.Web.Management/Client/HierarchyService.cs +++ b/Microsoft.Web.Management/Client/HierarchyService.cs @@ -39,4 +39,4 @@ public abstract class HierarchyService public abstract event HierarchyInfoEventHandler InfoUpdated; public abstract event EventHandler SelectedInfoChanged; } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/HierarchyVisibility.cs b/Microsoft.Web.Management/Client/HierarchyVisibility.cs index d06facc1..e3937f2a 100644 --- a/Microsoft.Web.Management/Client/HierarchyVisibility.cs +++ b/Microsoft.Web.Management/Client/HierarchyVisibility.cs @@ -10,4 +10,4 @@ public enum HierarchyVisibility Hierarchy = 1, List = 2 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ICertificateVerificationBuilder.cs b/Microsoft.Web.Management/Client/ICertificateVerificationBuilder.cs index 21e0c6e8..b307ff98 100644 --- a/Microsoft.Web.Management/Client/ICertificateVerificationBuilder.cs +++ b/Microsoft.Web.Management/Client/ICertificateVerificationBuilder.cs @@ -17,4 +17,4 @@ bool VerifyCertificate( SslPolicyErrors sslPolicyErrors ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IConnectionBuilder.cs b/Microsoft.Web.Management/Client/IConnectionBuilder.cs index 0d4f2588..a8257479 100644 --- a/Microsoft.Web.Management/Client/IConnectionBuilder.cs +++ b/Microsoft.Web.Management/Client/IConnectionBuilder.cs @@ -25,4 +25,4 @@ ConnectionInfo BuildFavorite( ManagementScope scope ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IConnectionManager.cs b/Microsoft.Web.Management/Client/IConnectionManager.cs index 8f011123..201f2f1b 100644 --- a/Microsoft.Web.Management/Client/IConnectionManager.cs +++ b/Microsoft.Web.Management/Client/IConnectionManager.cs @@ -43,4 +43,4 @@ Connection connection event ConnectionEventHandler ConnectionRefreshing; event EventHandler IsDirtyChanged; } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IControlPanel.cs b/Microsoft.Web.Management/Client/IControlPanel.cs index bf6e8810..7b14b34d 100644 --- a/Microsoft.Web.Management/Client/IControlPanel.cs +++ b/Microsoft.Web.Management/Client/IControlPanel.cs @@ -31,4 +31,4 @@ public interface IControlPanel ModulePageInfo ControlPanelPage { get; } ReadOnlyCollection Pages { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ICredentialBuilder.cs b/Microsoft.Web.Management/Client/ICredentialBuilder.cs index 1bcf4eda..6e75d852 100644 --- a/Microsoft.Web.Management/Client/ICredentialBuilder.cs +++ b/Microsoft.Web.Management/Client/ICredentialBuilder.cs @@ -73,4 +73,4 @@ CredentialInfo SpecifyCredentials( bool readOnly ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IExtensibilityManager.cs b/Microsoft.Web.Management/Client/IExtensibilityManager.cs index 654dde90..984e8629 100644 --- a/Microsoft.Web.Management/Client/IExtensibilityManager.cs +++ b/Microsoft.Web.Management/Client/IExtensibilityManager.cs @@ -18,4 +18,4 @@ void RegisterExtension( Object extension ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IModuleChildPage.cs b/Microsoft.Web.Management/Client/IModuleChildPage.cs index 7ed55a6a..441f6708 100644 --- a/Microsoft.Web.Management/Client/IModuleChildPage.cs +++ b/Microsoft.Web.Management/Client/IModuleChildPage.cs @@ -8,4 +8,4 @@ public interface IModuleChildPage { IModulePage ParentPage { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IModulePage.cs b/Microsoft.Web.Management/Client/IModulePage.cs index 1c527fb1..b5844fd8 100644 --- a/Microsoft.Web.Management/Client/IModulePage.cs +++ b/Microsoft.Web.Management/Client/IModulePage.cs @@ -24,4 +24,4 @@ public interface IModulePage : IDisposable ModulePageInfo PageInfo { get; } TaskListCollection Tasks { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/INavigationService.cs b/Microsoft.Web.Management/Client/INavigationService.cs index dc9f5a1b..2e34ff6d 100644 --- a/Microsoft.Web.Management/Client/INavigationService.cs +++ b/Microsoft.Web.Management/Client/INavigationService.cs @@ -27,4 +27,4 @@ public interface INavigationService event NavigationEventHandler NavigationPerformed; } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IPreferencesService.cs b/Microsoft.Web.Management/Client/IPreferencesService.cs index 5c868d60..4aae6133 100644 --- a/Microsoft.Web.Management/Client/IPreferencesService.cs +++ b/Microsoft.Web.Management/Client/IPreferencesService.cs @@ -23,4 +23,4 @@ Guid storeIdentifier void Save(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IPropertyEditingService.cs b/Microsoft.Web.Management/Client/IPropertyEditingService.cs index 3fb9d2c1..3cab49a4 100644 --- a/Microsoft.Web.Management/Client/IPropertyEditingService.cs +++ b/Microsoft.Web.Management/Client/IPropertyEditingService.cs @@ -25,4 +25,4 @@ bool EditProperties( EventHandler showHelp ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IPropertyEditingUser.cs b/Microsoft.Web.Management/Client/IPropertyEditingUser.cs index 4f6c8d71..a2203207 100644 --- a/Microsoft.Web.Management/Client/IPropertyEditingUser.cs +++ b/Microsoft.Web.Management/Client/IPropertyEditingUser.cs @@ -16,4 +16,4 @@ void ValidateObjects( Object targetObject ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/IProviderConfigurationService.cs b/Microsoft.Web.Management/Client/IProviderConfigurationService.cs index be0925ac..d30602ea 100644 --- a/Microsoft.Web.Management/Client/IProviderConfigurationService.cs +++ b/Microsoft.Web.Management/Client/IProviderConfigurationService.cs @@ -12,4 +12,4 @@ bool ConfigureProvider( ProviderFeature feature ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ManagementChannel.cs b/Microsoft.Web.Management/Client/ManagementChannel.cs index bb5254cc..9acb6dbd 100644 --- a/Microsoft.Web.Management/Client/ManagementChannel.cs +++ b/Microsoft.Web.Management/Client/ManagementChannel.cs @@ -37,4 +37,4 @@ string locationSubPath protected Connection Connection { get; } protected ConnectionInfo ConnectionInfo { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ManagementScopePath.cs b/Microsoft.Web.Management/Client/ManagementScopePath.cs index ec7500a7..d3da8439 100644 --- a/Microsoft.Web.Management/Client/ManagementScopePath.cs +++ b/Microsoft.Web.Management/Client/ManagementScopePath.cs @@ -62,4 +62,4 @@ public void SetFrameworkVersion(ManagementFrameworkVersion frameworkVersion) public string ServerReference { get; } public string SiteName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/MessageTaskItem.cs b/Microsoft.Web.Management/Client/MessageTaskItem.cs index c6c2e7f7..9a29da31 100644 --- a/Microsoft.Web.Management/Client/MessageTaskItem.cs +++ b/Microsoft.Web.Management/Client/MessageTaskItem.cs @@ -41,4 +41,4 @@ Object userData public string MethodName { get; } public Object UserData { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/MessageTaskItemType.cs b/Microsoft.Web.Management/Client/MessageTaskItemType.cs index dd9b542b..02169530 100644 --- a/Microsoft.Web.Management/Client/MessageTaskItemType.cs +++ b/Microsoft.Web.Management/Client/MessageTaskItemType.cs @@ -10,4 +10,4 @@ public enum MessageTaskItemType Warning = 1, Error = 2 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/MethodTaskItemUsages.cs b/Microsoft.Web.Management/Client/MethodTaskItemUsages.cs index f1901189..836b147f 100644 --- a/Microsoft.Web.Management/Client/MethodTaskItemUsages.cs +++ b/Microsoft.Web.Management/Client/MethodTaskItemUsages.cs @@ -12,4 +12,4 @@ public enum MethodTaskItemUsages TaskList = 1, ContextMenu = 2 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleHomepageAttribute.cs b/Microsoft.Web.Management/Client/ModuleHomepageAttribute.cs index 2e400f63..a87dfd16 100644 --- a/Microsoft.Web.Management/Client/ModuleHomepageAttribute.cs +++ b/Microsoft.Web.Management/Client/ModuleHomepageAttribute.cs @@ -15,4 +15,4 @@ IModulePage modulePage return false; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleListPageGrouping.cs b/Microsoft.Web.Management/Client/ModuleListPageGrouping.cs index 0d24a843..b1231c67 100644 --- a/Microsoft.Web.Management/Client/ModuleListPageGrouping.cs +++ b/Microsoft.Web.Management/Client/ModuleListPageGrouping.cs @@ -44,4 +44,4 @@ public override string ToString() public string Name { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleListPageSearchField.cs b/Microsoft.Web.Management/Client/ModuleListPageSearchField.cs index 31ee59cd..980b4018 100644 --- a/Microsoft.Web.Management/Client/ModuleListPageSearchField.cs +++ b/Microsoft.Web.Management/Client/ModuleListPageSearchField.cs @@ -23,4 +23,4 @@ public override string ToString() public string Name { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleListPageSearchOptions.cs b/Microsoft.Web.Management/Client/ModuleListPageSearchOptions.cs index d766fea3..7903d6c2 100644 --- a/Microsoft.Web.Management/Client/ModuleListPageSearchOptions.cs +++ b/Microsoft.Web.Management/Client/ModuleListPageSearchOptions.cs @@ -28,4 +28,4 @@ ModuleListPageSearchField field public bool ShowAll { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleListPageViewModes.cs b/Microsoft.Web.Management/Client/ModuleListPageViewModes.cs index 9e581786..b6dc838c 100644 --- a/Microsoft.Web.Management/Client/ModuleListPageViewModes.cs +++ b/Microsoft.Web.Management/Client/ModuleListPageViewModes.cs @@ -14,4 +14,4 @@ public enum ModuleListPageViewModes Tiles = 4, List = 8 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModulePageIdentifierAttribute.cs b/Microsoft.Web.Management/Client/ModulePageIdentifierAttribute.cs index fe6317e3..473378a8 100644 --- a/Microsoft.Web.Management/Client/ModulePageIdentifierAttribute.cs +++ b/Microsoft.Web.Management/Client/ModulePageIdentifierAttribute.cs @@ -17,4 +17,4 @@ string guid public Guid Guid { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModulePageInfo.cs b/Microsoft.Web.Management/Client/ModulePageInfo.cs index 863d0795..02cf5c9a 100644 --- a/Microsoft.Web.Management/Client/ModulePageInfo.cs +++ b/Microsoft.Web.Management/Client/ModulePageInfo.cs @@ -59,4 +59,4 @@ public bool IsEnabled public object SmallImage { get; } public string Title { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ModuleServiceProxy.cs b/Microsoft.Web.Management/Client/ModuleServiceProxy.cs index 6dbb2720..7e526360 100644 --- a/Microsoft.Web.Management/Client/ModuleServiceProxy.cs +++ b/Microsoft.Web.Management/Client/ModuleServiceProxy.cs @@ -29,4 +29,4 @@ params Object[] parameters return null; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/NavigationEventArgs.cs b/Microsoft.Web.Management/Client/NavigationEventArgs.cs index 68c4f13d..97609c3a 100644 --- a/Microsoft.Web.Management/Client/NavigationEventArgs.cs +++ b/Microsoft.Web.Management/Client/NavigationEventArgs.cs @@ -23,4 +23,4 @@ bool isNew public NavigationItem NewItem { get; } public NavigationItem OldItem { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/NavigationEventHandler.cs b/Microsoft.Web.Management/Client/NavigationEventHandler.cs index 2fd4ed4e..0ab92fc0 100644 --- a/Microsoft.Web.Management/Client/NavigationEventHandler.cs +++ b/Microsoft.Web.Management/Client/NavigationEventHandler.cs @@ -10,4 +10,4 @@ public delegate void NavigationEventHandler( Object sender, NavigationEventArgs e ); -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/NavigationItem.cs b/Microsoft.Web.Management/Client/NavigationItem.cs index a48c4031..cb335125 100644 --- a/Microsoft.Web.Management/Client/NavigationItem.cs +++ b/Microsoft.Web.Management/Client/NavigationItem.cs @@ -45,4 +45,4 @@ void IDisposable.Dispose() Page = null; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/PreferencesStore.cs b/Microsoft.Web.Management/Client/PreferencesStore.cs index ce4741e9..4fe1a1f4 100644 --- a/Microsoft.Web.Management/Client/PreferencesStore.cs +++ b/Microsoft.Web.Management/Client/PreferencesStore.cs @@ -66,4 +66,4 @@ string defaultValue public bool IsEmpty { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/PropertyGridObject.cs b/Microsoft.Web.Management/Client/PropertyGridObject.cs index 086c094e..ae0ebf32 100644 --- a/Microsoft.Web.Management/Client/PropertyGridObject.cs +++ b/Microsoft.Web.Management/Client/PropertyGridObject.cs @@ -103,4 +103,4 @@ object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd) protected bool ReadOnly { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/ProviderConfigurationSettings.cs b/Microsoft.Web.Management/Client/ProviderConfigurationSettings.cs index 2679207e..f09083ab 100644 --- a/Microsoft.Web.Management/Client/ProviderConfigurationSettings.cs +++ b/Microsoft.Web.Management/Client/ProviderConfigurationSettings.cs @@ -26,4 +26,4 @@ out string message protected abstract IDictionary Settings { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/TaskItem.cs b/Microsoft.Web.Management/Client/TaskItem.cs index 9eca9b9a..9f151918 100644 --- a/Microsoft.Web.Management/Client/TaskItem.cs +++ b/Microsoft.Web.Management/Client/TaskItem.cs @@ -25,4 +25,4 @@ protected TaskItem(string text, string category, string description) public IDictionary Properties { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/TaskList.cs b/Microsoft.Web.Management/Client/TaskList.cs index 20cf40dd..21f5fbab 100644 --- a/Microsoft.Web.Management/Client/TaskList.cs +++ b/Microsoft.Web.Management/Client/TaskList.cs @@ -29,4 +29,4 @@ public virtual void SetPropertyValue(string propertyName, object value) [Obsolete] public virtual bool IsDirty { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/TaskListCollection.cs b/Microsoft.Web.Management/Client/TaskListCollection.cs index cabd1074..b7ae0018 100644 --- a/Microsoft.Web.Management/Client/TaskListCollection.cs +++ b/Microsoft.Web.Management/Client/TaskListCollection.cs @@ -74,4 +74,4 @@ public TaskList this[int index] set { _inner[index] = value; } } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/BaseTaskForm.cs b/Microsoft.Web.Management/Client/Win32/BaseTaskForm.cs index 535a21b2..c6abcd18 100644 --- a/Microsoft.Web.Management/Client/Win32/BaseTaskForm.cs +++ b/Microsoft.Web.Management/Client/Win32/BaseTaskForm.cs @@ -85,4 +85,4 @@ protected virtual int BorderMargin get { return 0; } } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/DialogForm.cs b/Microsoft.Web.Management/Client/Win32/DialogForm.cs index 8f56254c..d54d0be1 100644 --- a/Microsoft.Web.Management/Client/Win32/DialogForm.cs +++ b/Microsoft.Web.Management/Client/Win32/DialogForm.cs @@ -38,4 +38,4 @@ protected DialogForm(IServiceProvider serviceProvider) MinimizeBox = false; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/IManagementUIService.cs b/Microsoft.Web.Management/Client/Win32/IManagementUIService.cs index 1956d7b9..68cee8f6 100644 --- a/Microsoft.Web.Management/Client/Win32/IManagementUIService.cs +++ b/Microsoft.Web.Management/Client/Win32/IManagementUIService.cs @@ -34,4 +34,4 @@ public interface IManagementUIService bool RightToLeftLayout { get; } IDictionary Styles { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/ManagementUIColorTable.cs b/Microsoft.Web.Management/Client/Win32/ManagementUIColorTable.cs index b16e9a0b..f5f3d1cc 100644 --- a/Microsoft.Web.Management/Client/Win32/ManagementUIColorTable.cs +++ b/Microsoft.Web.Management/Client/Win32/ManagementUIColorTable.cs @@ -38,4 +38,4 @@ public abstract class ManagementUIColorTable public abstract Color TaskPanelDisabled { get; } public abstract Color TaskSectionHeader { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/ModulePropertiesPage.cs b/Microsoft.Web.Management/Client/Win32/ModulePropertiesPage.cs index cec21a89..7998a7f3 100644 --- a/Microsoft.Web.Management/Client/Win32/ModulePropertiesPage.cs +++ b/Microsoft.Web.Management/Client/Win32/ModulePropertiesPage.cs @@ -84,4 +84,4 @@ private void InitializeComponent() this.ResumeLayout(false); } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/SortableListView.cs b/Microsoft.Web.Management/Client/Win32/SortableListView.cs index 4942b434..f4a1d02a 100644 --- a/Microsoft.Web.Management/Client/Win32/SortableListView.cs +++ b/Microsoft.Web.Management/Client/Win32/SortableListView.cs @@ -57,4 +57,4 @@ SortOrder sortOrder public ColumnHeader SortColumn { get; } public SortOrder SortOrder { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/TaskForm.cs b/Microsoft.Web.Management/Client/Win32/TaskForm.cs index 7143537d..e6cec399 100644 --- a/Microsoft.Web.Management/Client/Win32/TaskForm.cs +++ b/Microsoft.Web.Management/Client/Win32/TaskForm.cs @@ -63,4 +63,4 @@ protected virtual bool IsCancellable get { return false; } } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/TextTaskItem.cs b/Microsoft.Web.Management/Client/Win32/TextTaskItem.cs index 6f4d1901..e4ebc3a9 100644 --- a/Microsoft.Web.Management/Client/Win32/TextTaskItem.cs +++ b/Microsoft.Web.Management/Client/Win32/TextTaskItem.cs @@ -26,4 +26,4 @@ public TextTaskItem(string text, string category, bool isHeading, Image image) public Image Image { get; } public bool IsHeading { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Client/Win32/WaitCursor.cs b/Microsoft.Web.Management/Client/Win32/WaitCursor.cs index 8a9edcfe..54373389 100644 --- a/Microsoft.Web.Management/Client/Win32/WaitCursor.cs +++ b/Microsoft.Web.Management/Client/Win32/WaitCursor.cs @@ -11,4 +11,4 @@ public sealed class WaitCursor : IDisposable public void Dispose() { } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Host/IManagementHost.cs b/Microsoft.Web.Management/Host/IManagementHost.cs index 756288cd..a772c7e4 100644 --- a/Microsoft.Web.Management/Host/IManagementHost.cs +++ b/Microsoft.Web.Management/Host/IManagementHost.cs @@ -26,4 +26,4 @@ Type builderType Type UserInterfaceTechnologyType { get; } Version Version { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Host/Shell/ShellComponents.cs b/Microsoft.Web.Management/Host/Shell/ShellComponents.cs index caea7d95..507a301b 100644 --- a/Microsoft.Web.Management/Host/Shell/ShellComponents.cs +++ b/Microsoft.Web.Management/Host/Shell/ShellComponents.cs @@ -10,4 +10,4 @@ public sealed class ShellComponents { public TaskList HelpMenu { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/AdministrationModule.cs b/Microsoft.Web.Management/Server/AdministrationModule.cs index 5b02c86f..6690c45e 100644 --- a/Microsoft.Web.Management/Server/AdministrationModule.cs +++ b/Microsoft.Web.Management/Server/AdministrationModule.cs @@ -13,4 +13,4 @@ public AdministrationModule(string name) public string Name { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/AdministrationModuleCollection.cs b/Microsoft.Web.Management/Server/AdministrationModuleCollection.cs index 693a2f87..ed935509 100644 --- a/Microsoft.Web.Management/Server/AdministrationModuleCollection.cs +++ b/Microsoft.Web.Management/Server/AdministrationModuleCollection.cs @@ -37,4 +37,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/AdministrationModuleProvider.cs b/Microsoft.Web.Management/Server/AdministrationModuleProvider.cs index b434a623..1490210f 100644 --- a/Microsoft.Web.Management/Server/AdministrationModuleProvider.cs +++ b/Microsoft.Web.Management/Server/AdministrationModuleProvider.cs @@ -9,4 +9,4 @@ public sealed class AdministrationModuleProvider public string Name { get; } public string Type { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ApplicationManagementUnit.cs b/Microsoft.Web.Management/Server/ApplicationManagementUnit.cs index 3dc34ef7..5ecbfddc 100644 --- a/Microsoft.Web.Management/Server/ApplicationManagementUnit.cs +++ b/Microsoft.Web.Management/Server/ApplicationManagementUnit.cs @@ -24,4 +24,4 @@ Type generatorType public override ManagementScope Scope { get; } public string SiteName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/BindingInfo.cs b/Microsoft.Web.Management/Server/BindingInfo.cs index c04c1552..22fb15f5 100644 --- a/Microsoft.Web.Management/Server/BindingInfo.cs +++ b/Microsoft.Web.Management/Server/BindingInfo.cs @@ -27,4 +27,4 @@ public override string ToString() public string Protocol { get; } public SslFlags SslFlags { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ConfigurationAuthenticationModuleService.cs b/Microsoft.Web.Management/Server/ConfigurationAuthenticationModuleService.cs index 69a63260..06b19d46 100644 --- a/Microsoft.Web.Management/Server/ConfigurationAuthenticationModuleService.cs +++ b/Microsoft.Web.Management/Server/ConfigurationAuthenticationModuleService.cs @@ -32,4 +32,4 @@ bool IAuthenticationModuleService.IsEnabled() throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ConfigurationModuleProvider.cs b/Microsoft.Web.Management/Server/ConfigurationModuleProvider.cs index 7f49f746..c2872617 100644 --- a/Microsoft.Web.Management/Server/ConfigurationModuleProvider.cs +++ b/Microsoft.Web.Management/Server/ConfigurationModuleProvider.cs @@ -21,4 +21,4 @@ public override void SetChildDelegationState(string path, DelegationState state) protected abstract string ConfigurationSectionName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ConfigurationPathType.cs b/Microsoft.Web.Management/Server/ConfigurationPathType.cs index 49c7034d..ca2bf49d 100644 --- a/Microsoft.Web.Management/Server/ConfigurationPathType.cs +++ b/Microsoft.Web.Management/Server/ConfigurationPathType.cs @@ -12,4 +12,4 @@ public enum ConfigurationPathType Folder = 3, File = 4 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/DelegationState.cs b/Microsoft.Web.Management/Server/DelegationState.cs index 6958c532..1393721e 100644 --- a/Microsoft.Web.Management/Server/DelegationState.cs +++ b/Microsoft.Web.Management/Server/DelegationState.cs @@ -17,4 +17,4 @@ string description public string Mode { get; } public string Text { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/IAuthenticationModuleService.cs b/Microsoft.Web.Management/Server/IAuthenticationModuleService.cs index 2f5c8ab7..ca4148a3 100644 --- a/Microsoft.Web.Management/Server/IAuthenticationModuleService.cs +++ b/Microsoft.Web.Management/Server/IAuthenticationModuleService.cs @@ -8,4 +8,4 @@ public interface IAuthenticationModuleService { bool IsEnabled(); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/IGlobalConfigurationProvider.cs b/Microsoft.Web.Management/Server/IGlobalConfigurationProvider.cs index 28d46efa..a8870cad 100644 --- a/Microsoft.Web.Management/Server/IGlobalConfigurationProvider.cs +++ b/Microsoft.Web.Management/Server/IGlobalConfigurationProvider.cs @@ -15,4 +15,4 @@ ManagementFrameworkVersion version ReadOnlyCollection FrameworkVersions { get; } string ServerConfigurationPath { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/IManagementContext.cs b/Microsoft.Web.Management/Server/IManagementContext.cs index 84c61919..ddc2d15a 100644 --- a/Microsoft.Web.Management/Server/IManagementContext.cs +++ b/Microsoft.Web.Management/Server/IManagementContext.cs @@ -16,4 +16,4 @@ public interface IManagementContext bool IsLocalConnection { get; } IPrincipal User { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ISiteStatusProvider.cs b/Microsoft.Web.Management/Server/ISiteStatusProvider.cs index 81120a01..4028feab 100644 --- a/Microsoft.Web.Management/Server/ISiteStatusProvider.cs +++ b/Microsoft.Web.Management/Server/ISiteStatusProvider.cs @@ -16,4 +16,4 @@ out string errorMessage IEnumerable SupportedProtocols { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/InvalidPasswordReason.cs b/Microsoft.Web.Management/Server/InvalidPasswordReason.cs index f1573f3c..2e8b31bc 100644 --- a/Microsoft.Web.Management/Server/InvalidPasswordReason.cs +++ b/Microsoft.Web.Management/Server/InvalidPasswordReason.cs @@ -13,4 +13,4 @@ public enum InvalidPasswordReason PasswordFilterError = 4, UnknownError = 5 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAdministrationConfiguration.cs b/Microsoft.Web.Management/Server/ManagementAdministrationConfiguration.cs index d9a57be9..9668f531 100644 --- a/Microsoft.Web.Management/Server/ManagementAdministrationConfiguration.cs +++ b/Microsoft.Web.Management/Server/ManagementAdministrationConfiguration.cs @@ -21,4 +21,4 @@ string path public string Path { get; } public ICollection TrustedProviders { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthentication.cs b/Microsoft.Web.Management/Server/ManagementAuthentication.cs index 2df1fe25..037e5054 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthentication.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthentication.cs @@ -71,4 +71,4 @@ string password public static ManagementAuthenticationProvider Provider { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthenticationProvider.cs b/Microsoft.Web.Management/Server/ManagementAuthenticationProvider.cs index dbec9ede..63ab8db2 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthenticationProvider.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthenticationProvider.cs @@ -61,4 +61,4 @@ public abstract void SetPassword( string newPassword ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthorization.cs b/Microsoft.Web.Management/Server/ManagementAuthorization.cs index 9fd88b1e..afd2164b 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthorization.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthorization.cs @@ -71,4 +71,4 @@ string configurationPath public static ManagementAuthorizationProvider Provider { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthorizationInfo.cs b/Microsoft.Web.Management/Server/ManagementAuthorizationInfo.cs index 9f5b2af8..f385572e 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthorizationInfo.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthorizationInfo.cs @@ -21,4 +21,4 @@ bool isRole public bool IsRole { get; } public string Name { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthorizationInfoCollection.cs b/Microsoft.Web.Management/Server/ManagementAuthorizationInfoCollection.cs index 1fa681d9..3f77ea7b 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthorizationInfoCollection.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthorizationInfoCollection.cs @@ -9,4 +9,4 @@ namespace Microsoft.Web.Management.Server public sealed class ManagementAuthorizationInfoCollection : Collection { } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementAuthorizationProvider.cs b/Microsoft.Web.Management/Server/ManagementAuthorizationProvider.cs index a0dbdbb7..bd66c6ca 100644 --- a/Microsoft.Web.Management/Server/ManagementAuthorizationProvider.cs +++ b/Microsoft.Web.Management/Server/ManagementAuthorizationProvider.cs @@ -55,4 +55,4 @@ public abstract void RevokeConfigurationPath( string configurationPath ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementConfiguration.cs b/Microsoft.Web.Management/Server/ManagementConfiguration.cs index fce5a6eb..5dc7efbd 100644 --- a/Microsoft.Web.Management/Server/ManagementConfiguration.cs +++ b/Microsoft.Web.Management/Server/ManagementConfiguration.cs @@ -43,4 +43,4 @@ bool respectDelegation return null; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementConfigurationPath.cs b/Microsoft.Web.Management/Server/ManagementConfigurationPath.cs index e538fafe..4c57a18a 100644 --- a/Microsoft.Web.Management/Server/ManagementConfigurationPath.cs +++ b/Microsoft.Web.Management/Server/ManagementConfigurationPath.cs @@ -79,4 +79,4 @@ public bool IsEquivalentScope(ManagementScope scope) public ConfigurationPathType PathType { get; } public string SiteName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementContentNavigator.cs b/Microsoft.Web.Management/Server/ManagementContentNavigator.cs index 391137d8..86a3350c 100644 --- a/Microsoft.Web.Management/Server/ManagementContentNavigator.cs +++ b/Microsoft.Web.Management/Server/ManagementContentNavigator.cs @@ -76,4 +76,4 @@ object ICloneable.Clone() public int State { get; } public string VirtualPath { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementFrameworkVersion.cs b/Microsoft.Web.Management/Server/ManagementFrameworkVersion.cs index d6604933..ec241a8a 100644 --- a/Microsoft.Web.Management/Server/ManagementFrameworkVersion.cs +++ b/Microsoft.Web.Management/Server/ManagementFrameworkVersion.cs @@ -19,4 +19,4 @@ public bool IsEqual(string versionIdentifier) public string Text { get; } public Version Version { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementScope.cs b/Microsoft.Web.Management/Server/ManagementScope.cs index 8fcd206b..ad37a1c5 100644 --- a/Microsoft.Web.Management/Server/ManagementScope.cs +++ b/Microsoft.Web.Management/Server/ManagementScope.cs @@ -10,4 +10,4 @@ public enum ManagementScope Site = 1, Application = 2 } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementUnit.cs b/Microsoft.Web.Management/Server/ManagementUnit.cs index 621e87ad..ec65b0c2 100644 --- a/Microsoft.Web.Management/Server/ManagementUnit.cs +++ b/Microsoft.Web.Management/Server/ManagementUnit.cs @@ -68,4 +68,4 @@ public void Update() public abstract ManagementScope Scope { get; } public ServerManager ServerManager { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementUserInfo.cs b/Microsoft.Web.Management/Server/ManagementUserInfo.cs index 5d067060..b16503ab 100644 --- a/Microsoft.Web.Management/Server/ManagementUserInfo.cs +++ b/Microsoft.Web.Management/Server/ManagementUserInfo.cs @@ -23,4 +23,4 @@ public override string ToString() public bool Enabled { get; } public string Name { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ManagementUserInfoCollection.cs b/Microsoft.Web.Management/Server/ManagementUserInfoCollection.cs index 60fb99a7..12d7df0a 100644 --- a/Microsoft.Web.Management/Server/ManagementUserInfoCollection.cs +++ b/Microsoft.Web.Management/Server/ManagementUserInfoCollection.cs @@ -9,4 +9,4 @@ namespace Microsoft.Web.Management.Server public sealed class ManagementUserInfoCollection : Collection { } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ModuleDefinition.cs b/Microsoft.Web.Management/Server/ModuleDefinition.cs index 0e2bce8a..bc9968a7 100644 --- a/Microsoft.Web.Management/Server/ModuleDefinition.cs +++ b/Microsoft.Web.Management/Server/ModuleDefinition.cs @@ -18,4 +18,4 @@ public ModuleDefinition(string name, string clientModuleTypeName) public string ClientModuleTypeName { get; } public string Name { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ModuleInfo.cs b/Microsoft.Web.Management/Server/ModuleInfo.cs index 3fcce236..c9fc2b6a 100644 --- a/Microsoft.Web.Management/Server/ModuleInfo.cs +++ b/Microsoft.Web.Management/Server/ModuleInfo.cs @@ -12,4 +12,4 @@ public sealed class ModuleInfo public string ClientModuleTypeName { get; } public string Name { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ModuleService.cs b/Microsoft.Web.Management/Server/ModuleService.cs index 0144478b..1a97d301 100644 --- a/Microsoft.Web.Management/Server/ModuleService.cs +++ b/Microsoft.Web.Management/Server/ModuleService.cs @@ -33,4 +33,4 @@ string errorMessage protected ManagementUnit ManagementUnit { get; } protected string ModuleName { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ModuleServiceMethodAttribute.cs b/Microsoft.Web.Management/Server/ModuleServiceMethodAttribute.cs index 0f350aae..f5a08d66 100644 --- a/Microsoft.Web.Management/Server/ModuleServiceMethodAttribute.cs +++ b/Microsoft.Web.Management/Server/ModuleServiceMethodAttribute.cs @@ -10,4 +10,4 @@ public sealed class ModuleServiceMethodAttribute : Attribute { public bool PassThrough { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/ServerManagementUnit.cs b/Microsoft.Web.Management/Server/ServerManagementUnit.cs index c98a0758..9f435818 100644 --- a/Microsoft.Web.Management/Server/ServerManagementUnit.cs +++ b/Microsoft.Web.Management/Server/ServerManagementUnit.cs @@ -42,4 +42,4 @@ Type generatorType public string MachineName { get; } public override ManagementScope Scope { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/SimpleDelegatedModuleProvider.cs b/Microsoft.Web.Management/Server/SimpleDelegatedModuleProvider.cs index b99ceed4..6b554814 100644 --- a/Microsoft.Web.Management/Server/SimpleDelegatedModuleProvider.cs +++ b/Microsoft.Web.Management/Server/SimpleDelegatedModuleProvider.cs @@ -34,4 +34,4 @@ DelegationState state public override bool SupportsDelegation { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/SiteInfo.cs b/Microsoft.Web.Management/Server/SiteInfo.cs index 2392c6b9..091b29c1 100644 --- a/Microsoft.Web.Management/Server/SiteInfo.cs +++ b/Microsoft.Web.Management/Server/SiteInfo.cs @@ -25,4 +25,4 @@ IAppHostSite site public bool ServerAutoStart { get; } public ObjectState State { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/SiteManagementUnit.cs b/Microsoft.Web.Management/Server/SiteManagementUnit.cs index 0aea9c0f..62876fc8 100644 --- a/Microsoft.Web.Management/Server/SiteManagementUnit.cs +++ b/Microsoft.Web.Management/Server/SiteManagementUnit.cs @@ -15,4 +15,4 @@ string applicationPath public override ManagementScope Scope { get; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/TypeInformationGenerator.cs b/Microsoft.Web.Management/Server/TypeInformationGenerator.cs index 1fee76d2..b1eecc44 100644 --- a/Microsoft.Web.Management/Server/TypeInformationGenerator.cs +++ b/Microsoft.Web.Management/Server/TypeInformationGenerator.cs @@ -12,4 +12,4 @@ public abstract Object GetTypeInformation( Type type ); } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/WebManagementEventLog.cs b/Microsoft.Web.Management/Server/WebManagementEventLog.cs index a079ab89..1cf92117 100644 --- a/Microsoft.Web.Management/Server/WebManagementEventLog.cs +++ b/Microsoft.Web.Management/Server/WebManagementEventLog.cs @@ -43,4 +43,4 @@ EventLogEntryType entryType public static bool TraceOnly { get; set; } } -} \ No newline at end of file +} diff --git a/Microsoft.Web.Management/Server/WebManagementServiceException.cs b/Microsoft.Web.Management/Server/WebManagementServiceException.cs index a5d516bc..88bbab16 100644 --- a/Microsoft.Web.Management/Server/WebManagementServiceException.cs +++ b/Microsoft.Web.Management/Server/WebManagementServiceException.cs @@ -44,4 +44,4 @@ public override string ToString() public string ResourceName { get; } } -} \ No newline at end of file +} diff --git a/Tests.JexusManager/Authentication/DigestAuthenticationFeatureSiteTestFixture.cs b/Tests.JexusManager/Authentication/DigestAuthenticationFeatureSiteTestFixture.cs index 1305f5a1..56213e0d 100644 --- a/Tests.JexusManager/Authentication/DigestAuthenticationFeatureSiteTestFixture.cs +++ b/Tests.JexusManager/Authentication/DigestAuthenticationFeatureSiteTestFixture.cs @@ -118,7 +118,7 @@ public void TestEnable() new XAttribute("path", "WebSite1"), new XElement("system.webServer", new XElement("security", - new XElement("authentication", + new XElement("authentication", new XElement("digestAuthentication", new XAttribute("enabled", true))))))); document.Save(Expected); diff --git a/Tests.JexusManager/Caching/CachingFeatureSiteTestFixture.cs b/Tests.JexusManager/Caching/CachingFeatureSiteTestFixture.cs index 32f6eb49..5f4fb0a9 100644 --- a/Tests.JexusManager/Caching/CachingFeatureSiteTestFixture.cs +++ b/Tests.JexusManager/Caching/CachingFeatureSiteTestFixture.cs @@ -201,7 +201,7 @@ public void TestEdit() new XAttribute("duration", "00:00:00"), new XAttribute("extension", ".xslt"))))); document.Save(expected); - + var item = new CachingItem(null); item.Extension = ".xls"; _feature.AddItem(item); diff --git a/Tests.JexusManager/StringUtilityTestFixture.cs b/Tests.JexusManager/StringUtilityTestFixture.cs index 612d2c78..cecbd9df 100644 --- a/Tests.JexusManager/StringUtilityTestFixture.cs +++ b/Tests.JexusManager/StringUtilityTestFixture.cs @@ -10,7 +10,7 @@ public void TestIsWildcard() { Assert.True("*.test.com".IsWildcard()); Assert.True("*".IsWildcard()); - + Assert.False("test.*.com".IsWildcard()); Assert.False("*.*.com".IsWildcard()); } @@ -20,10 +20,10 @@ public void TestIsValidHost() { Assert.True("*.test.com".IsValidHost(true)); Assert.True("*".IsValidHost(true)); - + Assert.False("*.test.com".IsValidHost()); Assert.False("*".IsValidHost()); - + Assert.False("test.*.com".IsValidHost()); Assert.False("*.*.com".IsValidHost()); } diff --git a/Tests/TestCases.cs b/Tests/TestCases.cs index e7986333..b1221d33 100644 --- a/Tests/TestCases.cs +++ b/Tests/TestCases.cs @@ -207,7 +207,7 @@ public static void IisExpress(ServerManager server, string fileName) Assert.Null(binding.CertificateStoreName); Assert.Equal("localhost (net.pipe)", binding.ToShortString()); } - + Assert.True(site.Bindings.AllowsAdd); Assert.True(site.Bindings.AllowsClear); Assert.False(site.Bindings.AllowsRemove); @@ -534,7 +534,7 @@ public static void IisExpress(ServerManager server, string fileName) error["statusCode"] = 500; error["subStatusCode"] = 55; error["prefixLanguageFilePath"] = string.Empty; - + error["responseMode"] = 0; error["responseMode"] = ResponseMode.Test; #if IIS @@ -780,7 +780,7 @@ public static void IisExpressMissingWebsiteConfig(ServerManager server) filesCollection.Add(lastElement); Assert.Equal(7, filesCollection.Count); } - + var errorsSection = config.GetSection("system.webServer/httpErrors"); var errorsCollection = errorsSection.GetCollection(); var error = errorsCollection.CreateElement(); @@ -790,10 +790,10 @@ public static void IisExpressMissingWebsiteConfig(ServerManager server) error["responseMode"] = "File"; error["path"] = "test.htm"; errorsCollection.Add(error); - + var staticContent = config.GetSection("system.webServer/staticContent").GetChildElement("clientCache"); staticContent["cacheControlMode"] = "DisableCache"; - + ConfigurationSection requestFilteringSection = config.GetSection("system.webServer/security/requestFiltering"); ConfigurationElement hiddenSegmentsElement = requestFilteringSection.GetChildElement("hiddenSegments"); @@ -806,7 +806,7 @@ public static void IisExpressMissingWebsiteConfig(ServerManager server) var section = config.GetSection("system.webServer/rewrite/rules"); ConfigurationElementCollection collection = section.GetCollection(); - collection.Clear(); + collection.Clear(); var newElement = collection.CreateElement(); newElement["name"] = "test"; collection.Add(newElement); @@ -818,7 +818,7 @@ public static void IisExpressMissingWebsiteConfig(ServerManager server) // enable Windows authentication var windowsSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "WebSite1"); - var windowsEnabled = (bool) windowsSection["enabled"]; + var windowsEnabled = (bool)windowsSection["enabled"]; } { Configuration config = server.GetApplicationHostConfiguration(); diff --git a/lib/CheckBoxComboBox/CheckBoxComboBox.cs b/lib/CheckBoxComboBox/CheckBoxComboBox.cs index 8a3a11ae..343eae8a 100644 --- a/lib/CheckBoxComboBox/CheckBoxComboBox.cs +++ b/lib/CheckBoxComboBox/CheckBoxComboBox.cs @@ -82,7 +82,7 @@ internal string GetCSVText(bool skipFirstItem) { string ListText = String.Empty; int StartIndex = - DropDownStyle == ComboBoxStyle.DropDownList + DropDownStyle == ComboBoxStyle.DropDownList && DataSource == null && skipFirstItem ? 1 @@ -110,13 +110,13 @@ internal string GetCSVText(bool skipFirstItem) [Browsable(false)] public CheckBoxComboBoxItemList CheckBoxItems { - get - { + get + { // Added to ensure the CheckBoxItems are ALWAYS // available for modification via code. if (_CheckBoxComboBoxListControl.Items.Count != Items.Count) _CheckBoxComboBoxListControl.SynchroniseControlsWithComboBoxItems(); - return _CheckBoxComboBoxListControl.Items; + return _CheckBoxComboBoxListControl.Items; } } /// @@ -246,10 +246,10 @@ public void Clear() { this.Items.Clear(); if (DropDownStyle == ComboBoxStyle.DropDownList && DataSource == null) - _MustAddHiddenItem = true; + _MustAddHiddenItem = true; } /// - /// Uncheck all items. - /// + /// Uncheck all items. + /// public void ClearSelection() { foreach (CheckBoxComboBoxItem Item in CheckBoxItems) @@ -292,7 +292,7 @@ protected override void WndProc(ref Message m) { _MustAddHiddenItem = true; } - + base.WndProc(ref m); } } @@ -433,13 +433,13 @@ public void SynchroniseControlsWithComboBoxItems() #endregion #region Recreate the list in the same order of the combo box items - bool HasHiddenItem = + bool HasHiddenItem = _CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList && _CheckBoxComboBox.DataSource == null && !DesignMode; CheckBoxComboBoxItemList NewList = new CheckBoxComboBoxItemList(_CheckBoxComboBox); - for(int Index0 = 0; Index0 <= _CheckBoxComboBox.Items.Count - 1; Index0 ++) + for (int Index0 = 0; Index0 <= _CheckBoxComboBox.Items.Count - 1; Index0++) { object Object = _CheckBoxComboBox.Items[Index0]; CheckBoxComboBoxItem Item = null; @@ -492,8 +492,8 @@ public void SynchroniseControlsWithComboBoxItems() if (_CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList && _CheckBoxComboBox.DataSource == null && !DesignMode) - _CheckBoxComboBox.CheckBoxItems[0].Visible = false; - + _CheckBoxComboBox.CheckBoxItems[0].Visible = false; + ResumeLayout(); } @@ -579,7 +579,7 @@ public void AddBindings() // Helps to maintain the Checked status of this // checkbox before the control is visible if (_ComboBoxItem is INotifyPropertyChanged) - ((INotifyPropertyChanged)_ComboBoxItem).PropertyChanged += + ((INotifyPropertyChanged)_ComboBoxItem).PropertyChanged += new PropertyChangedEventHandler( CheckBoxComboBoxItem_PropertyChanged); } @@ -644,7 +644,7 @@ internal void ApplyProperties(CheckBoxProperties properties) private void CheckBoxComboBoxItem_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == _CheckBoxComboBox.ValueMember) - Checked = + Checked = (bool)_ComboBoxItem .GetType() .GetProperty(_CheckBoxComboBox.ValueMember) @@ -740,11 +740,11 @@ public CheckBoxComboBoxItem this[string displayName] int StartIndex = // An invisible item exists in this scenario to help // with the Text displayed in the TextBox of the Combo - _CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList + _CheckBoxComboBox.DropDownStyle == ComboBoxStyle.DropDownList && _CheckBoxComboBox.DataSource == null ? 1 // Ubiklou : 2008-04-28 : Ignore first item. (http://www.codeproject.com/KB/combobox/extending_combobox.aspx?fid=476622&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2526813&fr=1#xx2526813xx) : 0; - for(int Index = StartIndex; Index <= Count - 1; Index ++) + for (int Index = StartIndex; Index <= Count - 1; Index++) { CheckBoxComboBoxItem Item = this[Index]; @@ -752,7 +752,7 @@ public CheckBoxComboBoxItem this[string displayName] // The binding might not be active yet if (string.IsNullOrEmpty(Item.Text) // Ubiklou : 2008-04-28 : No databinding - && Item.DataBindings != null + && Item.DataBindings != null && Item.DataBindings["Text"] != null ) { @@ -769,7 +769,7 @@ PropertyInfo PropertyInfo throw new ArgumentOutOfRangeException(String.Format("\"{0}\" does not exist in this combo box.", displayName)); } } - + #endregion } diff --git a/lib/CheckBoxComboBox/NativeMethods.cs b/lib/CheckBoxComboBox/NativeMethods.cs index d837528f..90e4fe29 100644 --- a/lib/CheckBoxComboBox/NativeMethods.cs +++ b/lib/CheckBoxComboBox/NativeMethods.cs @@ -57,4 +57,4 @@ internal struct MINMAXINFO public Size maxTrackSize; } } -} \ No newline at end of file +} diff --git a/lib/CheckBoxComboBox/Popup.cs b/lib/CheckBoxComboBox/Popup.cs index 8685e64b..8e90bb1c 100644 --- a/lib/CheckBoxComboBox/Popup.cs +++ b/lib/CheckBoxComboBox/Popup.cs @@ -160,16 +160,16 @@ public Popup(Control content) Size = content.Size; content.Location = Point.Empty; Items.Add(host); - content.Disposed += delegate(object sender, EventArgs e) + content.Disposed += delegate (object sender, EventArgs e) { content = null; Dispose(true); }; - content.RegionChanged += delegate(object sender, EventArgs e) + content.RegionChanged += delegate (object sender, EventArgs e) { UpdateRegion(); }; - content.Paint += delegate(object sender, PaintEventArgs e) + content.Paint += delegate (object sender, PaintEventArgs e) { PaintSizeGrip(e); }; diff --git a/lib/CheckBoxComboBox/Selection Wrappers/ListSelectionWrapper.cs b/lib/CheckBoxComboBox/Selection Wrappers/ListSelectionWrapper.cs index fded6dfa..94572403 100644 --- a/lib/CheckBoxComboBox/Selection Wrappers/ListSelectionWrapper.cs +++ b/lib/CheckBoxComboBox/Selection Wrappers/ListSelectionWrapper.cs @@ -147,7 +147,7 @@ private ObjectSelectionWrapper CreateSelectionWrapper(IEnumerator Object) public ObjectSelectionWrapper FindObjectWithItem(T Object) { return Find(new Predicate>( - delegate(ObjectSelectionWrapper target) + delegate (ObjectSelectionWrapper target) { return target.Item.Equals(Object); })); diff --git a/lib/CheckBoxComboBox/Selection Wrappers/ObjectSelectionWrapper.cs b/lib/CheckBoxComboBox/Selection Wrappers/ObjectSelectionWrapper.cs index 7e9d5c31..61034ca8 100644 --- a/lib/CheckBoxComboBox/Selection Wrappers/ObjectSelectionWrapper.cs +++ b/lib/CheckBoxComboBox/Selection Wrappers/ObjectSelectionWrapper.cs @@ -69,7 +69,7 @@ public T Item /// public string Name { - get + get { string Name = null; if (string.IsNullOrEmpty(_Container.DisplayNameProperty)) @@ -112,7 +112,7 @@ public string NameConcatenated public bool Selected { get { return _Selected; } - set + set { if (_Selected != value) { From fc8cc29d4ea6daa8cb3176a2b5af3e147d600142 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Tue, 8 Apr 2025 03:15:00 -0400 Subject: [PATCH 5/7] Revised the generated code. --- .husky/pre-commit | 3 - .husky/task-runner.json | 14 --- .../NewHeaderDialog.cs | 8 +- .../AddProviderDialog.cs | 47 +++------ .../AddProviderSettingDialog.cs | 83 +++++----------- .../ProvidersFeature.cs | 95 ++----------------- .../ProvidersPage.Designer.cs | 14 +-- JexusManager.Features.Rewrite/SettingItem.cs | 3 +- .../SettingsFeature.cs | 41 +++----- JexusManager.Shared/Features/FeatureBase.cs | 1 + 10 files changed, 67 insertions(+), 242 deletions(-) delete mode 100644 .husky/pre-commit delete mode 100644 .husky/task-runner.json diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index e1b1d7a4..00000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -dotnet format -git add -A \ No newline at end of file diff --git a/.husky/task-runner.json b/.husky/task-runner.json deleted file mode 100644 index b56ea275..00000000 --- a/.husky/task-runner.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", - "tasks": [ - { - "name": "welcome-message-example", - "command": "bash", - "args": [ "-c", "echo Husky.Net is awesome!" ], - "windows": { - "command": "cmd", - "args": ["/c", "echo Husky.Net is awesome!" ] - } - } - ] -} diff --git a/JexusManager.Features.ResponseHeaders/NewHeaderDialog.cs b/JexusManager.Features.ResponseHeaders/NewHeaderDialog.cs index 1e5adfd4..f8d2875f 100644 --- a/JexusManager.Features.ResponseHeaders/NewHeaderDialog.cs +++ b/JexusManager.Features.ResponseHeaders/NewHeaderDialog.cs @@ -36,7 +36,7 @@ public NewHeaderDialog(IServiceProvider serviceProvider, ResponseHeadersItem sel .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { - if (feature.Items.Any(item => item != Item && txtName.Text == item.Name)) + if (feature.FindDuplicate(item => item.Name, txtName.Text)) { ShowMessage( "A header with this name already exists.", @@ -46,11 +46,7 @@ public NewHeaderDialog(IServiceProvider serviceProvider, ResponseHeadersItem sel return; } - if (Item == null) - { - Item = new ResponseHeadersItem(null); - } - + Item ??= new ResponseHeadersItem(null); Item.Name = txtName.Text; Item.Value = txtValue.Text; diff --git a/JexusManager.Features.Rewrite/AddProviderDialog.cs b/JexusManager.Features.Rewrite/AddProviderDialog.cs index 08f887b7..fea14f0b 100644 --- a/JexusManager.Features.Rewrite/AddProviderDialog.cs +++ b/JexusManager.Features.Rewrite/AddProviderDialog.cs @@ -9,8 +9,6 @@ namespace JexusManager.Features.Rewrite using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows.Forms; - using JexusManager.Services; - using Microsoft.Web.Administration; using Microsoft.Web.Management.Client; using Microsoft.Web.Management.Client.Win32; @@ -50,7 +48,7 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e cbManagedType.SelectedIndex = 0; } - ProviderItem = existing; + Item = existing; var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); @@ -69,42 +67,19 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { - if (string.IsNullOrEmpty(txtName.Text)) + if (feature.FindDuplicate(item => item.Name, txtName.Text)) { - ShowMessage("Provider name cannot be empty.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + ShowMessage( + "A rewrite provider with this name already exists.", + MessageBoxButtons.OK, + MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1); return; } - // Check for duplicate provider names - if (ProviderItem == null && _feature.Items.Exists(item => item.Name == txtName.Text)) - { - ShowMessage("A provider with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); - return; - } - - if (ProviderItem == null) - { - // Create a new provider - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/providers"); - var collection = section.GetCollection(); - - var element = collection.CreateElement(); - ProviderItem = new ProviderItem(element); - ProviderItem.Name = txtName.Text; - ProviderItem.Type = cbManagedType.Text; - - _feature.AddProvider(ProviderItem); - } - else - { - // Update existing provider - ProviderItem.Type = cbManagedType.Text; - ProviderItem.Apply(); - - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - service.ServerManager.CommitChanges(); - } + Item ??= new ProviderItem(null); + Item.Name = txtName.Text; + Item.Type = cbManagedType.Text; DialogResult = DialogResult.OK; })); @@ -119,6 +94,6 @@ public AddProviderDialog(Module module, ProvidersFeature feature, ProviderItem e } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public ProviderItem ProviderItem { get; private set; } + public ProviderItem Item { get; private set; } } } diff --git a/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs b/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs index 47b8ef9e..35d65aeb 100644 --- a/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs +++ b/JexusManager.Features.Rewrite/AddProviderSettingDialog.cs @@ -2,28 +2,25 @@ // // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; +using System.ComponentModel; +using System.Reactive.Disposables; +using System.Reactive.Linq; +using System.Windows.Forms; +using Microsoft.Web.Management.Client; +using Microsoft.Web.Management.Client.Win32; + namespace JexusManager.Features.Rewrite { - using System; - using System.ComponentModel; - using System.Linq; - using System.Reactive.Disposables; - using System.Reactive.Linq; - using System.Windows.Forms; - using JexusManager.Services; - using Microsoft.Web.Administration; - using Microsoft.Web.Management.Client; - using Microsoft.Web.Management.Client.Win32; - internal partial class AddProviderSettingDialog : DialogForm { - private readonly ProviderItem _provider; + private readonly SettingsFeature _feature; - public AddProviderSettingDialog(Module module, ProviderItem provider, SettingItem existing = null) + public AddProviderSettingDialog(Module module, SettingsFeature feature, SettingItem existing = null) : base(module) { InitializeComponent(); - _provider = provider; + _feature = feature; Text = existing == null ? "Add Provider Setting" : "Edit Provider Setting"; @@ -35,10 +32,8 @@ public AddProviderSettingDialog(Module module, ProviderItem provider, SettingIte if (existing != null) { cbName.Text = existing.Key; - cbName.Enabled = false; txtValue.Text = existing.Value; - // Note: SettingItem doesn't have an Encrypted property - // So we'll disable this feature when editing existing items + // TODO: disabled temp cbEncrypt.Enabled = false; } else @@ -46,7 +41,7 @@ public AddProviderSettingDialog(Module module, ProviderItem provider, SettingIte cbName.SelectedIndex = 0; } - SettingItem = existing; + Item = existing; var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); @@ -66,48 +61,20 @@ public AddProviderSettingDialog(Module module, ProviderItem provider, SettingIte .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { - if (string.IsNullOrEmpty(cbName.Text)) - { - ShowMessage("Setting name cannot be empty.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); - return; - } - // Check for duplicate setting names if adding a new setting - if (SettingItem == null && _provider != null && - _provider.Settings != null && - _provider.Settings.Any(item => item.Key == cbName.Text)) + if (_feature.FindDuplicate(item => item.Key, cbName.Text)) { - ShowMessage("A setting with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); + ShowMessage( + "A rewrite provider setting with this name already exists.", + MessageBoxButtons.OK, + MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1); return; } - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - if (SettingItem == null) - { - var settingsCollection = _provider.Element.GetCollection("settings"); - var element = settingsCollection.CreateElement(); - - SettingItem = new SettingItem(element); - SettingItem.Key = cbName.Text; - SettingItem.Value = txtValue.Text; - - // Handle encryption if needed - if (cbEncrypt.Checked) - { - // TODO: Implement encryption logic if required - // Since SettingItem doesn't have built-in encryption support - } - - SettingItem.Apply(); - settingsCollection.Add(element); - service.ServerManager.CommitChanges(); - } - else - { - // Update existing setting - SettingItem.Value = txtValue.Text; - SettingItem.Apply(); - service.ServerManager.CommitChanges(); - } + Item ??= new SettingItem(null); + Item.Key = cbName.Text; + Item.Value = txtValue.Text; + Item.Encrypted = cbEncrypt.Checked; DialogResult = DialogResult.OK; })); @@ -115,11 +82,11 @@ public AddProviderSettingDialog(Module module, ProviderItem provider, SettingIte .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { - DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403&clcid=0x409"); + _feature.ShowHelp(); })); } [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public SettingItem SettingItem { get; private set; } + public SettingItem Item { get; private set; } } } diff --git a/JexusManager.Features.Rewrite/ProvidersFeature.cs b/JexusManager.Features.Rewrite/ProvidersFeature.cs index 76d12e0a..d083749c 100644 --- a/JexusManager.Features.Rewrite/ProvidersFeature.cs +++ b/JexusManager.Features.Rewrite/ProvidersFeature.cs @@ -112,28 +112,7 @@ public TaskList GetTaskList() public void Load() { - Items = new List(); - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - - try - { - var section = service.GetSection("system.webServer/rewrite/providers"); - CanRevert = section.CanRevert(); - - var collection = section.GetCollection(); - foreach (ConfigurationElement providerElement in collection) - { - var item = new ProviderItem(providerElement); - Items.Add(item); - } - } - catch (Exception ex) - { - var managementUIService = (IManagementUIService)GetService(typeof(IManagementUIService)); - managementUIService.ShowError(ex, "Error loading rewrite providers", Name, false); - } - - OnRewriteSettingsSaved(); + LoadItems(); } internal protected void OnRewriteSettingsSaved() @@ -143,17 +122,19 @@ internal protected void OnRewriteSettingsSaved() public bool ShowHelp() { - DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403&clcid=0x409"); + DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=183852"); return false; } public void Add() { using var dialog = new AddProviderDialog(Module, this, null); - if (dialog.ShowDialog() == DialogResult.OK) + if (dialog.ShowDialog() != DialogResult.OK) { - OnRewriteSettingsSaved(); + return; } + + AddItem(dialog.Item); } public void ViewSettings() @@ -169,16 +150,13 @@ public void Edit() protected override void DoubleClick(ProviderItem item) { - if (item == null) + using var dialog = new AddProviderDialog(Module, this, item); + if (dialog.ShowDialog() != DialogResult.OK) { return; } - using var dialog = new AddProviderDialog(Module, this, item); - if (dialog.ShowDialog() == DialogResult.OK) - { - OnRewriteSettingsSaved(); - } + EditItem(dialog.Item); } public void Rename() @@ -188,11 +166,6 @@ public void Rename() public void Remove() { - if (SelectedItem == null) - { - return; - } - var service = (IManagementUIService)GetService(typeof(IManagementUIService)); if (service.ShowMessage( "Are you sure you want to remove this provider?", @@ -204,36 +177,11 @@ public void Remove() return; } - var configService = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = configService.GetSection("system.webServer/rewrite/providers"); - var collection = section.GetCollection(); - - // Find and remove the item from the configuration - foreach (ConfigurationElement element in collection) - { - if ((string)element["name"] == SelectedItem.Name) - { - collection.Remove(element); - break; - } - } - - configService.ServerManager.CommitChanges(); - - // Remove from the UI - Items.Remove(SelectedItem); - SelectedItem = null; - - OnRewriteSettingsSaved(); + RemoveItem(); } public void Revert() { - if (!CanRevert) - { - throw new InvalidOperationException("Revert operation cannot be done at server level"); - } - var service = (IManagementUIService)GetService(typeof(IManagementUIService)); var result = service.ShowMessage( @@ -248,29 +196,6 @@ public void Revert() this.RevertItems(); } - - public void AddProvider(ProviderItem provider) - { - if (provider == null) - { - return; - } - - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/providers"); - var collection = section.GetCollection(); - - ConfigurationElement element = collection.CreateElement(); - provider.Element = element; - provider.Apply(); - collection.Add(element); - - service.ServerManager.CommitChanges(); - - Items.Add(provider); - OnRewriteSettingsSaved(); - } - protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { var section = service.GetSection("system.webServer/rewrite/providers"); diff --git a/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs index e73d628b..4e199a00 100644 --- a/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs +++ b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs @@ -37,7 +37,6 @@ private void InitializeComponent() this.panel2 = new System.Windows.Forms.Panel(); this.listView1 = new System.Windows.Forms.ListView(); this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.chValue = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chProviderType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chEntryType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.label2 = new System.Windows.Forms.Label(); @@ -87,8 +86,8 @@ private void InitializeComponent() // // panel2 // - this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.panel2.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.panel2.Controls.Add(this.listView1); this.panel2.Controls.Add(this.label2); @@ -98,10 +97,8 @@ private void InitializeComponent() this.panel2.TabIndex = 8; // // listView1 - // - this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.chName, - this.chValue, this.chProviderType, this.chEntryType}); this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -239,12 +236,9 @@ private void InitializeComponent() } - #endregion - - private SplitContainer splitContainer1; + #endregion private SplitContainer splitContainer1; private ListView listView1; private ColumnHeader chName; - private ColumnHeader chValue; private ColumnHeader chProviderType; private ColumnHeader chEntryType; private TableLayoutPanel tableLayoutPanel1; diff --git a/JexusManager.Features.Rewrite/SettingItem.cs b/JexusManager.Features.Rewrite/SettingItem.cs index 6a1fb995..b1105af2 100644 --- a/JexusManager.Features.Rewrite/SettingItem.cs +++ b/JexusManager.Features.Rewrite/SettingItem.cs @@ -12,6 +12,7 @@ public class SettingItem : IItem public SettingItem(ConfigurationElement element) { + Flag = element == null || element.IsLocallyStored ? "Local" : "Inherited"; Element = element; if (element == null) { @@ -49,7 +50,7 @@ public void Apply() } else { - Element["encryptedValue"] = null; + //Element["encryptedValue"] = null; Element["value"] = Value; } } diff --git a/JexusManager.Features.Rewrite/SettingsFeature.cs b/JexusManager.Features.Rewrite/SettingsFeature.cs index 6624ff64..8d2c72c4 100644 --- a/JexusManager.Features.Rewrite/SettingsFeature.cs +++ b/JexusManager.Features.Rewrite/SettingsFeature.cs @@ -77,46 +77,38 @@ public TaskList GetTaskList() public void Load() { - Items = _provider.Settings.ToList(); - OnSettingsUpdated(); + LoadItems(); } public void Add() { - using var dialog = new AddProviderSettingDialog(Module, _provider); + using var dialog = new AddProviderSettingDialog(Module, this, null); if (dialog.ShowDialog() != DialogResult.OK) { return; } - _provider.Settings.Add(dialog.SettingItem); - Items = new List(_provider.Settings); - OnSettingsUpdated(); + AddItem(dialog.Item); } public void Edit() { - if (SelectedItem == null) - { - return; - } + DoubleClick(SelectedItem); + } - using var dialog = new AddProviderSettingDialog(Module, _provider, SelectedItem); + protected override void DoubleClick(SettingItem item) + { + using var dialog = new AddProviderSettingDialog(Module, this, item); if (dialog.ShowDialog() != DialogResult.OK) { return; } - OnSettingsUpdated(); + EditItem(dialog.Item); } public void Remove() { - if (SelectedItem == null) - { - return; - } - var service = (IManagementUIService)GetService(typeof(IManagementUIService)); if (service.ShowMessage( "Are you sure you want to remove this setting?", @@ -128,21 +120,12 @@ public void Remove() return; } - _provider.Settings.Remove(SelectedItem); - Items.Remove(SelectedItem); - SelectedItem = null; - OnSettingsUpdated(); - } - - protected override void DoubleClick(SettingItem item) - { - Edit(); + RemoveItem(); } protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { - // Settings are managed through the provider's Settings collection - return null; + return _provider.Element.GetCollection("settings"); } protected override void OnSettingsSaved() @@ -152,7 +135,7 @@ protected override void OnSettingsSaved() public bool ShowHelp() { - DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=130403"); + DialogHelper.ProcessStart("http://go.microsoft.com/fwlink/?LinkID=183852"); return false; } diff --git a/JexusManager.Shared/Features/FeatureBase.cs b/JexusManager.Shared/Features/FeatureBase.cs index ed0bb7f0..fa625e22 100644 --- a/JexusManager.Shared/Features/FeatureBase.cs +++ b/JexusManager.Shared/Features/FeatureBase.cs @@ -322,6 +322,7 @@ public void RenameInline(T item) public bool FindDuplicate(Func value, string text) { + // TODO: seem to be duplicate to the Match pattern. return Items.Where(item => item != SelectedItem) .Any(item => string.Equals(value(item), text, StringComparison.Ordinal)); } From f2789a2b9d4dd7bbb7811b7cbce7396d07af8262 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Tue, 8 Apr 2025 15:11:08 -0400 Subject: [PATCH 6/7] Simplified features. --- .../Inbound/AllowedVariablesFeature.cs | 61 +--------- .../Inbound/MapsFeature.cs | 59 ++-------- .../Outbound/CustomTagsFeature.cs | 43 +------- .../Outbound/PreConditionsFeature.cs | 104 +++--------------- 4 files changed, 36 insertions(+), 231 deletions(-) diff --git a/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs b/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs index 23d6349b..cc1101f6 100644 --- a/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs +++ b/JexusManager.Features.Rewrite/Inbound/AllowedVariablesFeature.cs @@ -105,18 +105,10 @@ public TaskList GetTaskList() public void Load() { - Items = new List(); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var section = service.GetSection("system.webServer/rewrite/allowedServerVariables"); - ConfigurationElementCollection rulesCollection = section.GetCollection(); - foreach (ConfigurationElement ruleElement in rulesCollection) - { - var node = new AllowedVariableItem(ruleElement, this); - Items.Add(node); - } - CanRevert = section.CanRevert(); - OnRewriteSettingsSaved(); + LoadItems(); } public void Add() @@ -128,26 +120,8 @@ public void Add() return; } - var newItem = dialog.Item; - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var rulesSection = service.GetSection("system.webServer/rewrite/allowedServerVariables"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection(); - - if (SelectedItem != newItem) - { - Items.Add(newItem); - SelectedItem = newItem; - } - else if (newItem.Flag != "Local") - { - rulesCollection.Remove(newItem.Element); - newItem.Flag = "Local"; - } - - newItem.AppendTo(rulesCollection); - service.ServerManager.CommitChanges(); + AddItem(dialog.Item); } - OnRewriteSettingsSaved(); } public void Remove() @@ -161,15 +135,7 @@ public void Remove() return; } - Items.Remove(SelectedItem); - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/allowedServerVariables"); - ConfigurationElementCollection collection = section.GetCollection(); - collection.Remove(SelectedItem.Element); - service.ServerManager.CommitChanges(); - - SelectedItem = null; - OnRewriteSettingsSaved(); + RemoveItem(); } internal protected void OnRewriteSettingsSaved() @@ -196,23 +162,7 @@ public void Revert() return; } - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/allowedServerVariables"); - ConfigurationElementCollection collection = section.GetCollection(); - collection.Clear(); - collection.Delete(); - collection = section.GetCollection(); - - SelectedItem = null; - Items.Clear(); - foreach (ConfigurationElement ruleElement in collection) - { - var node = new AllowedVariableItem(ruleElement, this); - Items.Add(node); - } - - service.ServerManager.CommitChanges(); - OnRewriteSettingsSaved(); + RevertItems(); } private void Edit() @@ -243,7 +193,8 @@ public override string GetGroupKey(ListViewItem item, string selectedGroup) protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { - return null; + var section = service.GetSection("system.webServer/rewrite/allowedServerVariables"); + return section.GetCollection(); } protected override void OnSettingsSaved() diff --git a/JexusManager.Features.Rewrite/Inbound/MapsFeature.cs b/JexusManager.Features.Rewrite/Inbound/MapsFeature.cs index d5498aa4..fb75df96 100644 --- a/JexusManager.Features.Rewrite/Inbound/MapsFeature.cs +++ b/JexusManager.Features.Rewrite/Inbound/MapsFeature.cs @@ -93,50 +93,21 @@ public TaskList GetTaskList() public void Load() { - Items = new List(); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var rulesSection = service.GetSection("system.webServer/rewrite/rewriteMaps"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection(); - foreach (ConfigurationElement ruleElement in rulesCollection) - { - var node = new MapItem(ruleElement, this); - Items.Add(node); - } - - OnRewriteSettingsSaved(); + CanRevert = rulesSection.CanRevert(); + LoadItems(); } public void Add() { - using (var dialog = new AddMapsDialog(Module, this)) + using var dialog = new AddMapsDialog(Module, this); + if (dialog.ShowDialog() != DialogResult.OK) { - if (dialog.ShowDialog() != DialogResult.OK) - { - return; - } - - var newItem = dialog.Item; - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var rulesSection = service.GetSection("system.webServer/rewrite/rewriteMaps"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection(); - - if (SelectedItem != newItem) - { - Items.Add(newItem); - SelectedItem = newItem; - } - else if (newItem.Flag != "Local") - { - rulesCollection.Remove(newItem.Element); - newItem.Flag = "Local"; - } - - newItem.AppendTo(rulesCollection); - service.ServerManager.CommitChanges(); + return; } - OnRewriteSettingsSaved(); - Edit(); + AddItem(dialog.Item); } public void Remove() @@ -150,15 +121,7 @@ public void Remove() return; } - Items.Remove(SelectedItem); - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/rewriteMaps"); - ConfigurationElementCollection collection = section.GetCollection(); - collection.Remove(SelectedItem.Element); - service.ServerManager.CommitChanges(); - - SelectedItem = null; - OnRewriteSettingsSaved(); + RemoveItem(); } internal protected void OnRewriteSettingsSaved() @@ -186,11 +149,6 @@ protected override void DoubleClick(MapItem item) public void Revert() { - if (!CanRevert) - { - throw new InvalidOperationException("Revert operation cannot be done at server level"); - } - var service = (IManagementUIService)GetService(typeof(IManagementUIService)); var result = service.ShowMessage( @@ -220,7 +178,8 @@ public virtual Version MinimumFrameworkVersion protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { - return null; + var section = service.GetSection("system.webServer/rewrite/rewriteMaps"); + return section.GetCollection(); } protected override void OnSettingsSaved() diff --git a/JexusManager.Features.Rewrite/Outbound/CustomTagsFeature.cs b/JexusManager.Features.Rewrite/Outbound/CustomTagsFeature.cs index 0147654b..d3acbfe8 100644 --- a/JexusManager.Features.Rewrite/Outbound/CustomTagsFeature.cs +++ b/JexusManager.Features.Rewrite/Outbound/CustomTagsFeature.cs @@ -99,18 +99,10 @@ public TaskList GetTaskList() public void Load() { - Items = new List(); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); var section = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection rulesCollection = section.GetCollection("customTags"); - foreach (ConfigurationElement ruleElement in rulesCollection) - { - var node = new CustomTagsItem(ruleElement); - Items.Add(node); - } - CanRevert = section.CanRevert(); - OnRewriteSettingsSaved(); + LoadItems(); } public void AddGroup() @@ -122,26 +114,8 @@ public void AddGroup() return; } - var newItem = dialog.Item; - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var rulesSection = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection("customTags"); - - if (SelectedItem != newItem) - { - Items.Add(newItem); - SelectedItem = newItem; - } - else if (newItem.Flag != "Local") - { - rulesCollection.Remove(newItem.Element); - newItem.Flag = "Local"; - } - - newItem.AppendTo(rulesCollection); - service.ServerManager.CommitChanges(); + AddItem(dialog.Item); } - OnRewriteSettingsSaved(); } public void Add() @@ -172,15 +146,7 @@ public void Remove() return; } - Items.Remove(SelectedItem); - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection collection = section.GetCollection("customTags"); - collection.Remove(SelectedItem.Element); - service.ServerManager.CommitChanges(); - - SelectedItem = null; - OnRewriteSettingsSaved(); + RemoveItem(); } public void Edit() @@ -201,7 +167,8 @@ public virtual bool ShowHelp() protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { - return null; + var section = service.GetSection("system.webServer/rewrite/outboundRules"); + return section.GetCollection("customTags"); } protected override void OnSettingsSaved() diff --git a/JexusManager.Features.Rewrite/Outbound/PreConditionsFeature.cs b/JexusManager.Features.Rewrite/Outbound/PreConditionsFeature.cs index a7b8f840..9b142e62 100644 --- a/JexusManager.Features.Rewrite/Outbound/PreConditionsFeature.cs +++ b/JexusManager.Features.Rewrite/Outbound/PreConditionsFeature.cs @@ -111,49 +111,21 @@ public TaskList GetTaskList() public void Load() { - Items = new List(); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection rulesCollection = section.GetCollection("preConditions"); - foreach (ConfigurationElement ruleElement in rulesCollection) - { - var node = new PreConditionItem(ruleElement); - Items.Add(node); - } - + var section = service.GetSection("system.webServer/rewrite/outboundRules"); CanRevert = section.CanRevert(); - OnRewriteSettingsSaved(); + LoadItems(); } public void Add() { - using (var dialog = new AddPreConditionDialog(Module, null)) + using var dialog = new AddPreConditionDialog(Module, null); + if (dialog.ShowDialog() != DialogResult.OK) { - if (dialog.ShowDialog() != DialogResult.OK) - { - return; - } - - var newItem = dialog.Item; - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var rulesSection = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection("preConditions"); - - if (SelectedItem != newItem) - { - Items.Add(newItem); - SelectedItem = newItem; - } - else if (newItem.Flag != "Local") - { - rulesCollection.Remove(newItem.Element); - newItem.Flag = "Local"; - } - - newItem.AppendTo(rulesCollection); - service.ServerManager.CommitChanges(); + return; } - OnRewriteSettingsSaved(); + + AddItem(dialog.Item); } public void Edit() @@ -164,34 +136,13 @@ public void Edit() protected override void DoubleClick(PreConditionItem item) { // TODO: how to edit. - using (var dialog = new AddPreConditionDialog(Module, item)) + using var dialog = new AddPreConditionDialog(Module, item); + if (dialog.ShowDialog() != DialogResult.OK) { - if (dialog.ShowDialog() != DialogResult.OK) - { - return; - } - - var newItem = dialog.Item; - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var rulesSection = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection rulesCollection = rulesSection.GetCollection("preConditions"); - - if (SelectedItem != newItem) - { - Items.Add(newItem); - SelectedItem = newItem; - } - else if (newItem.Flag != "Local") - { - rulesCollection.Remove(newItem.Element); - newItem.Flag = "Local"; - } - - newItem.AppendTo(rulesCollection); - - service.ServerManager.CommitChanges(); + return; } - OnRewriteSettingsSaved(); + + EditItem(dialog.Item); } public void Remove() @@ -205,15 +156,7 @@ public void Remove() return; } - Items.Remove(SelectedItem); - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection collection = section.GetCollection("preConditions"); - collection.Remove(SelectedItem.Element); - service.ServerManager.CommitChanges(); - - SelectedItem = null; - OnRewriteSettingsSaved(); + RemoveItem(); } internal protected void OnRewriteSettingsSaved() @@ -240,23 +183,7 @@ public void Revert() return; } - var service = (IConfigurationService)GetService(typeof(IConfigurationService)); - var section = service.GetSection("system.webServer/rewrite/outboundRules"); - ConfigurationElementCollection collection = section.GetCollection("preConditions"); - collection.Clear(); - collection.Delete(); - collection = section.GetCollection(); - - SelectedItem = null; - Items.Clear(); - foreach (ConfigurationElement ruleElement in collection) - { - var node = new PreConditionItem(ruleElement); - Items.Add(node); - } - - service.ServerManager.CommitChanges(); - OnRewriteSettingsSaved(); + RevertItems(); } private void Rename() @@ -266,7 +193,8 @@ private void Rename() protected override ConfigurationElementCollection GetCollection(IConfigurationService service) { - return null; + var section = service.GetSection("system.webServer/rewrite/outboundRules"); + return section.GetCollection("preConditions"); } protected override void OnSettingsSaved() From f9cfce1bf041d52370535c4a31aae19443c48867 Mon Sep 17 00:00:00 2001 From: Lex Li Date: Wed, 9 Apr 2025 02:53:04 -0400 Subject: [PATCH 7/7] Fixed rewrite issues. --- JexusManager.Features.Rewrite/ProviderItem.cs | 30 ++++++--- .../ProvidersPage.Designer.cs | 11 ++- .../ProvidersPage.cs | 1 - .../SettingsPage.Designer.cs | 38 +++++------ .../SettingsPage.resx | 67 +++++++++++++++++++ 5 files changed, 111 insertions(+), 36 deletions(-) create mode 100644 JexusManager.Features.Rewrite/SettingsPage.resx diff --git a/JexusManager.Features.Rewrite/ProviderItem.cs b/JexusManager.Features.Rewrite/ProviderItem.cs index 7205c056..946e155b 100644 --- a/JexusManager.Features.Rewrite/ProviderItem.cs +++ b/JexusManager.Features.Rewrite/ProviderItem.cs @@ -7,6 +7,7 @@ namespace JexusManager.Features.Rewrite using System; using System.Collections.Generic; using System.Linq; + using System.Threading; using Microsoft.Web.Administration; /// @@ -20,8 +21,7 @@ public class ProviderItem : IItem /// public string Name { - get { return (string)Element["name"]; } - set { Element["name"] = value; } + get; set; } /// @@ -29,8 +29,7 @@ public string Name /// public string Type { - get { return (string)Element["type"]; } - set { Element["type"] = value; } + get; set; } /// @@ -54,9 +53,22 @@ public string Type /// The provider configuration element. public ProviderItem(ConfigurationElement element) { - Element = element ?? throw new ArgumentNullException(nameof(element)); - Flag = element.IsLocallyStored ? "Local" : "Inherited"; + Element = element; + Flag = element == null || element.IsLocallyStored ? "Local" : "Inhertied"; + if (element == null) + { + Name = string.Empty; + Type = string.Empty; + return; + } + Reset(); + } + + private void Reset() + { + Name = (string)Element["name"]; + Type = (string)Element["type"]; // Load settings from the provider's settings collection var settingsCollection = Element.GetChildElement("settings")?.GetCollection(); if (settingsCollection != null) @@ -76,11 +88,11 @@ public void Apply() Element["name"] = Name; Element["type"] = Type; - var conditions = Element.GetCollection(); - conditions.Clear(); + var settings = Element.GetCollection("settings"); + settings.Clear(); foreach (var item in Settings) { - item.AppendTo(conditions); + item.AppendTo(settings); } } diff --git a/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs index 4e199a00..929fd872 100644 --- a/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs +++ b/JexusManager.Features.Rewrite/ProvidersPage.Designer.cs @@ -97,7 +97,8 @@ private void InitializeComponent() this.panel2.TabIndex = 8; // // listView1 - // this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + // + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.chName, this.chProviderType, this.chEntryType}); @@ -121,11 +122,6 @@ private void InitializeComponent() this.chName.Text = "Name"; this.chName.Width = 200; // - // chValue - // - this.chValue.Text = "Value"; - this.chValue.Width = 200; - // // chProviderType // this.chProviderType.Text = "Provider Type"; @@ -236,7 +232,8 @@ private void InitializeComponent() } - #endregion private SplitContainer splitContainer1; + #endregion + private SplitContainer splitContainer1; private ListView listView1; private ColumnHeader chName; private ColumnHeader chProviderType; diff --git a/JexusManager.Features.Rewrite/ProvidersPage.cs b/JexusManager.Features.Rewrite/ProvidersPage.cs index 021e7ba6..cd7443d2 100644 --- a/JexusManager.Features.Rewrite/ProvidersPage.cs +++ b/JexusManager.Features.Rewrite/ProvidersPage.cs @@ -60,7 +60,6 @@ public ProviderListViewItem(ProviderItem item, ProvidersPage page) { Item = item; _page = page; - SubItems.Add(new ListViewSubItem(this, string.Empty /*item.Value*/)); // TODO: SubItems.Add(new ListViewSubItem(this, item.Type)); SubItems.Add(new ListViewSubItem(this, item.Flag)); } diff --git a/JexusManager.Features.Rewrite/SettingsPage.Designer.cs b/JexusManager.Features.Rewrite/SettingsPage.Designer.cs index 73b5b930..75e83241 100644 --- a/JexusManager.Features.Rewrite/SettingsPage.Designer.cs +++ b/JexusManager.Features.Rewrite/SettingsPage.Designer.cs @@ -87,11 +87,11 @@ private void InitializeComponent() // // panel2 // - this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.panel2.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.panel2.Controls.Add(this.toolStrip2); this.panel2.Controls.Add(this.listView1); + this.panel2.Controls.Add(this.toolStrip2); this.panel2.Controls.Add(this.label2); this.panel2.Location = new System.Drawing.Point(10, 50); this.panel2.Name = "panel2"; @@ -107,11 +107,11 @@ private void InitializeComponent() this.listView1.Dock = System.Windows.Forms.DockStyle.Fill; this.listView1.FullRowSelect = true; this.listView1.HideSelection = false; - this.listView1.Location = new System.Drawing.Point(0, 45); + this.listView1.Location = new System.Drawing.Point(0, 38); this.listView1.Margin = new System.Windows.Forms.Padding(5); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; - this.listView1.Size = new System.Drawing.Size(560, 495); + this.listView1.Size = new System.Drawing.Size(560, 502); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; @@ -134,19 +134,9 @@ private void InitializeComponent() this.chEncrypted.Text = "Encrypted"; this.chEncrypted.Width = 100; // - // label2 - // - this.label2.AutoSize = true; - this.label2.Dock = System.Windows.Forms.DockStyle.Top; - this.label2.Location = new System.Drawing.Point(0, 0); - this.label2.Margin = new System.Windows.Forms.Padding(5); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(324, 13); - this.label2.TabIndex = 1; - this.label2.Text = "Configure settings for the selected provider."; - // // toolStrip2 // + this.toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripLabel2, this.cbGroup}); @@ -159,15 +149,25 @@ private void InitializeComponent() // toolStripLabel2 // this.toolStripLabel2.Name = "toolStripLabel2"; - this.toolStripLabel2.Size = new System.Drawing.Size(55, 22); + this.toolStripLabel2.Size = new System.Drawing.Size(59, 22); this.toolStripLabel2.Text = "Group by:"; // // cbGroup // this.cbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbGroup.Name = "cbGroup"; - this.cbGroup.Size = new System.Drawing.Size(200, 25); - this.cbGroup.SelectedIndexChanged += new System.EventHandler(this.CbGroup_SelectedIndexChanged); + this.cbGroup.Size = new System.Drawing.Size(121, 25); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 0); + this.label2.Margin = new System.Windows.Forms.Padding(5); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(324, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Configure settings for the selected provider."; // // pictureBox1 // diff --git a/JexusManager.Features.Rewrite/SettingsPage.resx b/JexusManager.Features.Rewrite/SettingsPage.resx new file mode 100644 index 00000000..591d8cef --- /dev/null +++ b/JexusManager.Features.Rewrite/SettingsPage.resx @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 154, 17 + + + 259, 17 + +