Enable IDE0049 PreferBuiltInOrFrameworkType
(#14491)
This commit is contained in:
parent
055b7f3003
commit
0f2f23f67a
|
@ -1314,7 +1314,7 @@ dotnet_diagnostic.IDE0048.severity = suggestion
|
|||
|
||||
# IDE0049: PreferBuiltInOrFrameworkType
|
||||
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0049
|
||||
dotnet_diagnostic.IDE0049.severity = silent
|
||||
dotnet_diagnostic.IDE0049.severity = warning
|
||||
|
||||
# IDE0050: ConvertAnonymousTypeToTuple
|
||||
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0050
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// Initializes a new instance of the <see cref="ParameterSetEntry"/> class.
|
||||
/// </summary>
|
||||
/// <param name="mandatoryParameterCount"></param>
|
||||
internal ParameterSetEntry(UInt32 mandatoryParameterCount)
|
||||
internal ParameterSetEntry(uint mandatoryParameterCount)
|
||||
{
|
||||
this.MandatoryParameterCount = mandatoryParameterCount;
|
||||
this.IsDefaultParameterSet = false;
|
||||
|
@ -80,7 +80,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
/// <param name="mandatoryParameterCount"></param>
|
||||
/// <param name="mandatory"></param>
|
||||
internal ParameterSetEntry(UInt32 mandatoryParameterCount, bool isDefault)
|
||||
internal ParameterSetEntry(uint mandatoryParameterCount, bool isDefault)
|
||||
{
|
||||
this.MandatoryParameterCount = mandatoryParameterCount;
|
||||
this.IsDefaultParameterSet = isDefault;
|
||||
|
@ -104,7 +104,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// Property <c>MandatoryParameterCount</c>
|
||||
/// </summary>
|
||||
internal UInt32 MandatoryParameterCount { get; } = 0;
|
||||
internal uint MandatoryParameterCount { get; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Property <c>IsValueSet</c>
|
||||
|
@ -119,12 +119,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// Property <c>SetMandatoryParameterCount</c>
|
||||
/// </summary>
|
||||
internal UInt32 SetMandatoryParameterCount { get; set; } = 0;
|
||||
internal uint SetMandatoryParameterCount { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Property <c>SetMandatoryParameterCountAtBeginProcess</c>
|
||||
/// </summary>
|
||||
internal UInt32 SetMandatoryParameterCountAtBeginProcess { get; set; } = 0;
|
||||
internal uint SetMandatoryParameterCountAtBeginProcess { get; set; } = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string theNamespace,
|
||||
string queryDialect,
|
||||
string queryExpression,
|
||||
UInt32 operationTimeout)
|
||||
uint operationTimeout)
|
||||
{
|
||||
ValidationHelper.ValidateNoNullorWhiteSpaceArgument(queryExpression, queryExpressionParameterName);
|
||||
computerName = ConstValue.GetComputerName(computerName);
|
||||
|
@ -173,7 +173,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string theNamespace,
|
||||
string queryDialect,
|
||||
string queryExpression,
|
||||
UInt32 operationTimeout)
|
||||
uint operationTimeout)
|
||||
{
|
||||
ValidationHelper.ValidateNoNullorWhiteSpaceArgument(queryExpression, queryExpressionParameterName);
|
||||
ValidationHelper.ValidateNoNullArgument(cimSession, cimSessionParameterName);
|
||||
|
@ -192,7 +192,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string theNameSpace,
|
||||
string theQueryDialect,
|
||||
string theQueryExpression,
|
||||
UInt32 theOperationTimeout)
|
||||
uint theOperationTimeout)
|
||||
{
|
||||
enableRaisingEvents = false;
|
||||
status = Status.Default;
|
||||
|
@ -378,7 +378,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
private string nameSpace;
|
||||
private string queryDialect;
|
||||
private string queryExpression;
|
||||
private UInt32 operationTimeout;
|
||||
private uint operationTimeout;
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string nameSpace,
|
||||
string queryDialect,
|
||||
string queryExpression,
|
||||
UInt32 operationTimeout)
|
||||
uint operationTimeout)
|
||||
{
|
||||
DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression);
|
||||
this.TargetComputerName = computerName;
|
||||
|
@ -146,7 +146,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string nameSpace,
|
||||
string queryDialect,
|
||||
string queryExpression,
|
||||
UInt32 operationTimeout)
|
||||
uint operationTimeout)
|
||||
{
|
||||
DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression);
|
||||
if (cimSession == null)
|
||||
|
@ -317,7 +317,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <returns></returns>
|
||||
private CimSessionProxy CreateSessionProxy(
|
||||
string computerName,
|
||||
UInt32 timeout)
|
||||
uint timeout)
|
||||
{
|
||||
CimSessionProxy proxy = CreateCimSessionProxy(computerName);
|
||||
proxy.OperationTimeout = timeout;
|
||||
|
@ -332,7 +332,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <returns></returns>
|
||||
private CimSessionProxy CreateSessionProxy(
|
||||
CimSession session,
|
||||
UInt32 timeout)
|
||||
uint timeout)
|
||||
{
|
||||
CimSessionProxy proxy = CreateCimSessionProxy(session);
|
||||
proxy.OperationTimeout = timeout;
|
||||
|
|
|
@ -542,11 +542,11 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// Set timeout value (seconds) of the operation.
|
||||
/// </summary>
|
||||
public UInt32 OperationTimeout
|
||||
public uint OperationTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return (UInt32)this.OperationOptions.Timeout.TotalSeconds;
|
||||
return (uint)this.OperationOptions.Timeout.TotalSeconds;
|
||||
}
|
||||
|
||||
set
|
||||
|
@ -821,7 +821,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="message"></param>
|
||||
internal void WriteMessage(UInt32 channel, string message)
|
||||
internal void WriteMessage(uint channel, string message)
|
||||
{
|
||||
DebugHelper.WriteLogEx("Channel = {0} message = {1}", 0, channel, message);
|
||||
try
|
||||
|
@ -863,7 +863,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
CimCmdletStrings.CimOperationStart,
|
||||
operation,
|
||||
(parameters.Length == 0) ? "null" : parameters.ToString());
|
||||
WriteMessage((UInt32)CimWriteMessageChannel.Verbose, operationStartMessage);
|
||||
WriteMessage((uint)CimWriteMessageChannel.Verbose, operationStartMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -878,7 +878,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
string operationCompleteMessage = string.Format(CultureInfo.CurrentUICulture,
|
||||
CimCmdletStrings.CimOperationCompleted,
|
||||
operation);
|
||||
WriteMessage((UInt32)CimWriteMessageChannel.Verbose, operationCompleteMessage);
|
||||
WriteMessage((uint)CimWriteMessageChannel.Verbose, operationCompleteMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -894,8 +894,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
public void WriteProgress(string activity,
|
||||
string currentOperation,
|
||||
string statusDescription,
|
||||
UInt32 percentageCompleted,
|
||||
UInt32 secondsRemaining)
|
||||
uint percentageCompleted,
|
||||
uint secondsRemaining)
|
||||
{
|
||||
DebugHelper.WriteLogEx("activity:{0}; currentOperation:{1}; percentageCompleted:{2}; secondsRemaining:{3}",
|
||||
0, activity, currentOperation, percentageCompleted, secondsRemaining);
|
||||
|
@ -1879,7 +1879,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <param name="credential"></param>
|
||||
/// <returns></returns>
|
||||
internal static CimSessionOptions CreateCimSessionOption(string computerName,
|
||||
UInt32 timeout, CimCredential credential)
|
||||
uint timeout, CimCredential credential)
|
||||
{
|
||||
DebugHelper.WriteLogEx();
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
|
||||
#region Properties
|
||||
|
||||
internal UInt32 Channel { get; }
|
||||
internal uint Channel { get; }
|
||||
|
||||
internal string Message { get; }
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CimWriteMessage"/> class.
|
||||
/// </summary>
|
||||
public CimWriteMessage(UInt32 channel,
|
||||
public CimWriteMessage(uint channel,
|
||||
string message)
|
||||
{
|
||||
this.Channel = channel;
|
||||
|
|
|
@ -40,8 +40,8 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
int theActivityID,
|
||||
string theCurrentOperation,
|
||||
string theStatusDescription,
|
||||
UInt32 thePercentageCompleted,
|
||||
UInt32 theSecondsRemaining)
|
||||
uint thePercentageCompleted,
|
||||
uint theSecondsRemaining)
|
||||
{
|
||||
this.Activity = theActivity;
|
||||
this.ActivityID = theActivityID;
|
||||
|
@ -112,12 +112,12 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// <summary>
|
||||
/// Gets the percentage completed of the given activity.
|
||||
/// </summary>
|
||||
internal UInt32 PercentageCompleted { get; }
|
||||
internal uint PercentageCompleted { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of seconds remaining for the given activity.
|
||||
/// </summary>
|
||||
internal UInt32 SecondsRemaining { get; }
|
||||
internal uint SecondsRemaining { get; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter(ValueFromPipelineByPropertyName = true)]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter(ValueFromPipelineByPropertyName = true)]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "Session".
|
||||
|
|
|
@ -260,7 +260,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>The following is the definition of the input parameter "InputObject".
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
ValueFromPipelineByPropertyName = true,
|
||||
ParameterSetName = SessionIdSet)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public UInt32[] Id
|
||||
public uint[] Id
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
|
||||
private UInt32[] id;
|
||||
private uint[] id;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "InstanceID".
|
||||
|
|
|
@ -373,7 +373,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter(ValueFromPipelineByPropertyName = true)]
|
||||
public UInt32 OperationTimeoutSec
|
||||
public uint OperationTimeoutSec
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
|
||||
private UInt32 operationTimeout;
|
||||
private uint operationTimeout;
|
||||
internal bool operationTimeoutSet = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -136,7 +136,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// This is specificly for wsman protocol.
|
||||
/// </summary>
|
||||
[Parameter(ValueFromPipelineByPropertyName = true)]
|
||||
public UInt32 Port
|
||||
public uint Port
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
|
||||
private UInt32 port;
|
||||
private uint port;
|
||||
private bool portSet = false;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Parameter(ValueFromPipelineByPropertyName = true,
|
||||
ParameterSetName = WSManParameterSet)]
|
||||
public UInt32 MaxEnvelopeSizeKB
|
||||
public uint MaxEnvelopeSizeKB
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -246,7 +246,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
|
||||
private UInt32 maxenvelopesizekb;
|
||||
private uint maxenvelopesizekb;
|
||||
private bool maxenvelopesizekbSet = false;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -124,7 +124,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(CimBaseCommand.AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "Session".
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "InputObject".
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
ValueFromPipelineByPropertyName = true,
|
||||
ParameterSetName = SessionIdSet)]
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public UInt32[] Id
|
||||
public uint[] Id
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
}
|
||||
}
|
||||
|
||||
private UInt32[] id;
|
||||
private uint[] id;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "InstanceId".
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace Microsoft.Management.Infrastructure.CimCmdlets
|
|||
/// </summary>
|
||||
[Alias(AliasOT)]
|
||||
[Parameter]
|
||||
public UInt32 OperationTimeoutSec { get; set; }
|
||||
public uint OperationTimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "InputObject".
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace Microsoft.PowerShell.Commands.Diagnostics.Common
|
|||
[DllImport(LocalizationDllName, EntryPoint = "GetUserDefaultLangID", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||
private static extern ushort GetUserDefaultLangID();
|
||||
|
||||
public static uint FormatMessageFromModule(uint lastError, string moduleName, out String msg)
|
||||
public static uint FormatMessageFromModule(uint lastError, string moduleName, out string msg)
|
||||
{
|
||||
Debug.Assert(!string.IsNullOrEmpty(moduleName));
|
||||
|
||||
uint formatError = 0;
|
||||
msg = String.Empty;
|
||||
msg = string.Empty;
|
||||
|
||||
IntPtr moduleHandle = LoadLibraryEx(moduleName, IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE);
|
||||
if (moduleHandle == IntPtr.Zero)
|
||||
|
|
|
@ -144,8 +144,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
ValueFromPipelineByPropertyName = false,
|
||||
HelpMessageBaseName = "GetEventResources",
|
||||
HelpMessageResourceId = "MaxEventsParamHelp")]
|
||||
[ValidateRange((Int64)1, Int64.MaxValue)]
|
||||
public Int64 MaxEvents { get; set; } = -1;
|
||||
[ValidateRange((long)1, long.MaxValue)]
|
||||
public long MaxEvents { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// ComputerName parameter.
|
||||
|
@ -777,7 +777,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
using (EventLogReader readerObj = new(logQuery))
|
||||
{
|
||||
Int64 numEvents = 0;
|
||||
long numEvents = 0;
|
||||
EventRecord evtObj = null;
|
||||
|
||||
while (true)
|
||||
|
@ -1311,8 +1311,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
//
|
||||
private string HandleKeywordHashValue(object value)
|
||||
{
|
||||
Int64 keywordsMask = 0;
|
||||
Int64 keywordLong = 0;
|
||||
long keywordsMask = 0;
|
||||
long keywordLong = 0;
|
||||
|
||||
Array keywordArray = value as Array;
|
||||
if (keywordArray != null)
|
||||
|
@ -1609,7 +1609,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// Returns true and keyLong ref if successful.
|
||||
// Writes an error and returns false if keyString cannot be converted.
|
||||
//
|
||||
private bool KeywordStringToInt64(string keyString, ref Int64 keyLong)
|
||||
private bool KeywordStringToInt64(string keyString, ref long keyLong)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -374,7 +374,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
return false;
|
||||
}
|
||||
|
||||
UInt16 perceivedSeverityValue = (UInt16)perceivedSeverityProperty.Value;
|
||||
ushort perceivedSeverityValue = (ushort)perceivedSeverityProperty.Value;
|
||||
if (perceivedSeverityValue != 7)
|
||||
{
|
||||
/* from CIM Schema: Interop\CIM_Error.mof:
|
||||
|
|
|
@ -111,7 +111,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
return false;
|
||||
}
|
||||
|
||||
WsManErrorCode wsManErrorCode = (WsManErrorCode)(UInt32)(errorCodeProperty.Value);
|
||||
WsManErrorCode wsManErrorCode = (WsManErrorCode)(uint)(errorCodeProperty.Value);
|
||||
switch (wsManErrorCode) // error codes that should result in sleep-and-retry are based on an email from Ryan
|
||||
{
|
||||
case WsManErrorCode.ERROR_WSMAN_QUOTA_MAX_SHELLS:
|
||||
|
@ -423,11 +423,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
(_jobContext.WarningActionPreference == ActionPreference.Ignore)
|
||||
) && (!_jobContext.IsRunningInBackground))
|
||||
{
|
||||
operationOptions.DisableChannel((UInt32)MessageChannel.Warning);
|
||||
operationOptions.DisableChannel((uint)MessageChannel.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
operationOptions.EnableChannel((UInt32)MessageChannel.Warning);
|
||||
operationOptions.EnableChannel((uint)MessageChannel.Warning);
|
||||
}
|
||||
|
||||
if ((
|
||||
|
@ -435,11 +435,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
(_jobContext.VerboseActionPreference == ActionPreference.Ignore)
|
||||
) && (!_jobContext.IsRunningInBackground))
|
||||
{
|
||||
operationOptions.DisableChannel((UInt32)MessageChannel.Verbose);
|
||||
operationOptions.DisableChannel((uint)MessageChannel.Verbose);
|
||||
}
|
||||
else
|
||||
{
|
||||
operationOptions.EnableChannel((UInt32)MessageChannel.Verbose);
|
||||
operationOptions.EnableChannel((uint)MessageChannel.Verbose);
|
||||
}
|
||||
|
||||
if ((
|
||||
|
@ -447,11 +447,11 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
(_jobContext.DebugActionPreference == ActionPreference.Ignore)
|
||||
) && (!_jobContext.IsRunningInBackground))
|
||||
{
|
||||
operationOptions.DisableChannel((UInt32)MessageChannel.Debug);
|
||||
operationOptions.DisableChannel((uint)MessageChannel.Debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
operationOptions.EnableChannel((UInt32)MessageChannel.Debug);
|
||||
operationOptions.EnableChannel((uint)MessageChannel.Debug);
|
||||
}
|
||||
|
||||
switch (this.JobContext.ShouldProcessOptimization)
|
||||
|
@ -763,7 +763,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
|
||||
#region Handling extended semantics callbacks
|
||||
|
||||
private void WriteProgressCallback(string activity, string currentOperation, string statusDescription, UInt32 percentageCompleted, UInt32 secondsRemaining)
|
||||
private void WriteProgressCallback(string activity, string currentOperation, string statusDescription, uint percentageCompleted, uint secondsRemaining)
|
||||
{
|
||||
if (string.IsNullOrEmpty(activity))
|
||||
{
|
||||
|
@ -775,28 +775,28 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
statusDescription = this.StatusMessage;
|
||||
}
|
||||
|
||||
Int32 signedSecondsRemaining;
|
||||
if (secondsRemaining == UInt32.MaxValue)
|
||||
int signedSecondsRemaining;
|
||||
if (secondsRemaining == uint.MaxValue)
|
||||
{
|
||||
signedSecondsRemaining = -1;
|
||||
}
|
||||
else if (secondsRemaining <= Int32.MaxValue)
|
||||
else if (secondsRemaining <= int.MaxValue)
|
||||
{
|
||||
signedSecondsRemaining = (Int32)secondsRemaining;
|
||||
signedSecondsRemaining = (int)secondsRemaining;
|
||||
}
|
||||
else
|
||||
{
|
||||
signedSecondsRemaining = Int32.MaxValue;
|
||||
signedSecondsRemaining = int.MaxValue;
|
||||
}
|
||||
|
||||
Int32 signedPercentageComplete;
|
||||
if (percentageCompleted == UInt32.MaxValue)
|
||||
int signedPercentageComplete;
|
||||
if (percentageCompleted == uint.MaxValue)
|
||||
{
|
||||
signedPercentageComplete = -1;
|
||||
}
|
||||
else if (percentageCompleted <= 100)
|
||||
{
|
||||
signedPercentageComplete = (Int32)percentageCompleted;
|
||||
signedPercentageComplete = (int)percentageCompleted;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -825,7 +825,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
Debug = 2,
|
||||
}
|
||||
|
||||
private void WriteMessageCallback(UInt32 channel, string message)
|
||||
private void WriteMessageCallback(uint channel, string message)
|
||||
{
|
||||
this.ExceptionSafeWrapper(
|
||||
delegate
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
/// <param name="propertyName">Property name to query on.</param>
|
||||
/// <param name="allowedPropertyValues">Property values to accept in the query.</param>
|
||||
/// <param name="wildcardsEnabled">
|
||||
/// <see langword="true"/> if <paramref name="allowedPropertyValues"/> should be treated as a <see cref="System.String"/> containing a wildcard pattern;
|
||||
/// <see langword="true"/> if <paramref name="allowedPropertyValues"/> should be treated as a <see cref="string"/> containing a wildcard pattern;
|
||||
/// <see langword="false"/> otherwise.
|
||||
/// </param>
|
||||
/// <param name="behaviorOnNoMatch">
|
||||
|
@ -219,7 +219,7 @@ namespace Microsoft.PowerShell.Cmdletization.Cim
|
|||
/// <param name="propertyName">Property name to query on.</param>
|
||||
/// <param name="excludedPropertyValues">Property values to reject in the query.</param>
|
||||
/// <param name="wildcardsEnabled">
|
||||
/// <see langword="true"/> if <paramref name="excludedPropertyValues"/> should be treated as a <see cref="System.String"/> containing a wildcard pattern;
|
||||
/// <see langword="true"/> if <paramref name="excludedPropertyValues"/> should be treated as a <see cref="string"/> containing a wildcard pattern;
|
||||
/// <see langword="false"/> otherwise.
|
||||
/// </param>
|
||||
/// <param name="behaviorOnNoMatch">
|
||||
|
|
|
@ -275,12 +275,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// The specific time interval (in second) to wait between network pings or service queries.
|
||||
/// </summary>
|
||||
[Parameter(ParameterSetName = DefaultParameterSet)]
|
||||
[ValidateRange(1, Int16.MaxValue)]
|
||||
public Int16 Delay
|
||||
[ValidateRange(1, short.MaxValue)]
|
||||
public short Delay
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Int16)_delay;
|
||||
return (short)_delay;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -1125,7 +1125,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// base-indication prefix. For example, the string "0409" will be
|
||||
// parsed into the base-10 integer value 1033, while the string "0x0409"
|
||||
// will fail to parse due to the "0x" base-indication prefix.
|
||||
if (UInt32.TryParse(locale, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint localeNum))
|
||||
if (uint.TryParse(locale, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint localeNum))
|
||||
{
|
||||
culture = CultureInfo.GetCultureInfo((int)localeNum);
|
||||
}
|
||||
|
@ -1231,11 +1231,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
internal static class RegistryInfo
|
||||
{
|
||||
public static Dictionary<string, UInt32> GetServerLevels()
|
||||
public static Dictionary<string, uint> GetServerLevels()
|
||||
{
|
||||
const string keyPath = @"Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels";
|
||||
|
||||
var rv = new Dictionary<string, UInt32>();
|
||||
var rv = new Dictionary<string, uint>();
|
||||
|
||||
using (var key = Registry.LocalMachine.OpenSubKey(keyPath))
|
||||
{
|
||||
|
@ -1373,7 +1373,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
|
||||
internal class WmiBios : WmiClassBase
|
||||
{
|
||||
public UInt16[] BiosCharacteristics;
|
||||
public ushort[] BiosCharacteristics;
|
||||
public string[] BIOSVersion;
|
||||
public string BuildNumber;
|
||||
public string Caption;
|
||||
|
@ -1416,11 +1416,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ushort? BootOptionOnWatchDog;
|
||||
public bool? BootROMSupported;
|
||||
public string BootupState;
|
||||
public UInt16[] BootStatus;
|
||||
public ushort[] BootStatus;
|
||||
public string Caption;
|
||||
public ushort? ChassisBootupState;
|
||||
public string ChassisSKUNumber;
|
||||
public Int16? CurrentTimeZone;
|
||||
public short? CurrentTimeZone;
|
||||
public bool? DaylightInEffect;
|
||||
public string Description;
|
||||
public string DNSHostName;
|
||||
|
@ -1442,10 +1442,10 @@ namespace Microsoft.PowerShell.Commands
|
|||
public uint? NumberOfProcessors;
|
||||
public string[] OEMStringArray;
|
||||
public bool? PartOfDomain;
|
||||
public Int64? PauseAfterReset;
|
||||
public long? PauseAfterReset;
|
||||
public ushort? PCSystemType;
|
||||
public ushort? PCSystemTypeEx;
|
||||
public UInt16[] PowerManagementCapabilities;
|
||||
public ushort[] PowerManagementCapabilities;
|
||||
public bool? PowerManagementSupported;
|
||||
public ushort? PowerOnPasswordStatus;
|
||||
public ushort? PowerState;
|
||||
|
@ -1453,8 +1453,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string PrimaryOwnerContact;
|
||||
public string PrimaryOwnerName;
|
||||
public ushort? ResetCapability;
|
||||
public Int16? ResetCount;
|
||||
public Int16? ResetLimit;
|
||||
public short? ResetCount;
|
||||
public short? ResetLimit;
|
||||
public string[] Roles;
|
||||
public string Status;
|
||||
public string[] SupportContactDescription;
|
||||
|
@ -1491,12 +1491,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
|
||||
internal class WmiDeviceGuard
|
||||
{
|
||||
public UInt32[] AvailableSecurityProperties;
|
||||
public uint[] AvailableSecurityProperties;
|
||||
public uint? CodeIntegrityPolicyEnforcementStatus;
|
||||
public uint? UsermodeCodeIntegrityPolicyEnforcementStatus;
|
||||
public UInt32[] RequiredSecurityProperties;
|
||||
public UInt32[] SecurityServicesConfigured;
|
||||
public UInt32[] SecurityServicesRunning;
|
||||
public uint[] RequiredSecurityProperties;
|
||||
public uint[] SecurityServicesConfigured;
|
||||
public uint[] SecurityServicesRunning;
|
||||
public uint? VirtualizationBasedSecurityStatus;
|
||||
|
||||
public DeviceGuard AsOutputType
|
||||
|
@ -1582,7 +1582,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public ushort? NumberOfFunctionKeys;
|
||||
public ushort? Password;
|
||||
public string PNPDeviceID;
|
||||
public UInt16[] PowerManagementCapabilities;
|
||||
public ushort[] PowerManagementCapabilities;
|
||||
public bool? PowerManagementSupported;
|
||||
public string Status;
|
||||
public ushort? StatusInfo;
|
||||
|
@ -1613,7 +1613,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string ErrorDescription;
|
||||
public uint? LastErrorCode;
|
||||
public string PNPDeviceID;
|
||||
public UInt16[] PowerManagementCapabilities;
|
||||
public ushort[] PowerManagementCapabilities;
|
||||
public bool? PowerManagementSupported;
|
||||
public ushort? StatusInfo;
|
||||
public string SystemCreationClassName;
|
||||
|
@ -1680,8 +1680,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string PnPDeviceID;
|
||||
public string DriverProvider;
|
||||
public string ComponentID;
|
||||
public UInt32[] LowerLayerInterfaceIndices;
|
||||
public UInt32[] HigherLayerInterfaceIndices;
|
||||
public uint[] LowerLayerInterfaceIndices;
|
||||
public uint[] HigherLayerInterfaceIndices;
|
||||
public bool? AdminLocked;
|
||||
}
|
||||
|
||||
|
@ -1717,7 +1717,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string PermanentAddress;
|
||||
public bool? PhysicalAdapter;
|
||||
public string PNPDeviceID;
|
||||
public UInt16[] PowerManagementCapabilities;
|
||||
public ushort[] PowerManagementCapabilities;
|
||||
public bool? PowerManagementSupported;
|
||||
public string ProductName;
|
||||
public string ServiceName;
|
||||
|
@ -1753,7 +1753,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public bool? DomainDNSRegistrationEnabled;
|
||||
public uint? ForwardBufferMemory;
|
||||
public bool? FullDNSRegistrationEnabled;
|
||||
public UInt16[] GatewayCostMetric;
|
||||
public ushort[] GatewayCostMetric;
|
||||
public byte? IGMPLevel;
|
||||
public uint? Index;
|
||||
public uint? InterfaceIndex;
|
||||
|
@ -1769,7 +1769,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public bool? IPUseZeroBroadcast;
|
||||
public string IPXAddress;
|
||||
public bool? IPXEnabled;
|
||||
public UInt32[] IPXFrameType;
|
||||
public uint[] IPXFrameType;
|
||||
public uint? IPXMediaType;
|
||||
public string[] IPXNetworkNumber;
|
||||
public string IPXVirtualNetNumber;
|
||||
|
@ -1807,7 +1807,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string CountryCode;
|
||||
public string CSDVersion;
|
||||
public string CSName;
|
||||
public Int16? CurrentTimeZone;
|
||||
public short? CurrentTimeZone;
|
||||
public bool? DataExecutionPrevention_Available;
|
||||
public bool? DataExecutionPrevention_32BitApplications;
|
||||
public bool? DataExecutionPrevention_Drivers;
|
||||
|
@ -1894,7 +1894,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
var list = new List<OSProductSuite>();
|
||||
|
||||
foreach (OSProductSuite suite in Enum.GetValues(typeof(OSProductSuite)))
|
||||
if ((mask & (UInt32)suite) != 0)
|
||||
if ((mask & (uint)suite) != 0)
|
||||
list.Add(suite);
|
||||
|
||||
return list.ToArray();
|
||||
|
@ -1954,7 +1954,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public string OtherFamilyDescription;
|
||||
public string PartNumber;
|
||||
public string PNPDeviceID;
|
||||
public UInt16[] PowerManagementCapabilities;
|
||||
public ushort[] PowerManagementCapabilities;
|
||||
public bool? PowerManagementSupported;
|
||||
public string ProcessorId;
|
||||
public ushort? ProcessorType;
|
||||
|
@ -2282,7 +2282,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// the System Management BIOS Reference Specification.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public UInt16[] BiosCharacteristics { get; internal set; }
|
||||
public ushort[] BiosCharacteristics { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Array of the complete system BIOS information. In many computers
|
||||
|
@ -2320,12 +2320,12 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// Major version of the embedded controller firmware.
|
||||
/// </summary>
|
||||
public Int16? BiosEmbeddedControllerMajorVersion { get; internal set; }
|
||||
public short? BiosEmbeddedControllerMajorVersion { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minor version of the embedded controller firmware.
|
||||
/// </summary>
|
||||
public Int16? BiosEmbeddedControllerMinorVersion { get; internal set; }
|
||||
public short? BiosEmbeddedControllerMinorVersion { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Firmware type of the local computer.
|
||||
|
@ -2496,7 +2496,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Status and Additional Data fields that identify the boot status.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
|
||||
public UInt16[] CsBootStatus { get; internal set; }
|
||||
public ushort[] CsBootStatus { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// System is started. Fail-safe boot bypasses the user startup files—also called SafeBoot.
|
||||
|
@ -2524,7 +2524,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Amount of time the unitary computer system is offset from Coordinated
|
||||
/// Universal Time (UTC).
|
||||
/// </summary>
|
||||
public Int16? CsCurrentTimeZone { get; internal set; }
|
||||
public short? CsCurrentTimeZone { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// If True, the daylight savings mode is ON.
|
||||
|
@ -2675,7 +2675,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// and automatic system reset. A value of –1 (minus one) indicates that
|
||||
/// the pause value is unknown.
|
||||
/// </summary>
|
||||
public Int64? CsPauseAfterReset { get; internal set; }
|
||||
public long? CsPauseAfterReset { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Type of the computer in use, such as laptop, desktop, or tablet.
|
||||
|
@ -2743,13 +2743,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Number of automatic resets since the last reset.
|
||||
/// A value of –1 (minus one) indicates that the count is unknown.
|
||||
/// </summary>
|
||||
public Int16? CsResetCount { get; internal set; }
|
||||
public short? CsResetCount { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of consecutive times a system reset is attempted.
|
||||
/// A value of –1 (minus one) indicates that the limit is unknown.
|
||||
/// </summary>
|
||||
public Int16? CsResetLimit { get; internal set; }
|
||||
public short? CsResetLimit { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Array that specifies the roles of a system in the information
|
||||
|
@ -2909,7 +2909,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Number, in minutes, an operating system is offset from Greenwich
|
||||
/// mean time (GMT). The number is positive, negative, or zero.
|
||||
/// </summary>
|
||||
public Int16? OsCurrentTimeZone { get; internal set; }
|
||||
public short? OsCurrentTimeZone { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Language identifier used by the operating system.
|
||||
|
@ -5099,7 +5099,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
public const uint POWER_PLATFORM_ROLE_V1 = 0x1;
|
||||
public const uint POWER_PLATFORM_ROLE_V2 = 0x2;
|
||||
|
||||
public const UInt32 S_OK = 0;
|
||||
public const uint S_OK = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Import WINAPI function PowerDeterminePlatformRoleEx.
|
||||
|
|
|
@ -32,8 +32,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
public int SyncWindow { get; set; } = Int32.MaxValue;
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int SyncWindow { get; set; } = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <!-- author: LukaszA -->
|
||||
[Cmdlet(VerbsCommon.Get, "Random", DefaultParameterSetName = GetRandomCommand.RandomNumberParameterSet,
|
||||
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097016", RemotingCapability = RemotingCapability.None)]
|
||||
[OutputType(typeof(Int32), typeof(Int64), typeof(double))]
|
||||
[OutputType(typeof(int), typeof(long), typeof(double))]
|
||||
public class GetRandomCommand : PSCmdlet
|
||||
{
|
||||
#region Parameter set handling
|
||||
|
@ -229,7 +229,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static bool IsInt64(object o)
|
||||
{
|
||||
if (o == null || o is Int64)
|
||||
if (o == null || o is long)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -348,11 +348,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="minValue"></param>
|
||||
/// <param name="maxValue"></param>
|
||||
/// <returns></returns>
|
||||
private Int64 GetRandomInt64(Int64 minValue, Int64 maxValue)
|
||||
private long GetRandomInt64(long minValue, long maxValue)
|
||||
{
|
||||
// Randomly generate eight bytes and convert the byte array to UInt64
|
||||
var buffer = new byte[sizeof(UInt64)];
|
||||
UInt64 randomUint64;
|
||||
var buffer = new byte[sizeof(ulong)];
|
||||
ulong randomUint64;
|
||||
|
||||
BigInteger bigIntegerDiff = (BigInteger)maxValue - (BigInteger)minValue;
|
||||
|
||||
|
@ -364,17 +364,17 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
|
||||
// The difference of two Int64 numbers would not exceed UInt64.MaxValue, so it can be represented by a UInt64 number.
|
||||
UInt64 uint64Diff = (UInt64)bigIntegerDiff;
|
||||
ulong uint64Diff = (ulong)bigIntegerDiff;
|
||||
|
||||
// Calculate the number of bits to represent the diff in type UInt64
|
||||
int bitsToRepresentDiff = 0;
|
||||
UInt64 diffCopy = uint64Diff;
|
||||
ulong diffCopy = uint64Diff;
|
||||
for (; diffCopy != 0; bitsToRepresentDiff++)
|
||||
{
|
||||
diffCopy >>= 1;
|
||||
}
|
||||
// Get the mask for the number of bits
|
||||
UInt64 mask = (0xffffffffffffffff >> (64 - bitsToRepresentDiff));
|
||||
ulong mask = (0xffffffffffffffff >> (64 - bitsToRepresentDiff));
|
||||
do
|
||||
{
|
||||
// Randomly fill the buffer
|
||||
|
@ -386,7 +386,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
} while (uint64Diff <= randomUint64);
|
||||
|
||||
double randomNumber = minValue * 1.0 + randomUint64 * 1.0;
|
||||
return (Int64)randomNumber;
|
||||
return (long)randomNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -425,8 +425,8 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
else if ((IsInt64(maxOperand) || IsInt(maxOperand)) && (IsInt64(minOperand) || IsInt(minOperand)))
|
||||
{
|
||||
Int64 minValue = minOperand != null ? ((minOperand is Int64) ? (Int64)minOperand : (int)minOperand) : 0;
|
||||
Int64 maxValue = maxOperand != null ? ((maxOperand is Int64) ? (Int64)maxOperand : (int)maxOperand) : Int64.MaxValue;
|
||||
long minValue = minOperand != null ? ((minOperand is long) ? (long)minOperand : (int)minOperand) : 0;
|
||||
long maxValue = maxOperand != null ? ((maxOperand is long) ? (long)maxOperand : (int)maxOperand) : long.MaxValue;
|
||||
|
||||
if (minValue >= maxValue)
|
||||
{
|
||||
|
@ -435,7 +435,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
Int64 randomNumber = GetRandomInt64(minValue, maxValue);
|
||||
long randomNumber = GetRandomInt64(minValue, maxValue);
|
||||
Debug.Assert(minValue <= randomNumber, "lower bound <= random number");
|
||||
Debug.Assert(randomNumber < maxValue, "random number < upper bound");
|
||||
|
||||
|
@ -608,7 +608,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
// According to the CLR source:
|
||||
// "Including this division at the end gives us significantly improved random number distribution."
|
||||
return Next() * (1.0 / Int32.MaxValue);
|
||||
return Next() * (1.0 / int.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -626,11 +626,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
randomNumber = InternalSample();
|
||||
}
|
||||
while (randomNumber == Int32.MaxValue);
|
||||
while (randomNumber == int.MaxValue);
|
||||
|
||||
if (randomNumber < 0)
|
||||
{
|
||||
randomNumber += Int32.MaxValue;
|
||||
randomNumber += int.MaxValue;
|
||||
}
|
||||
|
||||
return randomNumber;
|
||||
|
@ -673,7 +673,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
else
|
||||
{
|
||||
double largeSample = InternalSampleLargeRange() * (1.0 / (2 * ((uint)Int32.MaxValue)));
|
||||
double largeSample = InternalSampleLargeRange() * (1.0 / (2 * ((uint)int.MaxValue)));
|
||||
randomNumber = (int)((long)(largeSample * range) + minValue);
|
||||
}
|
||||
|
||||
|
@ -724,9 +724,9 @@ namespace Microsoft.PowerShell.Commands
|
|||
do
|
||||
{
|
||||
randomNumber = InternalSample();
|
||||
} while (randomNumber == Int32.MaxValue);
|
||||
} while (randomNumber == int.MaxValue);
|
||||
|
||||
randomNumber += Int32.MaxValue;
|
||||
randomNumber += int.MaxValue;
|
||||
return randomNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
{
|
||||
CSVHelper csvHelper = new(',');
|
||||
|
||||
Int64 lineNumber = 0;
|
||||
long lineNumber = 0;
|
||||
string line = null;
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
|
|
|
@ -1376,7 +1376,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
[Parameter]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateCount(1, 2)]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public new int[] Context
|
||||
{
|
||||
get => _context;
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Value must be greater than zero.
|
||||
/// </remarks>
|
||||
[Parameter(ValueFromPipelineByPropertyName = true)]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int Port { get; set; }
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -78,13 +78,13 @@ namespace Microsoft.PowerShell.Commands
|
|||
#else
|
||||
// build up the SystemTime struct to pass to SetSystemTime
|
||||
NativeMethods.SystemTime systemTime = new();
|
||||
systemTime.Year = (UInt16)dateToUse.Year;
|
||||
systemTime.Month = (UInt16)dateToUse.Month;
|
||||
systemTime.Day = (UInt16)dateToUse.Day;
|
||||
systemTime.Hour = (UInt16)dateToUse.Hour;
|
||||
systemTime.Minute = (UInt16)dateToUse.Minute;
|
||||
systemTime.Second = (UInt16)dateToUse.Second;
|
||||
systemTime.Milliseconds = (UInt16)dateToUse.Millisecond;
|
||||
systemTime.Year = (ushort)dateToUse.Year;
|
||||
systemTime.Month = (ushort)dateToUse.Month;
|
||||
systemTime.Day = (ushort)dateToUse.Day;
|
||||
systemTime.Hour = (ushort)dateToUse.Hour;
|
||||
systemTime.Minute = (ushort)dateToUse.Minute;
|
||||
systemTime.Second = (ushort)dateToUse.Second;
|
||||
systemTime.Milliseconds = (ushort)dateToUse.Millisecond;
|
||||
#pragma warning disable 56523
|
||||
if (!NativeMethods.SetLocalTime(ref systemTime))
|
||||
{
|
||||
|
@ -118,14 +118,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct SystemTime
|
||||
{
|
||||
public UInt16 Year;
|
||||
public UInt16 Month;
|
||||
public UInt16 DayOfWeek;
|
||||
public UInt16 Day;
|
||||
public UInt16 Hour;
|
||||
public UInt16 Minute;
|
||||
public UInt16 Second;
|
||||
public UInt16 Milliseconds;
|
||||
public ushort Year;
|
||||
public ushort Month;
|
||||
public ushort DayOfWeek;
|
||||
public ushort Day;
|
||||
public ushort Hour;
|
||||
public ushort Minute;
|
||||
public ushort Second;
|
||||
public ushort Milliseconds;
|
||||
}
|
||||
|
||||
[DllImport(PinvokeDllNames.SetLocalTimeDllName, SetLastError = true)]
|
||||
|
|
|
@ -75,14 +75,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets or sets the Width.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(300, Int32.MaxValue)]
|
||||
[ValidateRange(300, int.MaxValue)]
|
||||
public double Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Width.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(300, Int32.MaxValue)]
|
||||
[ValidateRange(300, int.MaxValue)]
|
||||
public double Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -188,11 +188,11 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets the Offset address to be used while displaying the bytes in the collection.
|
||||
/// </summary>
|
||||
[Obsolete("The property is deprecated, please use Offset64 instead.", true)]
|
||||
public UInt32 Offset
|
||||
public uint Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return (UInt32)Offset64;
|
||||
return (uint)Offset64;
|
||||
}
|
||||
|
||||
private set
|
||||
|
@ -204,7 +204,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// Gets the Offset address to be used while displaying the bytes in the collection.
|
||||
/// </summary>
|
||||
public UInt64 Offset64 { get; private set; }
|
||||
public ulong Offset64 { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets underlying bytes stored in the collection.
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
[Parameter]
|
||||
[Alias("TimeoutSec")]
|
||||
[ValidateRangeAttribute(-1, Int32.MaxValue)]
|
||||
[ValidateRangeAttribute(-1, int.MaxValue)]
|
||||
public int Timeout
|
||||
{
|
||||
get
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
[Parameter]
|
||||
[Alias("ML")]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int MaximumFollowRelLink
|
||||
{
|
||||
get { return base._maximumFollowRelLink; }
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets or sets the TimeOut property.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public virtual int TimeoutSec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -224,7 +224,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets or sets the RedirectMax property.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public virtual int MaximumRedirection
|
||||
{
|
||||
get { return _maximumRedirection; }
|
||||
|
@ -238,14 +238,14 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets or sets the MaximumRetryCount property, which determines the number of retries of a failed web request.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public virtual int MaximumRetryCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RetryIntervalSec property, which determines the number seconds between retries.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public virtual int RetryIntervalSec { get; set; } = 5;
|
||||
|
||||
#endregion
|
||||
|
@ -940,7 +940,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <summary>
|
||||
/// Maximum number of Rel Links to follow.
|
||||
/// </summary>
|
||||
internal int _maximumFollowRelLink = Int32.MaxValue;
|
||||
internal int _maximumFollowRelLink = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// The remote endpoint returned a 206 status code indicating successful resume.
|
||||
|
|
|
@ -551,7 +551,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
// Win8:378368 Enums based on System.Int64 or System.UInt64 are not JSON-serializable
|
||||
// because JavaScript does not support the necessary precision.
|
||||
Type enumUnderlyingType = Enum.GetUnderlyingType(obj.GetType());
|
||||
if (enumUnderlyingType.Equals(typeof(Int64)) || enumUnderlyingType.Equals(typeof(UInt64)))
|
||||
if (enumUnderlyingType.Equals(typeof(long)) || enumUnderlyingType.Equals(typeof(ulong)))
|
||||
{
|
||||
rv = obj.ToString();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Uniquely identifies this activity for purposes of chaining subordinate activities.
|
||||
/// </summary>
|
||||
[Parameter(Position = 2)]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -62,7 +62,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Identifies the parent Id of this activity, or -1 if none.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
[ValidateRange(-1, Int32.MaxValue)]
|
||||
[ValidateRange(-1, int.MaxValue)]
|
||||
public int ParentId { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -20,20 +20,20 @@ namespace Microsoft.PowerShell
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct StartUpInfo
|
||||
{
|
||||
public readonly UInt32 cb;
|
||||
public readonly uint cb;
|
||||
private readonly IntPtr lpReserved;
|
||||
public readonly IntPtr lpDesktop;
|
||||
public readonly IntPtr lpTitle;
|
||||
public readonly UInt32 dwX;
|
||||
public readonly UInt32 dwY;
|
||||
public readonly UInt32 dwXSize;
|
||||
public readonly UInt32 dwYSize;
|
||||
public readonly UInt32 dwXCountChars;
|
||||
public readonly UInt32 dwYCountChars;
|
||||
public readonly UInt32 dwFillAttribute;
|
||||
public readonly UInt32 dwFlags;
|
||||
public readonly UInt16 wShowWindow;
|
||||
private readonly UInt16 cbReserved2;
|
||||
public readonly uint dwX;
|
||||
public readonly uint dwY;
|
||||
public readonly uint dwXSize;
|
||||
public readonly uint dwYSize;
|
||||
public readonly uint dwXCountChars;
|
||||
public readonly uint dwYCountChars;
|
||||
public readonly uint dwFillAttribute;
|
||||
public readonly uint dwFlags;
|
||||
public readonly ushort wShowWindow;
|
||||
private readonly ushort cbReserved2;
|
||||
private readonly IntPtr lpReserved2;
|
||||
public readonly IntPtr hStdInput;
|
||||
public readonly IntPtr hStdOutput;
|
||||
|
@ -248,13 +248,13 @@ namespace Microsoft.PowerShell
|
|||
internal interface IShellLinkDataListW
|
||||
{
|
||||
[PreserveSig]
|
||||
Int32 AddDataBlock(IntPtr pDataBlock);
|
||||
int AddDataBlock(IntPtr pDataBlock);
|
||||
|
||||
[PreserveSig]
|
||||
Int32 CopyDataBlock(UInt32 dwSig, out IntPtr ppDataBlock);
|
||||
int CopyDataBlock(uint dwSig, out IntPtr ppDataBlock);
|
||||
|
||||
[PreserveSig]
|
||||
Int32 RemoveDataBlock(UInt32 dwSig);
|
||||
int RemoveDataBlock(uint dwSig);
|
||||
|
||||
void GetFlags(out uint pdwFlags);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Microsoft.PowerShell
|
|||
/// <summary>
|
||||
/// Property identifier (PID)
|
||||
/// </summary>
|
||||
public Int32 PropertyId { get; }
|
||||
public int PropertyId { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace Microsoft.PowerShell
|
|||
/// </summary>
|
||||
/// <param name="formatId">A unique GUID for the property.</param>
|
||||
/// <param name="propertyId">Property identifier (PID).</param>
|
||||
internal PropertyKey(Guid formatId, Int32 propertyId)
|
||||
internal PropertyKey(Guid formatId, int propertyId)
|
||||
{
|
||||
this.FormatId = formatId;
|
||||
this.PropertyId = propertyId;
|
||||
|
|
|
@ -275,13 +275,13 @@ namespace Microsoft.PowerShell
|
|||
/// The absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlags member.
|
||||
/// Absolute data is specified as the x coordinate of the mouse; relative data is specified as the number of pixels moved.
|
||||
/// </summary>
|
||||
internal Int32 X;
|
||||
internal int X;
|
||||
|
||||
/// <summary>
|
||||
/// The absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the value of the dwFlags member.
|
||||
/// Absolute data is specified as the y coordinate of the mouse; relative data is specified as the number of pixels moved.
|
||||
/// </summary>
|
||||
internal Int32 Y;
|
||||
internal int Y;
|
||||
|
||||
/// <summary>
|
||||
/// If dwFlags contains MOUSEEVENTF_WHEEL, then mouseData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user;
|
||||
|
@ -450,7 +450,7 @@ namespace Microsoft.PowerShell
|
|||
/// <returns>True if it was successful.</returns>
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow);
|
||||
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
internal static void SetConsoleMode(ProcessWindowStyle style)
|
||||
{
|
||||
|
@ -3175,7 +3175,7 @@ namespace Microsoft.PowerShell
|
|||
);
|
||||
|
||||
[DllImport(PinvokeDllNames.SendInputDllName, SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
internal static extern UInt32 SendInput(UInt32 inputNumbers, INPUT[] inputs, Int32 sizeOfInput);
|
||||
internal static extern UInt32 SendInput(UInt32 inputNumbers, INPUT[] inputs, int sizeOfInput);
|
||||
|
||||
// There is no GetCurrentConsoleFontEx on Core
|
||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
|
|
|
@ -1338,7 +1338,7 @@ namespace Microsoft.PowerShell
|
|||
/// <summary>
|
||||
/// Invoked by CommandBase.WriteProgress to display a progress record.
|
||||
/// </summary>
|
||||
public override void WriteProgress(Int64 sourceId, ProgressRecord record)
|
||||
public override void WriteProgress(long sourceId, ProgressRecord record)
|
||||
{
|
||||
Dbg.Assert(record != null, "WriteProgress called with null ProgressRecord");
|
||||
|
||||
|
@ -2116,20 +2116,20 @@ namespace Microsoft.PowerShell
|
|||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
var down = new ConsoleControl.INPUT();
|
||||
down.Type = (UInt32)ConsoleControl.InputType.Keyboard;
|
||||
down.Type = (uint)ConsoleControl.InputType.Keyboard;
|
||||
down.Data.Keyboard = new ConsoleControl.KeyboardInput();
|
||||
down.Data.Keyboard.Vk = (UInt16)ConsoleControl.VirtualKeyCode.Left;
|
||||
down.Data.Keyboard.Vk = (ushort)ConsoleControl.VirtualKeyCode.Left;
|
||||
down.Data.Keyboard.Scan = 0;
|
||||
down.Data.Keyboard.Flags = 0;
|
||||
down.Data.Keyboard.Time = 0;
|
||||
down.Data.Keyboard.ExtraInfo = IntPtr.Zero;
|
||||
|
||||
var up = new ConsoleControl.INPUT();
|
||||
up.Type = (UInt32)ConsoleControl.InputType.Keyboard;
|
||||
up.Type = (uint)ConsoleControl.InputType.Keyboard;
|
||||
up.Data.Keyboard = new ConsoleControl.KeyboardInput();
|
||||
up.Data.Keyboard.Vk = (UInt16)ConsoleControl.VirtualKeyCode.Left;
|
||||
up.Data.Keyboard.Vk = (ushort)ConsoleControl.VirtualKeyCode.Left;
|
||||
up.Data.Keyboard.Scan = 0;
|
||||
up.Data.Keyboard.Flags = (UInt32)ConsoleControl.KeyboardFlag.KeyUp;
|
||||
up.Data.Keyboard.Flags = (uint)ConsoleControl.KeyboardFlag.KeyUp;
|
||||
up.Data.Keyboard.Time = 0;
|
||||
up.Data.Keyboard.ExtraInfo = IntPtr.Zero;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Microsoft.PowerShell
|
|||
/// </summary>
|
||||
private
|
||||
void
|
||||
HandleIncomingProgressRecord(Int64 sourceId, ProgressRecord record)
|
||||
HandleIncomingProgressRecord(long sourceId, ProgressRecord record)
|
||||
{
|
||||
Dbg.Assert(record != null, "record should not be null");
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Microsoft.PowerShell
|
|||
/// </param>
|
||||
internal
|
||||
void
|
||||
Update(Int64 sourceId, ProgressRecord record)
|
||||
Update(long sourceId, ProgressRecord record)
|
||||
{
|
||||
Dbg.Assert(record != null, "record should not be null");
|
||||
|
||||
|
@ -357,7 +357,7 @@ namespace Microsoft.PowerShell
|
|||
/// </summary>
|
||||
private
|
||||
ProgressNode
|
||||
FindNodeById(Int64 sourceId, int activityId)
|
||||
FindNodeById(long sourceId, int activityId)
|
||||
{
|
||||
ArrayList listWhereFound = null;
|
||||
int indexWhereFound = -1;
|
||||
|
@ -368,7 +368,7 @@ namespace Microsoft.PowerShell
|
|||
private sealed class FindByIdNodeVisitor : NodeVisitor
|
||||
{
|
||||
internal
|
||||
FindByIdNodeVisitor(Int64 sourceIdToFind, int activityIdToFind)
|
||||
FindByIdNodeVisitor(long sourceIdToFind, int activityIdToFind)
|
||||
{
|
||||
_sourceIdToFind = sourceIdToFind;
|
||||
_idToFind = activityIdToFind;
|
||||
|
@ -402,7 +402,7 @@ namespace Microsoft.PowerShell
|
|||
IndexWhereFound = -1;
|
||||
|
||||
private readonly int _idToFind = -1;
|
||||
private readonly Int64 _sourceIdToFind;
|
||||
private readonly long _sourceIdToFind;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -426,7 +426,7 @@ namespace Microsoft.PowerShell
|
|||
/// </returns>
|
||||
private
|
||||
ProgressNode
|
||||
FindNodeById(Int64 sourceId, int activityId, out ArrayList listWhereFound, out int indexWhereFound)
|
||||
FindNodeById(long sourceId, int activityId, out ArrayList listWhereFound, out int indexWhereFound)
|
||||
{
|
||||
listWhereFound = null;
|
||||
indexWhereFound = -1;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace Microsoft.PowerShell
|
|||
/// Constructs an instance from a ProgressRecord.
|
||||
/// </summary>
|
||||
internal
|
||||
ProgressNode(Int64 sourceId, ProgressRecord record)
|
||||
ProgressNode(long sourceId, ProgressRecord record)
|
||||
: base(record.ActivityId, record.Activity, record.StatusDescription)
|
||||
{
|
||||
Dbg.Assert(record.RecordType == ProgressRecordType.Processing, "should only create node for Processing records");
|
||||
|
@ -485,7 +485,7 @@ namespace Microsoft.PowerShell
|
|||
/// Identifies the source of the progress record.
|
||||
/// </summary>
|
||||
internal
|
||||
Int64
|
||||
long
|
||||
SourceId;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -331,10 +331,10 @@ namespace System.Diagnostics.Eventing
|
|||
*uintptr = (uint)data;
|
||||
dataDescriptor->DataPointer = (ulong)uintptr;
|
||||
}
|
||||
else if (data is UInt64)
|
||||
else if (data is ulong)
|
||||
{
|
||||
dataDescriptor->Size = (uint)sizeof(ulong);
|
||||
UInt64* ulongptr = (ulong*)dataBuffer;
|
||||
ulong* ulongptr = (ulong*)dataBuffer;
|
||||
*ulongptr = (ulong)data;
|
||||
dataDescriptor->DataPointer = (ulong)ulongptr;
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
|
||||
[System.Security.SecurityCritical]
|
||||
public static EventLogHandle EvtCreateRenderContext(
|
||||
Int32 valuePathsCount,
|
||||
int valuePathsCount,
|
||||
string[] valuePaths,
|
||||
UnsafeNativeMethods.EvtRenderContextFlags flags)
|
||||
{
|
||||
|
@ -939,7 +939,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
break;
|
||||
}
|
||||
|
||||
pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal)));
|
||||
pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal)));
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
@ -984,7 +984,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
{
|
||||
UnsafeNativeMethods.EvtVariant varVal = Marshal.PtrToStructure<UnsafeNativeMethods.EvtVariant>(pointer);
|
||||
valuesList.Add(ConvertToObject(varVal));
|
||||
pointer = new IntPtr(((Int64)pointer + Marshal.SizeOf(varVal)));
|
||||
pointer = new IntPtr(((long)pointer + Marshal.SizeOf(varVal)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1106,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
break;
|
||||
keywordsList.Add(s);
|
||||
// nr of bytes = # chars * 2 + 2 bytes for character '\0'.
|
||||
pointer = new IntPtr((Int64)pointer + (s.Length * 2) + 2);
|
||||
pointer = new IntPtr((long)pointer + (s.Length * 2) + 2);
|
||||
}
|
||||
|
||||
return keywordsList.AsReadOnly();
|
||||
|
@ -1270,23 +1270,23 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
Marshal.Copy(val.Reference, arByte, 0, (int)val.Count);
|
||||
return arByte;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt16):
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int16>();
|
||||
Int16[] arInt16 = new Int16[val.Count];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<short>();
|
||||
short[] arInt16 = new short[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt16, 0, (int)val.Count);
|
||||
return arInt16;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt32):
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int32>();
|
||||
Int32[] arInt32 = new Int32[val.Count];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<int>();
|
||||
int[] arInt32 = new int[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt32, 0, (int)val.Count);
|
||||
return arInt32;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeInt64):
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Int64>();
|
||||
Int64[] arInt64 = new Int64[val.Count];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<long>();
|
||||
long[] arInt64 = new long[val.Count];
|
||||
Marshal.Copy(val.Reference, arInt64, 0, (int)val.Count);
|
||||
return arInt64;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSingle):
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<Single>();
|
||||
Single[] arSingle = new Single[val.Count];
|
||||
if (val.Reference == IntPtr.Zero) return Array.Empty<float>();
|
||||
float[] arSingle = new float[val.Count];
|
||||
Marshal.Copy(val.Reference, arSingle, 0, (int)val.Count);
|
||||
return arSingle;
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeDouble):
|
||||
|
@ -1297,13 +1297,13 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeSByte):
|
||||
return ConvertToArray<sbyte>(val, sizeof(sbyte)); // not CLS-compliant
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt16):
|
||||
return ConvertToArray<UInt16>(val, sizeof(UInt16));
|
||||
return ConvertToArray<ushort>(val, sizeof(ushort));
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt64):
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeHexInt64):
|
||||
return ConvertToArray<UInt64>(val, sizeof(UInt64));
|
||||
return ConvertToArray<ulong>(val, sizeof(ulong));
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeUInt32):
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeHexInt32):
|
||||
return ConvertToArray<UInt32>(val, sizeof(UInt32));
|
||||
return ConvertToArray<uint>(val, sizeof(uint));
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeString):
|
||||
return ConvertToStringArray(val, false);
|
||||
case ((int)UnsafeNativeMethods.EvtMasks.EVT_VARIANT_TYPE_ARRAY | (int)UnsafeNativeMethods.EvtVariantType.EvtVarTypeAnsiString):
|
||||
|
@ -1375,7 +1375,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
for (int i = 0; i < val.Count; i++)
|
||||
{
|
||||
array.SetValue(Marshal.PtrToStructure<T>(ptr), i);
|
||||
ptr = new IntPtr((Int64)ptr + size);
|
||||
ptr = new IntPtr((long)ptr + size);
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -1398,7 +1398,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
{
|
||||
bool value = Marshal.ReadInt32(ptr) != 0;
|
||||
array[i] = value;
|
||||
ptr = new IntPtr((Int64)ptr + 4);
|
||||
ptr = new IntPtr((long)ptr + 4);
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -1419,7 +1419,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
for (int i = 0; i < val.Count; i++)
|
||||
{
|
||||
array[i] = DateTime.FromFileTime(Marshal.ReadInt64(ptr));
|
||||
ptr = new IntPtr((Int64)ptr + 8 * sizeof(byte)); // FILETIME values are 8 bytes
|
||||
ptr = new IntPtr((long)ptr + 8 * sizeof(byte)); // FILETIME values are 8 bytes
|
||||
}
|
||||
|
||||
return array;
|
||||
|
@ -1441,7 +1441,7 @@ namespace System.Diagnostics.Eventing.Reader
|
|||
{
|
||||
UnsafeNativeMethods.SystemTime sysTime = Marshal.PtrToStructure<UnsafeNativeMethods.SystemTime>(ptr);
|
||||
array[i] = new DateTime(sysTime.Year, sysTime.Month, sysTime.Day, sysTime.Hour, sysTime.Minute, sysTime.Second, sysTime.Milliseconds);
|
||||
ptr = new IntPtr((Int64)ptr + 16 * sizeof(byte)); // SystemTime values are 16 bytes
|
||||
ptr = new IntPtr((long)ptr + 16 * sizeof(byte)); // SystemTime values are 16 bytes
|
||||
}
|
||||
|
||||
return array;
|
||||
|
|
|
@ -268,10 +268,10 @@ namespace System.Diagnostics.Eventing
|
|||
internal struct EvtVariant
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public UInt32 UInteger;
|
||||
public uint UInteger;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public Int32 Integer;
|
||||
public int Integer;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public byte UInt8;
|
||||
|
@ -283,7 +283,7 @@ namespace System.Diagnostics.Eventing
|
|||
public ushort UShort;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public UInt32 Bool;
|
||||
public uint Bool;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public byte ByteVal;
|
||||
|
@ -292,13 +292,13 @@ namespace System.Diagnostics.Eventing
|
|||
public byte SByte;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public UInt64 ULong;
|
||||
public ulong ULong;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public Int64 Long;
|
||||
public long Long;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public Single Single;
|
||||
public float Single;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public double Double;
|
||||
|
@ -325,7 +325,7 @@ namespace System.Diagnostics.Eventing
|
|||
public IntPtr GuidReference;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public UInt64 FileTime;
|
||||
public ulong FileTime;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public IntPtr SystemTime;
|
||||
|
@ -334,10 +334,10 @@ namespace System.Diagnostics.Eventing
|
|||
public IntPtr SizeT;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public UInt32 Count; // number of elements (not length) in bytes.
|
||||
public uint Count; // number of elements (not length) in bytes.
|
||||
|
||||
[FieldOffset(12)]
|
||||
public UInt32 Type;
|
||||
public uint Type;
|
||||
}
|
||||
|
||||
internal enum EvtEventPropertyId
|
||||
|
@ -733,7 +733,7 @@ namespace System.Diagnostics.Eventing
|
|||
[SecurityCritical]
|
||||
internal static extern EventLogHandle EvtOpenChannelConfig(
|
||||
EventLogHandle session,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] String channelPath,
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string channelPath,
|
||||
int flags
|
||||
);
|
||||
|
||||
|
@ -823,7 +823,7 @@ namespace System.Diagnostics.Eventing
|
|||
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[SecurityCritical]
|
||||
internal static extern EventLogHandle EvtCreateRenderContext(
|
||||
Int32 valuePathsCount,
|
||||
int valuePathsCount,
|
||||
[MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)]
|
||||
string[] valuePaths,
|
||||
[MarshalAs(UnmanagedType.I4)] EvtRenderContextFlags flags
|
||||
|
@ -862,10 +862,10 @@ namespace System.Diagnostics.Eventing
|
|||
public string StringVal;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public UInt32 Count;
|
||||
public uint Count;
|
||||
|
||||
[FieldOffset(12)]
|
||||
public UInt32 Type;
|
||||
public uint Type;
|
||||
}
|
||||
|
||||
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Gets or sets the unsecured string to be imported.
|
||||
/// </summary>
|
||||
[Parameter(Position = 0, ValueFromPipeline = true, Mandatory = true)]
|
||||
public String String
|
||||
public string String
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -5607,15 +5607,15 @@ namespace Microsoft.WSMan.Management
|
|||
[Parameter]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[Parameter(ParameterSetName = "nameSet")]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "UseSSL".
|
||||
|
|
|
@ -146,15 +146,15 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "SelectorSet".
|
||||
|
|
|
@ -170,8 +170,8 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter]
|
||||
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SPN")]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
public Int32 SPNPort
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int SPNPort
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -184,7 +184,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
}
|
||||
|
||||
private Int32 spnport;
|
||||
private int spnport;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "Timeout".
|
||||
|
@ -192,8 +192,8 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter]
|
||||
[Alias("OperationTimeoutMSec")]
|
||||
[ValidateRange(0, Int32.MaxValue)]
|
||||
public Int32 OperationTimeout
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int OperationTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
}
|
||||
|
||||
private Int32 operationtimeout;
|
||||
private int operationtimeout;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "UnEncrypted".
|
||||
|
|
|
@ -95,15 +95,15 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "UseSSL".
|
||||
|
|
|
@ -213,15 +213,15 @@ namespace Microsoft.WSMan.Management
|
|||
[Parameter]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "SessionOption".
|
||||
|
|
|
@ -247,7 +247,7 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "Enumerate")]
|
||||
[Parameter(ParameterSetName = "GetInstance")]
|
||||
public Int32 Port
|
||||
public int Port
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ namespace Microsoft.WSMan.Management
|
|||
}
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "Associations".
|
||||
|
@ -822,15 +822,15 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "ResourceURI".
|
||||
|
@ -1146,15 +1146,15 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "ResourceURI".
|
||||
|
@ -1428,15 +1428,15 @@ namespace Microsoft.WSMan.Management
|
|||
/// </summary>
|
||||
[Parameter(ParameterSetName = "ComputerName")]
|
||||
[ValidateNotNullOrEmpty]
|
||||
[ValidateRange(1, Int32.MaxValue)]
|
||||
public Int32 Port
|
||||
[ValidateRange(1, int.MaxValue)]
|
||||
public int Port
|
||||
{
|
||||
get { return port; }
|
||||
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
private Int32 port = 0;
|
||||
private int port = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The following is the definition of the input parameter "ResourceURI".
|
||||
|
|
Loading…
Reference in a new issue