mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
@@ -234,11 +234,16 @@ namespace NzbDrone.Core.Indexers
|
||||
return channel.Elements("item");
|
||||
}
|
||||
|
||||
private static readonly Regex ParseSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2}|\d+)\W?(?<unit>[KMG]i?B)",
|
||||
private static readonly Regex ParseSizeRegex = new Regex(@"(?<value>(?:\d+,)*\d+(?:\.\d{1,2})?)\W?(?<unit>[KMG]i?B)(?![\w/])",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
public static Int64 ParseSize(String sizeString, Boolean defaultToBinaryPrefix)
|
||||
{
|
||||
if (sizeString.All(char.IsDigit))
|
||||
{
|
||||
return Int64.Parse(sizeString);
|
||||
}
|
||||
|
||||
var match = ParseSizeRegex.Matches(sizeString);
|
||||
|
||||
if (match.Count != 0)
|
||||
|
||||
Reference in New Issue
Block a user