Open.Core.PropertyWriter.FormatPropertyValue C# (CSharp) Method

FormatPropertyValue() private static method

private static FormatPropertyValue ( object value, bool hasError ) : string
value object
hasError bool
return string
        private static string FormatPropertyValue(object value, bool hasError)
        {
            // Setup initial conditions.
            bool hasValue = !Script.IsNullOrUndefined(value);

            // Prepare the CSS.
            string cssClass = LogCssClasses.PropertyValue;
            if (hasError) cssClass += " " + LogCssClasses.PropertyError;

            // Prepare the text version of the value.
            string text = hasValue
                              ? String.FormatToString(value)
                              : "<null>".HtmlEncode();
            if (hasValue)
            {
                text = FormatKnownValues(value, text);
                text = Shorten(text.HtmlEncode());
            }

            // Format into SPAN.
            return string.Format("<span class='{0}'>{1}</span>", cssClass, text);
        }