本文整理汇总了C#中IJsonLineInfo.HasLineInfo方法的典型用法代码示例。如果您正苦于以下问题:C# IJsonLineInfo.HasLineInfo方法的具体用法?C# IJsonLineInfo.HasLineInfo怎么用?C# IJsonLineInfo.HasLineInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJsonLineInfo
的用法示例。
在下文中一共展示了IJsonLineInfo.HasLineInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatMessage
internal static string FormatMessage(IJsonLineInfo lineInfo, string path, string message)
{
if (!message.EndsWith(Environment.NewLine, StringComparison.Ordinal))
{
message = message.Trim();
if (!message.EndsWith('.'))
message += ".";
}
if (path == null && !lineInfo.HasLineInfo())
return message;
message += " ";
if (path != null)
{
message += "Path '{0}'".FormatWith(CultureInfo.InvariantCulture, path);
if (lineInfo != null && lineInfo.HasLineInfo())
message += ", line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
}
else
{
message += "Line {0}, position {1}".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
}
message += ".";
return message;
}
示例2: FormatExceptionMessage
internal static string FormatExceptionMessage(IJsonLineInfo lineInfo, string path, string message)
{
if (!message.EndsWith(Environment.NewLine))
{
message = message.Trim();
if (!message.EndsWith("."))
message = message + ".";
message = message + " ";
}
message = message + StringUtils.FormatWith("Path '{0}'", (IFormatProvider) CultureInfo.InvariantCulture, (object) path);
if (lineInfo != null && lineInfo.HasLineInfo())
message = message + StringUtils.FormatWith(", line {0}, position {1}", (IFormatProvider) CultureInfo.InvariantCulture, (object) lineInfo.LineNumber, (object) lineInfo.LinePosition);
message = message + ".";
return message;
}
示例3: FormatMessage
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(".", StringComparison.Ordinal))
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;
}
示例4: Create
internal static JsonReaderException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex)
{
message = JsonPosition.FormatMessage(lineInfo, path, message);
int lineNumber;
int linePosition;
if (lineInfo != null && lineInfo.HasLineInfo())
{
lineNumber = lineInfo.LineNumber;
linePosition = lineInfo.LinePosition;
}
else
{
lineNumber = 0;
linePosition = 0;
}
return new JsonReaderException(message, ex, path, lineNumber, linePosition);
}
示例5: FormatExceptionMessage
internal static string FormatExceptionMessage(IJsonLineInfo lineInfo, string message)
{
if (!message.EndsWith("."))
message += ".";
if (lineInfo != null && lineInfo.HasLineInfo())
message += " Line {0}, position {1}.".FormatWith(CultureInfo.InvariantCulture, lineInfo.LineNumber, lineInfo.LinePosition);
return message;
}
示例6: CreateReaderException
internal JsonReaderException CreateReaderException(IJsonLineInfo lineInfo, string message, Exception ex)
{
message = FormatExceptionMessage(lineInfo, message);
int lineNumber;
int linePosition;
if (lineInfo != null && lineInfo.HasLineInfo())
{
lineNumber = lineInfo.LineNumber;
linePosition = lineInfo.LinePosition;
}
else
{
lineNumber = 0;
linePosition = 0;
}
return new JsonReaderException(message, ex, lineNumber, linePosition);
}
示例7: FormatExceptionMessage
internal static string FormatExceptionMessage(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 += string.Format("Path '{0}'", path);
if (lineInfo != null && lineInfo.HasLineInfo())
message += string.Format(", line {0}, position {1}", lineInfo.LineNumber, lineInfo.LinePosition);
message += ".";
return message;
}
示例8: FormatExceptionMessage
internal static string FormatExceptionMessage(IJsonLineInfo lineInfo, string path, string message)
{
message = message.Trim();
if (!message.EndsWith("."))
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;
}