1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

Download decision rejection reasons are no longer static messages

New: Better messaging on manual search when release is rejected
This commit is contained in:
Mark McDowall
2014-10-26 22:51:50 -07:00
parent e82b29e346
commit 95d67ef9f4
41 changed files with 265 additions and 378 deletions
@@ -0,0 +1,20 @@
using System;
namespace NzbDrone.Common.Extensions
{
public static class Int64Extensions
{
private static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
public static string SizeSuffix(this Int64 value)
{
if (value < 0) { return "-" + SizeSuffix(-value); }
if (value == 0) { return "0.0 bytes"; }
var mag = (int)Math.Log(value, 1024);
decimal adjustedSize = (decimal)value / (1L << (mag * 10));
return string.Format("{0:n1} {1}", adjustedSize, SizeSuffixes[mag]);
}
}
}