mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add internal methods to check Preferences (#25514)
This commit is contained in:
@@ -390,6 +390,9 @@ namespace System.Management.Automation
|
||||
WriteProgress(sourceId, progressRecord, false);
|
||||
}
|
||||
|
||||
internal bool IsWriteProgressEnabled()
|
||||
=> WriteHelper_ShouldWrite(ProgressPreference, lastProgressContinueStatus);
|
||||
|
||||
internal void WriteProgress(
|
||||
Int64 sourceId,
|
||||
ProgressRecord progressRecord,
|
||||
@@ -472,6 +475,9 @@ namespace System.Management.Automation
|
||||
WriteDebug(new DebugRecord(text));
|
||||
}
|
||||
|
||||
internal bool IsWriteDebugEnabled()
|
||||
=> WriteHelper_ShouldWrite(DebugPreference, lastDebugContinueStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Display debug information.
|
||||
/// </summary>
|
||||
@@ -566,6 +572,9 @@ namespace System.Management.Automation
|
||||
WriteVerbose(new VerboseRecord(text));
|
||||
}
|
||||
|
||||
internal bool IsWriteVerboseEnabled()
|
||||
=> WriteHelper_ShouldWrite(VerbosePreference, lastVerboseContinueStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Display verbose information.
|
||||
/// </summary>
|
||||
@@ -660,6 +669,9 @@ namespace System.Management.Automation
|
||||
WriteWarning(new WarningRecord(text));
|
||||
}
|
||||
|
||||
internal bool IsWriteWarningEnabled()
|
||||
=> WriteHelper_ShouldWrite(WarningPreference, lastWarningContinueStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Display warning information.
|
||||
/// </summary>
|
||||
@@ -733,6 +745,9 @@ namespace System.Management.Automation
|
||||
WriteInformation(informationRecord, false);
|
||||
}
|
||||
|
||||
internal bool IsWriteInformationEnabled()
|
||||
=> WriteHelper_ShouldWrite(InformationPreference, lastInformationContinueStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Display tagged object information.
|
||||
/// </summary>
|
||||
|
||||
@@ -458,6 +458,9 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsWriteVerboseEnabled()
|
||||
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteVerboseEnabled();
|
||||
|
||||
/// <summary>
|
||||
/// Display warning information.
|
||||
/// </summary>
|
||||
@@ -495,6 +498,9 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsWriteWarningEnabled()
|
||||
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteWarningEnabled();
|
||||
|
||||
/// <summary>
|
||||
/// Write text into pipeline execution log.
|
||||
/// </summary>
|
||||
@@ -603,6 +609,9 @@ namespace System.Management.Automation
|
||||
throw new System.NotImplementedException("WriteProgress");
|
||||
}
|
||||
|
||||
internal bool IsWriteProgressEnabled()
|
||||
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteProgressEnabled();
|
||||
|
||||
/// <summary>
|
||||
/// Display debug information.
|
||||
/// </summary>
|
||||
@@ -646,6 +655,9 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsWriteDebugEnabled()
|
||||
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteDebugEnabled();
|
||||
|
||||
/// <summary>
|
||||
/// Route information to the user or host.
|
||||
/// </summary>
|
||||
@@ -753,6 +765,9 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsWriteInformationEnabled()
|
||||
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteInformationEnabled();
|
||||
|
||||
#endregion Write
|
||||
|
||||
#region ShouldProcess
|
||||
|
||||
Reference in New Issue
Block a user