Thanks to visit codestin.com
Credit goes to github.com

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
15 changes: 15 additions & 0 deletions src/System.Management.Automation/engine/MshCommandRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ public void WriteProgress(
WriteProgress(sourceId, progressRecord, false);
}

internal bool IsWriteProgressEnabled()
=> WriteHelper_ShouldWrite(ProgressPreference, lastProgressContinueStatus);

internal void WriteProgress(
Int64 sourceId,
ProgressRecord progressRecord,
Expand Down Expand Up @@ -472,6 +475,9 @@ public void WriteDebug(string text)
WriteDebug(new DebugRecord(text));
}

internal bool IsWriteDebugEnabled()
=> WriteHelper_ShouldWrite(DebugPreference, lastDebugContinueStatus);

/// <summary>
/// Display debug information.
/// </summary>
Expand Down Expand Up @@ -566,6 +572,9 @@ public void WriteVerbose(string text)
WriteVerbose(new VerboseRecord(text));
}

internal bool IsWriteVerboseEnabled()
=> WriteHelper_ShouldWrite(VerbosePreference, lastVerboseContinueStatus);

/// <summary>
/// Display verbose information.
/// </summary>
Expand Down Expand Up @@ -660,6 +669,9 @@ public void WriteWarning(string text)
WriteWarning(new WarningRecord(text));
}

internal bool IsWriteWarningEnabled()
=> WriteHelper_ShouldWrite(WarningPreference, lastWarningContinueStatus);

/// <summary>
/// Display warning information.
/// </summary>
Expand Down Expand Up @@ -733,6 +745,9 @@ public void WriteInformation(InformationRecord informationRecord)
WriteInformation(informationRecord, false);
}

internal bool IsWriteInformationEnabled()
=> WriteHelper_ShouldWrite(InformationPreference, lastInformationContinueStatus);

/// <summary>
/// Display tagged object information.
/// </summary>
Expand Down
15 changes: 15 additions & 0 deletions src/System.Management.Automation/engine/cmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ public void WriteVerbose(string text)
}
}

internal bool IsWriteVerboseEnabled()
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteVerboseEnabled();

/// <summary>
/// Display warning information.
/// </summary>
Expand Down Expand Up @@ -495,6 +498,9 @@ public void WriteWarning(string text)
}
}

internal bool IsWriteWarningEnabled()
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteWarningEnabled();

/// <summary>
/// Write text into pipeline execution log.
/// </summary>
Expand Down Expand Up @@ -603,6 +609,9 @@ internal void WriteProgress(
throw new System.NotImplementedException("WriteProgress");
}

internal bool IsWriteProgressEnabled()
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteProgressEnabled();

/// <summary>
/// Display debug information.
/// </summary>
Expand Down Expand Up @@ -646,6 +655,9 @@ public void WriteDebug(string text)
}
}

internal bool IsWriteDebugEnabled()
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteDebugEnabled();

/// <summary>
/// Route information to the user or host.
/// </summary>
Expand Down Expand Up @@ -753,6 +765,9 @@ public void WriteInformation(InformationRecord informationRecord)
}
}

internal bool IsWriteInformationEnabled()
=> commandRuntime is not MshCommandRuntime mshRuntime || mshRuntime.IsWriteInformationEnabled();

#endregion Write

#region ShouldProcess
Expand Down
Loading