2018-11-19 22:47:12 -06:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Extensions
|
2018-11-03 16:21:36 -05:00
|
|
|
|
{
|
|
|
|
|
public static class IntEx
|
|
|
|
|
{
|
|
|
|
|
public static int? Or(this int? value, int? alternative)
|
|
|
|
|
{
|
|
|
|
|
if (!value.HasValue && !alternative.HasValue)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return value.HasValue ? value : alternative;
|
|
|
|
|
}
|
2018-11-19 22:47:12 -06:00
|
|
|
|
|
|
|
|
|
public static int ToSecondsFromMilliseconds(this int? value)
|
|
|
|
|
{
|
|
|
|
|
if (value > 0)
|
|
|
|
|
{
|
|
|
|
|
var contentDurationTimeSpan = TimeSpan.FromMilliseconds((double)(value ?? 0));
|
|
|
|
|
return (int)contentDurationTimeSpan.TotalSeconds;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2018-11-03 16:21:36 -05:00
|
|
|
|
}
|
2018-11-04 14:33:37 -06:00
|
|
|
|
}
|