PowerToys/src/modules/launcher/Plugins/Microsoft.Plugin.Shell/ShellPluginSettings.cs
ryanbodrug-microsoft 79bb68d784
User/ryanbod/shell plugin fxcop (#6043)
* Enabling FxCop static analysis.

* Fixes for CA2227 Change 'Count' to be read-only by removing the property setter.
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca2227?view=vs-2019

* Fix for:  CA1822: Mark members as static
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1822?view=vs-2019

* Fix for CA1805: Do not initialize unnecessarily.
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1805?view=vs-2019

* Fix for: Error CA1724 The type name Settings conflicts in whole or in part with the namespace name 'Microsoft.PowerToys.Settings'. Change either name to eliminate the conflict. Microsoft.Plugin.Shell C:\repos\powertoys\src\modules\launcher\Plugins\Microsoft.Plugin.Shell\Settings.cs 9 Active

* Severity Code Description Project File Line Suppression State
Error CA1724 The type name Settings conflicts in whole or in part with the namespace name 'Microsoft.PowerToys.Settings'. Change either name to eliminate the conflict. Microsoft.Plugin.Shell C:\repos\powertoys\src\modules\launcher\Plugins\Microsoft.Plugin.Shell\Settings.cs 9 Active

* Fix for CA1307: Specify StringComparison & CA1305: Specify IFormatProvider
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1307?view=vs-2019
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1305?view=vs-2019

* Fix for CA1062: Validate arguments of public methods
https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1062?view=vs-2019

* Suppressing CA1031 Modify 'Query' to catch a more specific allowed exception type, or rethrow the exception'
2020-08-21 12:10:41 -07:00

43 lines
1.1 KiB
C#

// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace Microsoft.Plugin.Shell
{
public class ShellPluginSettings
{
public ExecutionShell Shell { get; set; } = ExecutionShell.RunCommand;
// not overriding Win+R
// crutkas we need to earn the right for Win+R override
public bool ReplaceWinR { get; set; }
public bool LeaveShellOpen { get; set; }
public bool RunAsAdministrator { get; set; }
public Dictionary<string, int> Count { get; } = new Dictionary<string, int>();
public void AddCmdHistory(string cmdName)
{
if (Count.ContainsKey(cmdName))
{
Count[cmdName] += 1;
}
else
{
Count.Add(cmdName, 1);
}
}
}
public enum ExecutionShell
{
Cmd = 0,
Powershell = 1,
RunCommand = 2,
}
}