Exemplo n.º 1
0
            // --

            public static Link ParseLink(JToken json)
            {
                if (json == null)
                {
                    return(null);
                }
                String  linkType = (string)json["type"];
                JObject value    = (JObject)json["value"];

                switch (linkType)
                {
                case "Link.web":
                    return(WebLink.Parse(value));

                case "Link.document":
                    return(DocumentLink.Parse(value));

                case "Link.file":
                    return(FileLink.Parse(value));

                case "Link.image":
                    return(ImageLink.Parse(value));
                }
                return(null);
            }
Exemplo n.º 2
0
            public static Fragment Parse(String type, JToken json)
            {
                switch (type)
                {
                case "StructuredText":
                    return(StructuredText.Parse(json));

                case "Image":
                    return(Image.Parse(json));

                case "Link.web":
                    return(WebLink.Parse(json));

                case "Link.document":
                    return(DocumentLink.Parse(json));

                case "Link.file":
                    return(FileLink.Parse(json));

                case "Link.image":
                    return(ImageLink.Parse(json));

                case "Text":
                    return(Text.Parse(json));

                case "Select":
                    return(Text.Parse(json));

                case "Date":
                    return(Date.Parse(json));

                case "Timestamp":
                    return(Timestamp.Parse(json));

                case "Number":
                    return(Number.Parse(json));

                case "Color":
                    return(Color.Parse(json));

                case "Embed":
                    return(Embed.Parse(json));

                case "GeoPoint":
                    return(GeoPoint.Parse(json));

                case "Group":
                    return(Group.Parse(json));

                case "SliceZone":
                    return(SliceZone.Parse(json));

                default:
                    return(json != null?Raw.Parse(json) : null);
                }
            }