-Added ITraceWriter

-Fixed .NET 2.0 build using DateTimeOffset
This commit is contained in:
James Newton-King
2012-11-09 17:10:32 +13:00
parent 12b60f2fca
commit 89883dc57b
36 changed files with 870 additions and 117 deletions
+26
View File
@@ -23,8 +23,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json
{
@@ -85,5 +88,28 @@ namespace Newtonsoft.Json
return sb.ToString();
}
internal static string FormatMessage(IJsonLineInfo lineInfo, string path, string message)
{
// don't add a fullstop and space when message ends with a new line
if (!message.EndsWith(Environment.NewLine))
{
message = message.Trim();
if (!message.EndsWith("."))
message += ".";
message += " ";
}
message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
if (lineInfo != null && lineInfo.HasLineInfo())
message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
message += ".";
return message;
}
}
}