建议:最小显示单位为kb/s

功能建议 · 104 次浏览
一个大佬王 创建于 13天18小时前

支持一下,不过有个建议:网速显示建议去掉b/s,最小单位为kb。不然显示感觉有点乱,而且低网速的时候,单位和字符长度一直跳来跳去

private string FormatSpeed(long bytesPerSec)
{
    string[] units = { "KB/s", "MB/s", "GB/s" }; // 删除B/s,从KB开始
    int unitIndex = 0;
    double speed = bytesPerSec / 1024.0; // 直接转换为KB

    while (speed >= 1024 && unitIndex < units.Length - 1)
    {
        speed /= 1024;
        unitIndex++;
    }

    return $"{speed:F1} {units[unitIndex]}";
}
一个大佬王 最后更新于 2025/4/7

回复内容
暂无回复
回复主贴