Skip to content

Commit

Permalink
rem - brk|doc - Removed the targeted argument from progress
Browse files Browse the repository at this point in the history
---

We've removed the targeted optional argument from the horizontal progress bar writer.

---

Type: rem
Breaking: True
Doc Required: True
Part: 1/1
  • Loading branch information
AptiviCEO committed May 22, 2024
1 parent 8157b94 commit e663cab
Showing 1 changed file with 30 additions and 47 deletions.
77 changes: 30 additions & 47 deletions Terminaux/Writer/FancyWriters/ProgressBarColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ public static class ProgressBarColor
/// <param name="Left">The progress position from the upper left corner</param>
/// <param name="Top">The progress position from the top</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgressPlain(double Progress, int Left, int Top, bool DrawBorder = true, bool Targeted = false) =>
WriteProgressPlain(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, DrawBorder, Targeted);
public static void WriteProgressPlain(double Progress, int Left, int Top, bool DrawBorder = true) =>
WriteProgressPlain(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -55,12 +54,11 @@ public static void WriteProgressPlain(double Progress, int Left, int Top, bool D
/// <param name="Top">The progress position from the top</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="width">Progress bar width</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgressPlain(double Progress, int Left, int Top, int width, bool DrawBorder = true, bool Targeted = false)
public static void WriteProgressPlain(double Progress, int Left, int Top, int width, bool DrawBorder = true)
{
try
{
TextWriterRaw.WriteRaw(RenderProgressPlain(Progress, Left, Top, width, DrawBorder, Targeted));
TextWriterRaw.WriteRaw(RenderProgressPlain(Progress, Left, Top, width, DrawBorder));
}
catch (Exception ex)
{
Expand All @@ -76,9 +74,8 @@ public static void WriteProgressPlain(double Progress, int Left, int Top, int wi
/// <param name="Left">The progress position from the upper left corner</param>
/// <param name="Top">The progress position from the top</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, new Color(ConsoleColors.Olive), ColorTools.GetGray(), DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, new Color(ConsoleColors.Olive), ColorTools.GetGray(), DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -88,9 +85,8 @@ public static void WriteProgress(double Progress, int Left, int Top, bool DrawBo
/// <param name="Top">The progress position from the top</param>
/// <param name="width">Progress bar width</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, int width, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, width, new Color(ConsoleColors.Olive), ColorTools.GetGray(), DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, int width, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, width, new Color(ConsoleColors.Olive), ColorTools.GetGray(), DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -100,9 +96,8 @@ public static void WriteProgress(double Progress, int Left, int Top, int width,
/// <param name="Top">The progress position from the top</param>
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, ColorTools.GetGray(), DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, ColorTools.GetGray(), DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -113,9 +108,8 @@ public static void WriteProgress(double Progress, int Left, int Top, Color Progr
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="width">Progress bar width</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, width, ProgressColor, ColorTools.GetGray(), DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, width, ProgressColor, ColorTools.GetGray(), DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -126,9 +120,8 @@ public static void WriteProgress(double Progress, int Left, int Top, int width,
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, Color FrameColor, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, FrameColor, DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, Color FrameColor, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, FrameColor, DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -140,9 +133,8 @@ public static void WriteProgress(double Progress, int Left, int Top, Color Progr
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="width">Progress bar width</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, width, ProgressColor, FrameColor, ColorTools.currentBackgroundColor, DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, width, ProgressColor, FrameColor, ColorTools.currentBackgroundColor, DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -154,9 +146,8 @@ public static void WriteProgress(double Progress, int Left, int Top, int width,
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="BackgroundColor">The progress bar background color</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true, bool Targeted = false) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, FrameColor, BackgroundColor, DrawBorder, Targeted);
public static void WriteProgress(double Progress, int Left, int Top, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true) =>
WriteProgress(Progress, Left, Top, ConsoleWrapper.WindowWidth - 10, ProgressColor, FrameColor, BackgroundColor, DrawBorder);

/// <summary>
/// Writes the progress bar
Expand All @@ -169,12 +160,11 @@ public static void WriteProgress(double Progress, int Left, int Top, Color Progr
/// <param name="BackgroundColor">The progress bar background color</param>
/// <param name="width">Progress bar width</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="Targeted">Targeted percentage?</param>
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true, bool Targeted = false)
public static void WriteProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true)
{
try
{
TextWriterRaw.WriteRaw(RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, BackgroundColor, DrawBorder, Targeted));
TextWriterRaw.WriteRaw(RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, BackgroundColor, DrawBorder));
}
catch (Exception ex)
{
Expand All @@ -191,9 +181,8 @@ public static void WriteProgress(double Progress, int Left, int Top, int width,
/// <param name="Top">The progress position from the top</param>
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="width">Progress bar width</param>
/// <param name="Targeted">Targeted percentage?</param>
public static string RenderProgressPlain(double Progress, int Left, int Top, int width, bool DrawBorder = true, bool Targeted = false) =>
RenderProgress(Progress, Left, Top, width, ColorTools.currentForegroundColor, ColorTools.GetGray(), ColorTools.currentBackgroundColor, true, DrawBorder, Targeted);
public static string RenderProgressPlain(double Progress, int Left, int Top, int width, bool DrawBorder = true) =>
RenderProgress(Progress, Left, Top, width, ColorTools.currentForegroundColor, ColorTools.GetGray(), ColorTools.currentBackgroundColor, true, DrawBorder);

/// <summary>
/// Renders the progress bar
Expand All @@ -204,9 +193,8 @@ public static string RenderProgressPlain(double Progress, int Left, int Top, int
/// <param name="DrawBorder">Whether to draw the border or not</param>
/// <param name="width">Progress bar width</param>
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="Targeted">Targeted percentage?</param>
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, bool DrawBorder = true, bool Targeted = false) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, ColorTools.GetGray(), ColorTools.currentBackgroundColor, true, DrawBorder, Targeted);
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, bool DrawBorder = true) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, ColorTools.GetGray(), ColorTools.currentBackgroundColor, true, DrawBorder);

/// <summary>
/// Renders the progress bar
Expand All @@ -218,9 +206,8 @@ public static string RenderProgress(double Progress, int Left, int Top, int widt
/// <param name="width">Progress bar width</param>
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="Targeted">Targeted percentage?</param>
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, bool DrawBorder = true, bool Targeted = false) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, ColorTools.currentBackgroundColor, true, DrawBorder, Targeted);
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, bool DrawBorder = true) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, ColorTools.currentBackgroundColor, true, DrawBorder);

/// <summary>
/// Renders the progress bar
Expand All @@ -233,9 +220,8 @@ public static string RenderProgress(double Progress, int Left, int Top, int widt
/// <param name="ProgressColor">The progress bar color</param>
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="BackgroundColor">The progress bar background color</param>
/// <param name="Targeted">Targeted percentage?</param>
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true, bool Targeted = false) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, BackgroundColor, true, DrawBorder, Targeted);
public static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool DrawBorder = true) =>
RenderProgress(Progress, Left, Top, width, ProgressColor, FrameColor, BackgroundColor, true, DrawBorder);

