示例#1
0
        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");
            }
        }
示例#2
0
        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");
            }
        }
示例#3
0
 public static RemoteResource NewRoot(String linkFormat)
 {
     return(LinkFormat.Deserialize(linkFormat));
 }