public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.Value == null)
            {
                return null;
            }

            var coordinatesArray = serializer.Deserialize<double[]>(reader);

            if (coordinatesArray == null)
            {
                return null;
            }

            var coordinates = new CoordinatesDTO(coordinatesArray[0], coordinatesArray[1]);

            if (objectType == typeof(List<ICoordinates>[]))
            {
                return new []
                {
                    new List<ICoordinates>
                    {
                        coordinates
                    }
                };
            }

            return coordinates;
        }
示例#2
0
 public bool PublishWithGeoInReplyTo(double longitude, double latitude, long replyToTweetId)
 {
     var coordinates = new CoordinatesDTO(longitude, latitude);
     return PublishWithGeoInReplyTo(coordinates, replyToTweetId);
 }
示例#3
0
 public bool PublishWithGeo(double longitude, double latitude)
 {
     var coordinates = new CoordinatesDTO(longitude, latitude);
     return PublishWithGeo(coordinates);
 }