mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
* Move /Widgets/Live/* to /Live/* * Move /Widgets/Prompt/* to /Prompts/* * Move tests and expectations to match the new locations
30 lines
820 B
C#
30 lines
820 B
C#
using System;
|
|
using System.Globalization;
|
|
using Spectre.Console.Rendering;
|
|
|
|
namespace Spectre.Console
|
|
{
|
|
/// <summary>
|
|
/// A column showing transfer speed.
|
|
/// </summary>
|
|
public sealed class TransferSpeedColumn : ProgressColumn
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the <see cref="CultureInfo"/> to use.
|
|
/// </summary>
|
|
public CultureInfo? Culture { get; set; }
|
|
|
|
/// <inheritdoc/>
|
|
public override IRenderable Render(RenderContext context, ProgressTask task, TimeSpan deltaTime)
|
|
{
|
|
if (task.Speed == null)
|
|
{
|
|
return new Text("?/s");
|
|
}
|
|
|
|
var size = new FileSize(task.Speed.Value);
|
|
return new Markup(string.Format("{0}/s", size.ToString(suffix: true, Culture)));
|
|
}
|
|
}
|
|
}
|