Exemplo n.º 1
0
 /// <summary>
 /// Formats the given object.
 /// </summary>
 /// <param name="value">The object to format.</param>
 /// <returns>The formatted value.</returns>
 public override string Format(object value)
 {
     if (value == null)
     {
         return(NullHandler.GetNullRepresentation());
     }
     char[] actual = (char[])value;
     return(new String(actual));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(IColumnContext context, object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            string actual = (string)value;

            return(actual);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            TEnum actual = (TEnum)value;

            return(formatter(actual));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            char actual = (char)value;

            return(actual.ToString(CultureInfo.CurrentCulture));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            bool actual = (bool)value;

            return(actual ? TrueString : FalseString);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            byte[]   actual   = (byte[])value;
            Encoding encoding = Encoding ?? Encoding.Default;

            return(encoding.GetString(actual));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            byte[]   actual         = (byte[])value;
            Encoding actualEncoding = Encoding ?? new UTF8Encoding(false);

            return(actualEncoding.GetString(actual));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(object value)
        {
            object[] values = value as object[];
            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            StringWriter writer = new StringWriter();
            SeparatedValueRecordWriter recordWriter = new SeparatedValueRecordWriter(writer, schema, options);

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Exemplo n.º 9
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(IColumnContext context, object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }

            ushort actual = (ushort)value;

            return(OutputFormat == null
                ? actual.ToString(FormatProvider ?? CultureInfo.CurrentCulture)
                : actual.ToString(OutputFormat, FormatProvider ?? CultureInfo.CurrentCulture));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(IColumnContext context, object value)
        {
            var values = value as object[];

            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            var writer       = new StringWriter();
            var recordWriter = GetWriter(writer);

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Exemplo n.º 11
0
        /// <summary>
        /// Formats the given object array into an embedded record.
        /// </summary>
        /// <param name="value">The object array containing the values of the embedded record.</param>
        /// <returns>A formatted string containing the embedded data.</returns>
        public override string Format(object value)
        {
            var values = value as object[];

            if (values == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            var writer       = new StringWriter();
            var recordWriter = new FixedLengthRecordWriter(writer, schema, Options ?? new FixedLengthOptions());

            recordWriter.WriteRecord(values);
            return(writer.ToString());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="context">Holds information about the column current being processed.</param>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(IColumnContext context, object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }

            Guid actual = (Guid)value;

            if (OutputFormat == null)
            {
                return(actual.ToString());
            }

            return(actual.ToString(OutputFormat));
        }
Exemplo n.º 13
0
        /// <summary>
        /// Formats the given object.
        /// </summary>
        /// <param name="value">The object to format.</param>
        /// <returns>The formatted value.</returns>
        public override string Format(object value)
        {
            if (value == null)
            {
                return(NullHandler.GetNullRepresentation());
            }
            DateTime actual = (DateTime)value;

            if (OutputFormat == null)
            {
                return(actual.ToString(FormatProvider ?? CultureInfo.CurrentCulture));
            }
            else
            {
                return(actual.ToString(OutputFormat, FormatProvider ?? CultureInfo.CurrentCulture));
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Returns null so nothing is written to the document.
 /// </summary>
 /// <param name="value">The value that needs written to the document.</param>
 /// <returns>A null.</returns>
 public override string Format(object value)
 {
     return(NullHandler.GetNullRepresentation());
 }
Exemplo n.º 15
0
 /// <summary>
 /// Returns null so nothing is written to the document.
 /// </summary>
 /// <param name="context">Holds information about the column current being processed.</param>
 /// <param name="value">The value that needs written to the document.</param>
 /// <returns>A null.</returns>
 public override string Format(IColumnContext context, object value)
 {
     return(NullHandler.GetNullRepresentation());
 }