本文整理汇总了C#中IJsonLineInfo类的典型用法代码示例。如果您正苦于以下问题:C# IJsonLineInfo类的具体用法?C# IJsonLineInfo怎么用?C# IJsonLineInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IJsonLineInfo类属于命名空间,在下文中一共展示了IJsonLineInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WithLineInfo
private PackageSpecFormatException WithLineInfo(IJsonLineInfo lineInfo)
{
Line = lineInfo.LineNumber;
Column = lineInfo.LinePosition;
return this;
}
示例2: CreateError
protected ValidationError CreateError(string message, ErrorType errorType, JSchema schema, object value, IList<ValidationError> childErrors, IJsonLineInfo lineInfo, string path)
{
if (_schemaDiscovery == null)
{
_schemaDiscovery = new JSchemaDiscovery();
_schemaDiscovery.Discover(Schema, null);
}
ValidationError error = new ValidationError();
error.Message = message;
error.ErrorType = errorType;
error.Path = path;
if (lineInfo != null)
{
error.LineNumber = lineInfo.LineNumber;
error.LinePosition = lineInfo.LinePosition;
}
error.Schema = schema;
error.SchemaId = _schemaDiscovery.KnownSchemas.Single(s => s.Schema == schema).Id;
error.SchemaBaseUri = schema.BaseUri;
error.Value = value;
error.ChildErrors = childErrors;
return error;
}
示例3: 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;
}
示例4: WithLineInfo
private FileFormatException WithLineInfo(IJsonLineInfo lineInfo)
{
if (lineInfo != null)
{
Line = lineInfo.LineNumber;
Column = lineInfo.LinePosition;
}
return this;
}
示例5: CreateError
protected ValidationError CreateError(string message, ErrorType errorType, JSchema schema, object value, IList<ValidationError> childErrors, IJsonLineInfo lineInfo, string path)
{
if (_schemaDiscovery == null)
{
_schemaDiscovery = new JSchemaDiscovery();
_schemaDiscovery.Discover(Schema, null);
}
Uri schemaId = _schemaDiscovery.KnownSchemas.Single(s => s.Schema == schema).Id;
ValidationError error = ValidationError.CreateValidationError(message, errorType, schema, schemaId, value, childErrors, lineInfo, path);
return error;
}
示例6: 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;
}
示例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 += "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;
}
示例8: 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);
}
示例9: SetLineInfo
internal void SetLineInfo(IJsonLineInfo lineInfo)
{
_lineNumber = lineInfo.LineNumber;
_linePosition = lineInfo.LinePosition;
}
示例10: 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;
}
示例11: CreateValidationError
internal static ValidationError CreateValidationError(IFormattable message, ErrorType errorType, JSchema schema, Uri schemaId, object value, IList<ValidationError> childErrors, IJsonLineInfo lineInfo, string path)
{
ValidationError error = new ValidationError();
error._formattable = message;
error.ErrorType = errorType;
error.Path = path;
if (lineInfo != null)
{
error.LineNumber = lineInfo.LineNumber;
error.LinePosition = lineInfo.LinePosition;
}
error.Schema = schema;
error.SchemaId = schemaId;
error.SchemaBaseUri = schema.BaseUri;
error.Value = value;
error.ChildErrors = childErrors;
return error;
}
示例12: JsonResolveLinkContext
public JsonResolveLinkContext (Type type, JsonSerializer serializer, IJsonLineInfo lineInfo)
{
Type = type;
Serializer = serializer;
LineInfo = lineInfo;
}
示例13: 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);
}
示例14: Create
internal static JSchemaReaderException Create(IJsonLineInfo lineInfo, Uri baseUri, string path, string message)
{
return Create(lineInfo, baseUri, path, message, null);
}
示例15: CreateError
protected ValidationError CreateError(IFormattable message, ErrorType errorType, JSchema schema, object value, IList<ValidationError> childErrors, IJsonLineInfo lineInfo, string path)
{
ValidationError error = ValidationError.CreateValidationError(message, errorType, schema, null, value, childErrors, lineInfo, path);
return error;
}