Example #1
0
        /// <summary>
        /// Returns a string representation of the field value.
        /// Useful when text dumping the contents of an event stream.
        /// </summary>
        /// <returns>The field value as a string</returns>
        public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
        {
            if (options.HasFlag(GetValueAsStringOptions.QuotesAroundStrings))
            {
                return('"' + Value + '"');
            }

            return(Value);
        }
Example #2
0
        /// <summary>
        /// Returns a string representation of the field value.
        /// Useful when text dumping the contents of an event stream.
        /// </summary>
        /// <returns>The field value as a string</returns>
        public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
        {
            if (this.Value.Signed)
            {
                return(this.SignedToString());
            }

            return(this.UnsignedToString());
        }
Example #3
0
        /// <summary>
        /// Returns a string representation of the field, name and value.
        /// </summary>
        /// <returns>The field as a string</returns>
        public string ToString(GetValueAsStringOptions options)
        {
            string fieldName = FieldName;

            if (options.HasFlag(GetValueAsStringOptions.TrimBeginningUnderscore) && FieldName.StartsWith("_"))
            {
                fieldName = FieldName.Substring(1);
            }

            return(string.Intern(fieldName + " = " + this.GetValueAsString(options)));
        }
        /// <summary>
        /// Returns a string representation of the field value.
        /// Useful when text dumping the contents of an event stream.
        /// </summary>
        /// <returns>The field value as a string</returns>
        public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
        {
            var sb = new StringBuilder("{ ");

            if (this.Fields.Count > 0)
            {
                sb.Append(this.Fields[0].ToString(options));
            }

            for (int x = 1; x < this.Fields.Count; x++)
            {
                sb.Append(", " + this.Fields[x].ToString(options));
            }

            sb.Append(" }");

            return(string.Intern(sb.ToString()));
        }
        /// <summary>
        /// Returns a string representation of the field value.
        /// Useful when text dumping the contents of an event stream.
        /// </summary>
        /// <returns>The field value as a string</returns>
        public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
        {
            if (this.Value.Length == 0)
            {
                return("[]");
            }

            if (Value[0] is CtfIntegerValue integerValue)
            {
                if (integerValue.Descriptor.Size == 8)
                {
                    string encoding = integerValue.Descriptor.Encoding;
                    if (StringComparer.Ordinal.Equals(encoding, "ASCII") ||
                        StringComparer.Ordinal.Equals(encoding, "UTF8"))
                    {
                        if (options.HasFlag(GetValueAsStringOptions.QuotesAroundStrings))
                        {
                            return('"' + this.ReadAsString() + '"');
                        }

                        return(this.ReadAsString());
                    }
                }
            }

            var sb = new StringBuilder("[ ");

            if (this.Value.Length > 0)
            {
                sb.Append("[0] = " + Value[0].GetValueAsString(options));
            }

            for (uint x = 1; x < this.Value.Length; x++)
            {
                sb.Append($", [{x}] = " + Value[x].GetValueAsString(options));
            }

            sb.Append(" ]");

            return(string.Intern(sb.ToString()));
        }
 /// <summary>
 /// Returns a string representation of the field value.
 /// Useful when text dumping the contents of an event stream.
 /// </summary>
 /// <returns>The field value as a string</returns>
 public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
 {
     return(Value);
 }
 /// <summary>
 /// Returns a string representation of the field value.
 /// Useful when text dumping the contents of an event stream.
 /// </summary>
 /// <returns>The field value as a string</returns>
 public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
 {
     return(string.Intern(Value.ToString(CultureInfo.InvariantCulture)));
 }
Example #8
0
 /// <inheritdoc />
 public override string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions)
 {
     return(string.Intern($"<{Identifier}> {Value.GetValueAsString()}"));
 }
Example #9
0
 /// <summary>
 /// Returns a string representation of the field value.
 /// Useful when text dumping the contents of an event stream.
 /// </summary>
 /// <returns>The field value as a string</returns>
 public abstract string GetValueAsString(GetValueAsStringOptions options = GetValueAsStringOptions.NoOptions);