public static RemoteResource NewRoot(String linkFormat, int mediaType = MediaType.ApplicationLinkFormat) { switch (mediaType) { case MediaType.ApplicationLinkFormat: return(LinkFormat.Deserialize(linkFormat)); case MediaType.ApplicationJson: return(LinkFormat.DeserializeJson(linkFormat)); default: throw new ArgumentException("Unrecognized media type"); } }
public static RemoteResource NewRoot(byte[] linkFormat, int mediaType = MediaType.ApplicationLinkFormat) { switch (mediaType) { case MediaType.ApplicationLinkFormat: return(LinkFormat.Deserialize(Encoding.UTF8.GetString(linkFormat))); case MediaType.ApplicationCbor: return(LinkFormat.DeserializeCbor(linkFormat)); case MediaType.ApplicationJson: return(LinkFormat.DeserializeJson(Encoding.UTF8.GetString(linkFormat))); default: throw new ArgumentException("Unrecognized media type"); } }
public static RemoteResource NewRoot(String linkFormat) { return(LinkFormat.Deserialize(linkFormat)); }