protected override bool FillName(AppenderValue value)
        {
            switch (value.Name.ToLowerInvariant())
            {
                case "rest":
                    if (!string.IsNullOrEmpty(_currentDatum.Message))
                        return false;

                    _currentDatum.Message = DefaultsOverridePattern ? DefaultMessage ?? value.sValue : value.sValue;
                    break;

                case "streamname":
                    if (!string.IsNullOrEmpty(_currentDatum.StreamName))
                        return false;

                    _currentDatum.StreamName = DefaultsOverridePattern ? DefaultStreamName ?? value.sValue : value.sValue;
                    break;

                case "groupname":
                    if (!string.IsNullOrEmpty(_currentDatum.GroupName))
                        return false;

                    _currentDatum.GroupName = DefaultsOverridePattern ? DefaultGroupName ?? value.sValue : value.sValue;
                    break;

                case "timestamp":
                    if (_currentDatum.Timestamp.HasValue)
                        return false;

                    _currentDatum.Timestamp = DefaultsOverridePattern ? DefaultTimestamp ?? value.Time.Value.DateTime : value.Time.Value.DateTime;
                    break;
            }

            return true;
        }
        protected override bool FillName(AppenderValue value)
        {
            switch (value.Name.ToLowerInvariant())
            {
            case "rest":
                if (!string.IsNullOrEmpty(_currentDatum.Message))
                {
                    return(false);
                }

                _currentDatum.Message = DefaultsOverridePattern ? DefaultMessage ?? value.sValue : value.sValue;
                break;

            case "streamname":
                if (!string.IsNullOrEmpty(_currentDatum.StreamName))
                {
                    return(false);
                }

                _currentDatum.StreamName = DefaultsOverridePattern ? DefaultStreamName ?? value.sValue : value.sValue;
                break;

            case "groupname":
                if (!string.IsNullOrEmpty(_currentDatum.GroupName))
                {
                    return(false);
                }

                _currentDatum.GroupName = DefaultsOverridePattern ? DefaultGroupName ?? value.sValue : value.sValue;
                break;

            case "timestamp":
                if (_currentDatum.Timestamp.HasValue)
                {
                    return(false);
                }

                _currentDatum.Timestamp = DefaultsOverridePattern ? DefaultTimestamp ?? value.Time.Value.DateTime : value.Time.Value.DateTime;
                break;
            }

            return(true);
        }
        protected override bool FillName(AppenderValue value)
        {
            switch (value.Name.ToLowerInvariant())
            {
            case "value":
                if (_currentDatum.Value != 0.0)
                {
                    return(false);
                }

                _currentDatum.Value = _defaultsOverridePattern ? DefaultValue ?? value.dValue.Value : value.dValue.Value;
                _currentDatum.Unit  = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                break;

            case "unit":
                if (_currentDatum.Unit != null)
                {
                    return(false);
                }

                if (_defaultsOverridePattern)
                {
                    _currentDatum.Unit = DefaultUnit ?? value.sValue;
                }
                else
                {
                    _currentDatum.Unit = value.sValue;
                }
                break;

            case "metricname":
                if (!string.IsNullOrEmpty(_currentDatum.MetricName))
                {
                    return(false);
                }

                _currentDatum.MetricName = _defaultsOverridePattern ? DefaultMetricName ?? value.sValue : value.sValue;
                break;

            case "namespace":
                if (!string.IsNullOrEmpty(_currentDatum.NameSpace))
                {
                    return(false);
                }

                _currentDatum.NameSpace = _defaultsOverridePattern ? DefaultNameSpace ?? value.sValue : value.sValue;
                break;

            case "maximum":
                if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Maximum != 0.0)
                {
                    return(false);
                }

                _currentDatum.Maximum = _defaultsOverridePattern ? DefaultMaximum ?? value.dValue.Value : value.dValue.Value;
                _currentDatum.Unit    = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                break;

            case "minimum":
                if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Minimum != 0.0)
                {
                    return(false);
                }
                _currentDatum.Minimum = _defaultsOverridePattern ? DefaultMinimum ?? value.dValue.Value : value.dValue.Value;
                _currentDatum.Unit    = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                break;

            case "samplecount":
                if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.SampleCount != 0.0)
                {
                    return(false);
                }

                _currentDatum.SampleCount = _defaultsOverridePattern ? DefaultSampleCount ?? value.dValue.Value : value.dValue.Value;
                _currentDatum.Unit        = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                break;

            case "sum":
                if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Sum != 0.0)
                {
                    return(false);
                }

                _currentDatum.Sum  = _defaultsOverridePattern ? DefaultSum ?? value.dValue.Value : value.dValue.Value;
                _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                break;

            case "timestamp":
                if (_currentDatum.Timestamp.HasValue)
                {
                    return(false);
                }

                _currentDatum.Timestamp = _defaultsOverridePattern ? DefaultTimestamp ?? value.Time.Value : value.Time.Value;
                break;
            }

            return(true);
        }
        protected void ParseTokens(ref List <Match> .Enumerator tokens, string renderedMessage)
        {
            string t0, unit, sNum = string.Empty, rest = "";
            int?   startRest = 0;

            tokens.MoveNext();
            while (tokens.Current != null)
            {
                if (!string.IsNullOrEmpty(t0 = tokens.Current.Groups["name"].Value.Split(new[] { ':' })[0]))
                {
                    if (!IsSupportedName(t0))
                    {
                        tokens.MoveNext();
                        continue;
                    }

                    if (startRest.HasValue)
                    {
                        rest += _renderedMessage.Substring(startRest.Value, tokens.Current.Index - startRest.Value);
                    }

                    startRest = null;

                    if (ShouldLocalParse(t0))
                    {
                        LocalParse(ref tokens, sNum);
                    }
                    else if (t0.StartsWith("Timestamp", StringComparison.InvariantCultureIgnoreCase))
                    {
                        DateTimeOffset time;
                        int            length;
                        if (ExtractTime(renderedMessage.Substring(tokens.Current.Index + "Timestamp".Length), out time, out length))
                        {
                            _values.Add(new AppenderValue
                            {
                                Name = "Timestamp",
                                Time = time
                            });

                            tokens.MoveNext();
                            while (tokens.MoveNext() && tokens.Current.Index <= tokens.Current.Index + length)
                            {
                                ;
                            }
                        }

                        tokens.MoveNext();
                    }
                    else
                    {
                        if (!tokens.MoveNext())
                        {
                            continue;
                        }

                        sNum = string.IsNullOrEmpty(tokens.Current.Groups["float"].Value)
                            ? tokens.Current.Groups["int"].Value
                            : tokens.Current.Groups["float"].Value;

                        var sValue = tokens.Current.Groups["word"].Value;

                        if (string.IsNullOrEmpty(sNum) && string.IsNullOrEmpty(sValue))
                        {
                            tokens.MoveNext();
                            continue;
                        }

                        var d = 0.0;
                        if (
                            !Double.TryParse(sNum, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d) &&
                            string.IsNullOrEmpty(sValue))
                        {
                            tokens.MoveNext();
                            continue;
                        }

                        var v = new AppenderValue
                        {
                            dValue = d,
                            sValue = string.IsNullOrEmpty(sValue) ? sNum : sValue,
                            Name   = t0
                        };

                        if (tokens.MoveNext())
                        {
                            if (!string.IsNullOrEmpty(unit = tokens.Current.Groups["word"].Value))
                            {
                                v.Unit = unit;
                            }
                        }

                        _values.Add(v);
                    }
                }
                else
                {
                    startRest = startRest ?? tokens.Current.Index;
                    tokens.MoveNext();
                }
            }

            if (startRest.HasValue)
            {
                rest += _renderedMessage.Substring(startRest.Value, _renderedMessage.Length - startRest.Value);
            }

            _values.Add(new AppenderValue {
                Name = "rest", sValue = rest.Trim()
            });
        }
 protected abstract bool FillName(AppenderValue value);
        protected void ParseTokens(ref List<Match>.Enumerator tokens, string renderedMessage)
        {
            string t0, unit, value, name, sNum = string.Empty, rest = "";
            int? startRest = 0;

            tokens.MoveNext();
            while (tokens.Current != null)
            {
                if (!string.IsNullOrEmpty(t0 = tokens.Current.Groups["name"].Value.Split(new[] { ':' })[0]))
                {
                    if (!IsSupportedName(t0))
                    {
                        tokens.MoveNext();
                        continue;
                    }

                    if (startRest.HasValue)
                        rest += _renderedMessage.Substring(startRest.Value, tokens.Current.Index - startRest.Value);

                    startRest = null;

                    if (ShouldLocalParse(t0))
                    {
                        LocalParse(ref tokens, sNum);
                    }
                    else if (t0.StartsWith("Timestamp", StringComparison.InvariantCultureIgnoreCase))
                    {
                        DateTimeOffset time;
                        int length;
                        if (ExtractTime(renderedMessage.Substring(tokens.Current.Index + "Timestamp".Length), out time, out length))
                        {
                            _values.Add(new AppenderValue
                                        {
                                            Name = "Timestamp",
                                            Time = time
                                        });

                            tokens.MoveNext();
                            while (tokens.MoveNext() && tokens.Current.Index <= tokens.Current.Index + length);
                        }

                        tokens.MoveNext();
                    }
                    else
                    {
                        if (!tokens.MoveNext())
                            continue;

                        sNum = string.IsNullOrEmpty(tokens.Current.Groups["float"].Value)
                            ? tokens.Current.Groups["int"].Value
                            : tokens.Current.Groups["float"].Value;

                        var sValue = tokens.Current.Groups["word"].Value;

                        if (string.IsNullOrEmpty(sNum) && string.IsNullOrEmpty(sValue))
                        {
                            tokens.MoveNext();
                            continue;
                        }

                        var d = 0.0;
                        if (
                            !Double.TryParse(sNum, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out d) &&
                            string.IsNullOrEmpty(sValue))
                        {
                            tokens.MoveNext();
                            continue;
                        }

                        var v = new AppenderValue
                                {
                                    dValue = d,
                                    sValue = string.IsNullOrEmpty(sValue) ? sNum : sValue,
                                    Name = t0
                                };

                        if (tokens.MoveNext())
                            if (!string.IsNullOrEmpty(unit = tokens.Current.Groups["word"].Value))
                            {
                                v.Unit = unit;
                            }

                        _values.Add(v);
                    }
                }
                else
                {
                    startRest = startRest ?? tokens.Current.Index;
                    tokens.MoveNext();
                }
            }

            if (startRest.HasValue)
                rest += _renderedMessage.Substring(startRest.Value, _renderedMessage.Length - startRest.Value);

            _values.Add(new AppenderValue { Name = "rest", sValue = rest.Trim() });
        }
 protected abstract bool FillName(AppenderValue value);
        protected override bool FillName(AppenderValue value)
        {
            switch (value.Name.ToLowerInvariant())
            {
                case "value":
                    if (_currentDatum.Value != 0.0)
                        return false;

                    _currentDatum.Value = _defaultsOverridePattern ? DefaultValue ?? value.dValue.Value : value.dValue.Value;
                    _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                    break;

                case "unit":
                    if (_currentDatum.Unit != null)
                        return false;

                    if (_defaultsOverridePattern) _currentDatum.Unit = DefaultUnit ?? value.sValue;
                    else _currentDatum.Unit = value.sValue;
                    break;

                case "metricname":
                    if (!string.IsNullOrEmpty(_currentDatum.MetricName))
                        return false;

                    _currentDatum.MetricName = _defaultsOverridePattern ? DefaultMetricName ?? value.sValue : value.sValue;
                    break;

                case "namespace":
                    if (!string.IsNullOrEmpty(_currentDatum.NameSpace))
                        return false;

                    _currentDatum.NameSpace = _defaultsOverridePattern ? DefaultNameSpace ?? value.sValue : value.sValue;
                    break;

                case "maximum":
                    if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Maximum != 0.0)
                        return false;

                    _currentDatum.Maximum = _defaultsOverridePattern ? DefaultMaximum ?? value.dValue.Value : value.dValue.Value;
                    _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                    break;

                case "minimum":
                    if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Minimum != 0.0)
                        return false;
                    _currentDatum.Minimum = _defaultsOverridePattern ? DefaultMinimum ?? value.dValue.Value : value.dValue.Value;
                    _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                    break;

                case "samplecount":
                    if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.SampleCount != 0.0)
                        return false;

                    _currentDatum.SampleCount = _defaultsOverridePattern ? DefaultSampleCount ?? value.dValue.Value : value.dValue.Value;
                    _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                    break;

                case "sum":
                    if (_currentDatum.Mode == DatumMode.StatisticsMode && _currentDatum.Sum != 0.0)
                        return false;

                    _currentDatum.Sum = _defaultsOverridePattern ? DefaultSum ?? value.dValue.Value : value.dValue.Value;
                    _currentDatum.Unit = _defaultsOverridePattern ? DefaultUnit ?? value.Unit : value.Unit;
                    break;

                case "timestamp":
                    if (_currentDatum.Timestamp.HasValue)
                        return false;

                    _currentDatum.Timestamp = _defaultsOverridePattern ? DefaultTimestamp ?? value.Time.Value : value.Time.Value;
                    break;
            }

            return true;
        }