public void Convert(Region source, Region4 target) { target.StartLine = source.StartLine; target.StartColumn = source.StartColumn; target.EndLine = source.EndLine; target.EndColumn = source.EndColumn; target.ByteOffset = source.ByteOffset; target.ByteLength = source.ByteLength; target.CharOffset = source.CharOffset; target.CharLength = source.CharLength; }
public RegionTable Convert(IList <Region> regions) { RegionTable table = new RegionTable(); for (int i = 0; i < regions.Count; ++i) { Region4 region = new Region4(table); Convert(regions[i], region); } return(table); }
public override RegionTable ReadJson(JsonReader reader, Type objectType, [AllowNull] RegionTable existingValue, bool hasExistingValue, JsonSerializer serializer) { RegionTable result = existingValue ?? new RegionTable(); Expect(reader, JsonToken.StartArray, "List<Region4>"); while (reader.TokenType != JsonToken.EndArray) { Region4 item = result.Add(); DeserializeRegion4(reader, item); } Expect(reader, JsonToken.EndArray, "List<Region4>"); return(result); }
public void DeserializeRegion4(JsonReader reader, Region4 result) { Expect(reader, JsonToken.StartObject, "Region4"); while (reader.TokenType == JsonToken.PropertyName) { string propertyName = reader.Value.ToString(); if (!regionFieldParsers.TryGetValue(propertyName, out Action <JsonReader, Region4> parser)) { throw new NotImplementedException($"Unknown property Region.{propertyName}. Stopping."); } parser(reader, result); reader.Read(); } Expect(reader, JsonToken.EndObject, "Region4"); }