/// <inheritdoc /> /// <remarks> /// <para> /// A token is made up of a Name and then an optional set of arguments. These arguments are a property specification and a /// format specification - i.e. TOKEN{.property specification}{:format specification}. /// </para> /// <para> /// As an example, the following are all legal token specifications... /// <list type="table"> /// <listheader> /// <term>Token String</term> /// <description>Description</description> /// </listheader> /// <item> /// <term>Process</term> /// <description>Return the process object</description> /// </item> /// <item> /// <term>Process.ProcessName</term> /// <description>At runtime the process name of the current executing process will be output</description> /// </item> /// <item> /// <term>Process.TotalProcessorTime:hh:mm:ss</term> /// <description>This will output the total processor time formatted as hours:minutes:seconds</description> /// </item> /// </list> /// </para> /// <para> /// A property specification consists of one or more property (or field) names separated by a period. /// </para> /// <para> /// A format specification is a standard .NET format specification, and is simply used in a ToString() call on the property /// value returned at runtime. So using the last example above, the code would effectively be /// ((IFormattable)object).ToString(FormatSpecification). /// </para> /// </remarks> public PropertyReader Create(Token token) { if (null == token) { throw new ArgumentNullException("token"); } if (!_readerTokenDictionary.ContainsKey(token.TokenName)) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.UnrecognizedToken, token)); } PropertyReader reader = _readerTokenDictionary[token.TokenName]; if (!string.IsNullOrEmpty(token.SubProperty)) { reader = new FastPropertyReader(reader, token.SubProperty); } if (!string.IsNullOrEmpty(token.FormatString)) { reader = new FormattedPropertyReader(reader, token.FormatString); } return(reader); }
/// <inheritdoc /> /// <remarks> /// <para> /// A token is made up of a Name and then an optional set of arguments. These arguments are a property specification and a /// format specification - i.e. TOKEN{.property specification}{:format specification}. /// </para> /// <para> /// As an example, the following are all legal token specifications... /// <list type="table"> /// <listheader> /// <term>Token String</term> /// <description>Description</description> /// </listheader> /// <item> /// <term>Process</term> /// <description>Return the process object</description> /// </item> /// <item> /// <term>Process.ProcessName</term> /// <description>At runtime the process name of the current executing process will be output</description> /// </item> /// <item> /// <term>Process.TotalProcessorTime:hh:mm:ss</term> /// <description>This will output the total processor time formatted as hours:minutes:seconds</description> /// </item> /// </list> /// </para> /// <para> /// A property specification consists of one or more property (or field) names separated by a period. /// </para> /// <para> /// A format specification is a standard .NET format specification, and is simply used in a ToString() call on the property /// value returned at runtime. So using the last example above, the code would effectively be /// ((IFormattable)object).ToString(FormatSpecification). /// </para> /// </remarks> public PropertyReader Create(Token token) { if (null == token) throw new ArgumentNullException("token"); if (!_readerTokenDictionary.ContainsKey(token.TokenName)) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.UnrecognizedToken, token)); } PropertyReader reader = _readerTokenDictionary[token.TokenName]; if (!string.IsNullOrEmpty(token.SubProperty)) { reader = new FastPropertyReader(reader, token.SubProperty); } if (!string.IsNullOrEmpty(token.FormatString)) { reader = new FormattedPropertyReader(reader, token.FormatString); } return reader; }