/// <summary>
/// Renders the progress bar
Expand All @@ -249,8 +235,7 @@ public static string RenderProgress(double Progress, int Left, int Top, int widt
/// <param name="FrameColor">The progress bar frame color</param>
/// <param name="BackgroundColor">The progress bar background color</param>
/// <param name="useColor">Whether to use the color or not</param>
/// <param name="Targeted">Targeted percentage?</param>
internal static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool useColor, bool DrawBorder = true, bool Targeted = false)
internal static string RenderProgress(double Progress, int Left, int Top, int width, Color ProgressColor, Color FrameColor, Color BackgroundColor, bool useColor, bool DrawBorder = true)
{
try
{
Expand Down Expand Up @@ -281,9 +266,7 @@ internal static string RenderProgress(double Progress, int Left, int Top, int wi
}

// Draw the progress bar
int times = Targeted ?
ConsoleMisc.PercentRepeatTargeted((int)Math.Round(Progress), 100, width) :
ConsoleMisc.PercentRepeat((int)Math.Round(Progress), 100, width);
int times = ConsoleMisc.PercentRepeatTargeted((int)Math.Round(Progress), 100, width);
progBuilder.Append(CsiSequences.GenerateCsiCursorPosition(Left + 1 + times + 1, Top + 2) + new string(' ', width - times));
if (useColor)
progBuilder.Append(ProgressColor.VTSequenceBackground);
Expand Down

0 comments on commit e663cab

Please sign in to comment.