From 190c99a416b6f3c7e48066eadf3943d4ddccb2d8 Mon Sep 17 00:00:00 2001 From: CarloToso <105941898+CarloToso@users.noreply.github.com> Date: Tue, 21 Mar 2023 18:59:14 +0100 Subject: [PATCH] Remove FormObject.cs and FormObjectCollection.cs (#19383) --- .../Common/WebRequestPSCmdlet.Common.cs | 3 - .../commands/utility/WebCmdlet/FormObject.cs | 55 ------------------- .../utility/WebCmdlet/FormObjectCollection.cs | 37 ------------- 3 files changed, 95 deletions(-) delete mode 100644 src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObject.cs delete mode 100644 src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObjectCollection.cs diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index c078faaed..597e7caa2 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -1157,9 +1157,6 @@ namespace Microsoft.PowerShell.Commands switch (content) { - case FormObject form: - SetRequestContent(request, form.Fields); - break; case IDictionary dictionary when request.Method != HttpMethod.Get: SetRequestContent(request, dictionary); break; diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObject.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObject.cs deleted file mode 100644 index b496a1203..000000000 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObject.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System.Collections.Generic; - -namespace Microsoft.PowerShell.Commands -{ - /// - /// FormObject used in HtmlWebResponseObject. - /// - public class FormObject - { - /// - /// Gets the Id property. - /// - public string Id { get; } - - /// - /// Gets the Method property. - /// - public string Method { get; } - - /// - /// Gets the Action property. - /// - public string Action { get; } - - /// - /// Gets the Fields property. - /// - public Dictionary Fields { get; } - - /// - /// Initializes a new instance of the class. - /// - /// - /// - /// - public FormObject(string id, string method, string action) - { - Id = id; - Method = method; - Action = action; - Fields = new Dictionary(); - } - - internal void AddField(string key, string value) - { - if (key is not null && !Fields.TryGetValue(key, out string test)) - { - Fields[key] = value; - } - } - } -} diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObjectCollection.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObjectCollection.cs deleted file mode 100644 index f435b92e4..000000000 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/FormObjectCollection.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System; -using System.Collections.ObjectModel; - -namespace Microsoft.PowerShell.Commands -{ - /// - /// FormObjectCollection used in HtmlWebResponseObject. - /// - public class FormObjectCollection : Collection - { - /// - /// Gets the FormObject from the key. - /// - /// - /// - public FormObject this[string key] - { - get - { - FormObject form = null; - foreach (FormObject f in this) - { - if (string.Equals(key, f.Id, StringComparison.OrdinalIgnoreCase)) - { - form = f; - break; - } - } - - return form; - } - } - } -}