From 4ab1b90d0856acebdb71528e941f9359eb5f02c8 Mon Sep 17 00:00:00 2001
From: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Date: Tue, 24 Nov 2020 07:05:34 +0000
Subject: [PATCH] Fix CA1822: Mark members as static part 2 (#14225)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
---
.../GetEventCommand.cs | 10 +++++-----
.../PdhHelper.cs | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs
index 8db6796e4d..ae362bcfb0 100644
--- a/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Diagnostics/GetEventCommand.cs
@@ -1346,7 +1346,7 @@ namespace Microsoft.PowerShell.Commands
// HandleEventIdHashValue helper for hashtable structured query builder.
// Constructs and returns EventId XPath portion as a string.
//
- private string HandleEventIdHashValue(object value)
+ private static string HandleEventIdHashValue(object value)
{
StringBuilder ret = new();
Array idsArray = value as Array;
@@ -1376,7 +1376,7 @@ namespace Microsoft.PowerShell.Commands
// HandleLevelHashValue helper for hashtable structured query builder.
// Constructs and returns Level XPath portion as a string.
//
- private string HandleLevelHashValue(object value)
+ private static string HandleLevelHashValue(object value)
{
StringBuilder ret = new();
Array levelsArray = value as Array;
@@ -1564,7 +1564,7 @@ namespace Microsoft.PowerShell.Commands
// HandleDataHashValue helper for hashtable structured query builder.
// Constructs and returns EventData/Data XPath portion as a string.
//
- private string HandleDataHashValue(object value)
+ private static string HandleDataHashValue(object value)
{
StringBuilder ret = new();
Array dataArray = value as Array;
@@ -1595,7 +1595,7 @@ namespace Microsoft.PowerShell.Commands
// Constructs and returns named event data field XPath portion as a string.
// Fix Issue #2327
//
- private string HandleNamedDataHashValue(string key, object value)
+ private static string HandleNamedDataHashValue(string key, object value)
{
StringBuilder ret = new();
Array dataArray = value as Array;
@@ -1909,7 +1909,7 @@ namespace Microsoft.PowerShell.Commands
// "System/Provider[@Name='a' or @Name='b']"
// for all provider names specified in the "providers" argument.
//
- private string BuildProvidersPredicate(StringCollection providers)
+ private static string BuildProvidersPredicate(StringCollection providers)
{
if (providers.Count == 0)
{
diff --git a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
index b749efb957..bfc56e8b17 100644
--- a/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
+++ b/src/Microsoft.PowerShell.Commands.Diagnostics/PdhHelper.cs
@@ -429,7 +429,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
///
///
///
- private void ReadPdhMultiString(ref IntPtr strNative, Int32 strSize, ref StringCollection strColl)
+ private static void ReadPdhMultiString(ref IntPtr strNative, Int32 strSize, ref StringCollection strColl)
{
Debug.Assert(strSize >= 2);
int offset = 0;
@@ -452,7 +452,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
strColl.AddRange(allSubstringsWithNulls.Split('\0'));
}
- private uint GetCounterInfoPlus(IntPtr hCounter, out UInt32 counterType, out UInt32 defaultScale, out UInt64 timeBase)
+ private static uint GetCounterInfoPlus(IntPtr hCounter, out UInt32 counterType, out UInt32 defaultScale, out UInt64 timeBase)
{
counterType = 0;
defaultScale = 0;
@@ -824,7 +824,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
return (PdhValidatePathEx(_hDataSource, path) == PdhResults.PDH_CSTATUS_VALID_DATA);
}
- private uint MakePath(PDH_COUNTER_PATH_ELEMENTS pathElts, out string outPath, bool bWildcardInstances)
+ private static uint MakePath(PDH_COUNTER_PATH_ELEMENTS pathElts, out string outPath, bool bWildcardInstances)
{
outPath = string.Empty;
IntPtr pPathBufferSize = new(0);
@@ -861,7 +861,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
return res;
}
- private uint MakeAllInstancePath(string origPath, out string unifiedPath)
+ private static uint MakeAllInstancePath(string origPath, out string unifiedPath)
{
unifiedPath = origPath;
@@ -876,7 +876,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
return MakePath(elts, out unifiedPath, true);
}
- private uint ParsePath(string fullPath, ref PDH_COUNTER_PATH_ELEMENTS pCounterPathElements)
+ private static uint ParsePath(string fullPath, ref PDH_COUNTER_PATH_ELEMENTS pCounterPathElements)
{
IntPtr bufSize = new(0);