using System;
using System.Collections.Generic;
namespace Quadarax.Foundation.Core.Value.Formatters
{
///
/// Formatter for forms of seconds/hours/day
///
public class HmsFormatter : ICustomFormatter, IFormatProvider
{
static Dictionary _timeformats = new Dictionary {
{"S", "{0:P:Seconds:Second}"},
{"M", "{0:P:Minutes:Minute}"},
{"H","{0:P:Hours:Hour}"},
{"D", "{0:P:Days:Day}"}
};
public string Format(string format, object arg, IFormatProvider formatProvider)
{
return string.Format(new PluralFormatter(),_timeformats[format], arg);
}
public object GetFormat(Type formatType)
{
return formatType == typeof(ICustomFormatter)?this:null;
}
}
}