public void Serialize(object value, MediaRange mediaRange, Stream output)
        {
            var property = value as ProfilePropertyData;
            if (property == null)
                return;

            var obj = property.Value;
            if (obj == null)
                return;

            using (var wrt = new StreamWriter(output))
                wrt.Write(obj);
        }
 public bool CanDeserialize(Type type, object target, MediaRange mediaRange)
 {
     return type == typeof(ProfilePropertyRequest) && mediaRange == "text/plain";
 }
示例#3
0
 public void Serialize(object value, MediaRange mediaRange, Stream output)
 {
     using (var jsonWriter = new JsonTextWriter(new StreamWriter(output)))
         serializer.Serialize(jsonWriter, value);
 }
示例#4
0
 public bool CanSerialize(object value, MediaRange mediaRange)
 {
     return IsJsonType(mediaRange);
 }
 public bool CanSerialize(object value, MediaRange mediaRange)
 {
     return value is ProfilePropertyData && mediaRange == "text/plain";
 }
示例#6
0
 public bool CanDeserialize(Type type, object target, MediaRange mediaRange)
 {
     return IsJsonType(mediaRange);
 }
示例#7
0
        /// <summary>
        /// Whether or not a media range matches another, taking into account wildcards and parameters.
        /// </summary>
        /// <param name="other">Other media range.</param>
        /// <returns>True if matching, false if not.</returns>
        public bool MatchesWithParameters(MediaRange other)
        {
            Contract.Requires<ArgumentNullException>(other != null);

            return Matches(other) && parameters.Matches(other.parameters);
        }
示例#8
0
        /// <summary>
        /// Whether or not a media range matches another, taking into account wildcards.
        /// </summary>
        /// <param name="other">Other media range.</param>
        /// <returns>True if matching, false if not.</returns>
        public bool Matches(MediaRange other)
        {
            Contract.Requires<ArgumentNullException>(other != null);

            return type.Matches(other.type) && subtype.Matches(other.subtype);
        }