Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private ComEventSinksContainer()
public static ComEventSinksContainer FromRuntimeCallableWrapper(object rcw, bool createIfNotFound)
{
object data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey);
if (data != null || createIfNotFound == false)
if (data != null || !createIfNotFound)
{
return (ComEventSinksContainer)data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ private static void ScanSourceInterface(ComTypes.ITypeInfo sourceTypeInfo, ref D
// adding new events and putting them on new interfaces while keeping the
// old interfaces around. This may cause name collisions which we are
// resolving by keeping only the first event with the same name.
if (events.ContainsKey(name) == false)
if (!events.ContainsKey(name))
{
ComEventDesc eventDesc = new ComEventDesc
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ internal static CommandInfo LookupCommandInfo(
// Check the module auto-loading preference
PSModuleAutoLoadingPreference moduleAutoLoadingPreference = GetCommandDiscoveryPreference(context, SpecialVariables.PSModuleAutoLoadingPreferenceVarPath, "PSModuleAutoLoadingPreference");

if (eventArgs == null || eventArgs.StopSearch != true)
if (eventArgs == null || !eventArgs.StopSearch)
{
do
{
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/CommandMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ internal string GetDecl()
separator = ", ";
}

if (PositionalBinding == false)
if (!PositionalBinding)
{
decl.Append(separator);
decl.Append("PositionalBinding=$false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ internal sealed override bool Read()
try
{
// Process the input pipeline object
if (ProcessInputPipelineObject(inputObject) == false)
if (!ProcessInputPipelineObject(inputObject))
{
// The input object was not bound to any parameters of the cmdlet.
// Write a non-terminating error and continue with the next input
Expand Down
4 changes: 2 additions & 2 deletions src/System.Management.Automation/engine/CoreAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1395,8 +1395,8 @@ private static MethodInformation FindBestMethodImpl(
// We also skip the optimization if the number of arguments and parameters is different
// so we let the loop deal with possible optional parameters.
if ((methods.Length == 1) &&
(methods[0].hasVarArgs == false) &&
(methods[0].isGeneric == false) &&
(!methods[0].hasVarArgs) &&
(!methods[0].isGeneric) &&
(methods[0].method == null || !(methods[0].method.DeclaringType.IsGenericTypeDefinition)) &&
// generic methods need to be double checked in a loop below - generic methods can be rejected if type inference fails
(methods[0].parameters.Length == arguments.Length))
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/ErrorPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ private void ConstructFromPSObjectForRemoting(PSObject serializedErrorRecord)
string errorDetails_ScriptStackTrace =
GetNoteValue(serializedErrorRecord, "ErrorDetails_ScriptStackTrace") as string;

RemoteException re = new RemoteException((string.IsNullOrWhiteSpace(exceptionMessage) == false) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo);
RemoteException re = new RemoteException((!string.IsNullOrWhiteSpace(exceptionMessage)) ? exceptionMessage : errorCategory_Message, serializedException, invocationInfo);

// Create ErrorRecord
PopulateProperties(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ private IEnumerable<CommandInfo> GetMatchingCommandsFromModules(string commandNa
{
PSModuleInfo module = null;

if (Context.EngineSessionState.ModuleTable.TryGetValue(Context.EngineSessionState.ModuleTableKeys[i], out module) == false)
if (!Context.EngineSessionState.ModuleTable.TryGetValue(Context.EngineSessionState.ModuleTableKeys[i], out module))
{
Dbg.Assert(false, "ModuleTableKeys should be in sync with ModuleTable");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4742,7 +4742,7 @@ private static string GetAvailableProperties(PSObject pso)
{
foreach (PSPropertyInfo p in pso.Properties)
{
if (first == false)
if (!first)
{
availableProperties.Append(" , ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module
// NestedModules = 'test2' ---> test2 is a directory under current module directory (e.g - Test1)
// We also need to look for Test1\Test2\Test2.(psd1/psm1/dll)
// With the call above, we are only looking at Test1\Test2.(psd1/psm1/dll)
if (found == false && moduleFileFound == false)
if (!found && !moduleFileFound)
{
string newRootedPath = Path.Combine(rootedPath, moduleSpecification.Name);
string newModuleBase = Path.Combine(moduleBase, moduleSpecification.Name);
Expand Down Expand Up @@ -764,7 +764,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module

// Win8: 262157 - Import-Module is giving errors while loading Nested Modules. (This is a V2 bug)
// Only look for the file if the file was not found with the previous search
if (found == false && moduleFileFound == false)
if (!found && !moduleFileFound)
{
string newRootedPath = Path.Combine(rootedPath, moduleSpecification.Name);
string newModuleBase = Path.Combine(moduleBase, moduleSpecification.Name);
Expand All @@ -786,10 +786,10 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module
}

// The rooted files wasn't found, so don't search anymore...
if (found == false && wasRooted)
if (!found && wasRooted)
return null;

if (searchModulePath && found == false && moduleFileFound == false)
if (searchModulePath && !found && !moduleFileFound)
{
if (VerifyIfNestedModuleIsAvailable(moduleSpecification, null, null, out tempModuleInfoFromVerification))
{
Expand Down Expand Up @@ -846,7 +846,7 @@ private PSModuleInfo LoadModuleNamedInManifest(PSModuleInfo parentModule, Module

// At this point, we haven't found an actual module, so try loading it as a
// PSSnapIn and then finally as an assembly in the GAC...
if ((found == false) && (moduleSpecification.Guid == null) && (moduleSpecification.Version == null) && (moduleSpecification.RequiredVersion == null) && (moduleSpecification.MaximumVersion == null))
if (!found && (moduleSpecification.Guid == null) && (moduleSpecification.Version == null) && (moduleSpecification.RequiredVersion == null) && (moduleSpecification.MaximumVersion == null))
{
// If we are in module analysis and the parent module declares non-wildcarded ExportedCmdlets, then we don't need to
// actually process the binary module.
Expand Down Expand Up @@ -4956,7 +4956,7 @@ internal void RemoveModule(PSModuleInfo module, string moduleNameInRemoveModuleC
args: new object[] { module });
}

if (module.ImplementingAssembly != null && module.ImplementingAssembly.IsDynamic == false)
if (module.ImplementingAssembly != null && !module.ImplementingAssembly.IsDynamic)
{
var exportedTypes = PSSnapInHelpers.GetAssemblyTypes(module.ImplementingAssembly, module.Name);
foreach (var type in exportedTypes)
Expand Down Expand Up @@ -6666,7 +6666,7 @@ internal PSModuleInfo LoadBinaryModule(PSModuleInfo parentModule, bool trySnapIn
}
}

if (importSuccessful == false)
if (!importSuccessful)
{
if (importingModule)
{
Expand Down Expand Up @@ -7087,7 +7087,7 @@ internal static void AddModuleToModuleTables(ExecutionContext context, SessionSt
}

var privateDataHashTable = module.PrivateData as Hashtable;
if (context.Modules.IsImplicitRemotingModuleLoaded == false &&
if (!context.Modules.IsImplicitRemotingModuleLoaded &&
privateDataHashTable != null && privateDataHashTable.ContainsKey("ImplicitRemoting"))
{
context.Modules.IsImplicitRemotingModuleLoaded = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ private void InitNativeProcess()
// we will try launching one last time using ShellExecute...
if (notDone)
{
if (soloCommand && startInfo.UseShellExecute == false)
if (soloCommand && !startInfo.UseShellExecute)
{
startInfo.UseShellExecute = true;
startInfo.RedirectStandardInput = false;
Expand All @@ -531,7 +531,7 @@ private void InitNativeProcess()
else
{
_isRunningInBackground = true;
if (startInfo.UseShellExecute == false)
if (!startInfo.UseShellExecute)
{
_isRunningInBackground = isWindowsApplication;
}
Expand Down Expand Up @@ -563,7 +563,7 @@ private void InitNativeProcess()
throw;
}

if (_isRunningInBackground == false)
if (!_isRunningInBackground)
{
InitOutputQueue();
}
Expand Down Expand Up @@ -654,7 +654,7 @@ private ProcessOutputObject DequeueProcessOutput(bool blocking)
/// </summary>
private void ConsumeAvailableNativeProcessOutput(bool blocking)
{
if (_isRunningInBackground == false)
if (!_isRunningInBackground)
{
if (_nativeProcess.StartInfo.RedirectStandardOutput || _nativeProcess.StartInfo.RedirectStandardError)
{
Expand All @@ -678,7 +678,7 @@ internal override void Complete()
Exception exceptionToRethrow = null;
try
{
if (_isRunningInBackground == false)
if (!_isRunningInBackground)
{
// Wait for input writer to finish.
_inputWriter.Done();
Expand Down Expand Up @@ -1251,7 +1251,7 @@ private void CalculateIORedirection(bool isWindowsApplication, out bool redirect

// In minishell scenario, if output is redirected
// then error should also be redirected.
if (redirectError == false && redirectOutput && _isMiniShell)
if (!redirectError && redirectOutput && _isMiniShell)
{
redirectError = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ internal bool IsItemContainer(
foreach (string providerPath in providerPaths)
{
result = IsItemContainer(providerInstance, providerPath, context);
if (result == false)
if (!result)
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Management.Automation/engine/TypeTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,7 @@ private static bool CheckStandardMembers(ConcurrentBag<string> errors, string ty
}
while (false);

if (serializationSettingsOk == false)
if (!serializationSettingsOk)
{
AddError(errors, typeName, TypesXmlStrings.SerializationSettingsIgnored);
members.Remove(InheritPropertySerializationSet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ internal void AddToRunningPipelineList(PipelineBase pipeline)

lock (_pipelineListLock)
{
if (ByPassRunspaceStateCheck == false && RunspaceState != RunspaceState.Opened)
if (!ByPassRunspaceStateCheck && RunspaceState != RunspaceState.Opened)
{
InvalidRunspaceStateException e =
new InvalidRunspaceStateException
Expand Down Expand Up @@ -1003,7 +1003,7 @@ internal void StopNestedPipelines(Pipeline pipeline)
// first check if this pipeline is in the list of running
// pipelines. It is possible that pipeline has already
// completed.
if (RunningPipelines.Contains(pipeline) == false)
if (!RunningPipelines.Contains(pipeline))
{
return;
}
Expand Down
16 changes: 8 additions & 8 deletions src/System.Management.Automation/engine/hostifaces/History.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ internal HistoryInfo GetEntry(long id)

HistoryInfo entry = CoreGetEntry(id);
if (entry != null)
if (entry.Cleared == false)
if (!entry.Cleared)
return entry.Clone();

return null;
Expand Down Expand Up @@ -496,7 +496,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S
for (long i = 0; i <= count - 1;)
{
if (id > _countEntriesAdded) break;
if (_buffer[GetIndexFromId(id)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim()))
if (!_buffer[GetIndexFromId(id)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim()))
{
cmdlist.Add(_buffer[GetIndexFromId(id)].Clone()); i++;
}
Expand All @@ -520,7 +520,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S
}

if (id < 1) break;
if (_buffer[GetIndexFromId(id)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim()))
if (!_buffer[GetIndexFromId(id)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(id)].CommandLine.Trim()))
{
cmdlist.Add(_buffer[GetIndexFromId(id)].Clone()); i++;
}
Expand All @@ -533,7 +533,7 @@ internal HistoryInfo[] GetEntries(WildcardPattern wildcardpattern, long count, S
{
for (long i = 1; i <= _countEntriesAdded; i++)
{
if (_buffer[GetIndexFromId(i)].Cleared == false && wildcardpattern.IsMatch(_buffer[GetIndexFromId(i)].CommandLine.Trim()))
if (!_buffer[GetIndexFromId(i)].Cleared && wildcardpattern.IsMatch(_buffer[GetIndexFromId(i)].CommandLine.Trim()))
{
cmdlist.Add(_buffer[GetIndexFromId(i)].Clone());
}
Expand Down Expand Up @@ -660,7 +660,7 @@ private long SmallestIDinBuffer()
for (int i = 0; i < _buffer.Length; i++)
{
// assign the first entry in the buffer as min.
if (_buffer[i] != null && _buffer[i].Cleared == false)
if (_buffer[i] != null && !_buffer[i].Cleared)
{
minID = _buffer[i].Id;
break;
Expand All @@ -669,7 +669,7 @@ private long SmallestIDinBuffer()
// check for the minimum id that is not cleared
for (int i = 0; i < _buffer.Length; i++)
{
if (_buffer[i] != null && _buffer[i].Cleared == false)
if (_buffer[i] != null && !_buffer[i].Cleared)
if (minID > _buffer[i].Id)
minID = _buffer[i].Id;
}
Expand Down Expand Up @@ -1814,7 +1814,7 @@ private void ClearHistoryByID()
else
{
// confirmation message if all the clearhistory cmdlet is used without any parameters
if (_countParameterSpecified == false)
if (!_countParameterSpecified)
{
string message = StringUtil.Format(HistoryStrings.ClearHistoryWarning, "Warning");// "The command would clear all the entry(s) from the session history,Are you sure you want to continue ?";
if (!ShouldProcess(message))
Expand Down Expand Up @@ -1955,7 +1955,7 @@ private void ClearHistoryEntries(long id, int count, string cmdline, SwitchParam
// Clear the History value.
foreach (HistoryInfo entry in _entries)
{
if (entry != null && entry.Cleared == false)
if (entry != null && !entry.Cleared)
_history.ClearEntry(entry.Id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ internal PSInformationalBuffers GetInformationalMessageBuffers()
endLoop = false;
break;
}
} while (endLoop != true);
} while (!endLoop);

return shouldContinue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ protected override
{
try
{
if (_disposed == false)
if (!_disposed)
{
_disposed = true;
if (disposing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,7 @@ public object Current
/// </remarks>
public bool MoveNext()
{
return MoveNext(_neverBlock == false);
return MoveNext(!_neverBlock);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3670,7 +3670,7 @@ public PSDataCollection<PSObject> EndInvoke(IAsyncResult asyncResult)

if ((psAsyncResult == null) ||
(psAsyncResult.OwnerId != InstanceId) ||
(psAsyncResult.IsAssociatedWithAsyncInvoke != true))
(!psAsyncResult.IsAssociatedWithAsyncInvoke))
{
throw PSTraceSource.NewArgumentException(nameof(asyncResult),
PowerShellStrings.AsyncResultNotOwned, "IAsyncResult", "BeginInvoke");
Expand Down
Loading