Exemplo n.º 1
0
        internal static WebFile FromDbValue(WebFile file, string content, TypeBase type)
        {
            /*if (url == null) return null;
            var u = url.AsUri();
            var file =
                type == TypeBase.WebImage ? WebImage.FromUrl(u) :
                type == TypeBase.WebAudio ? WebAudio.FromUrl(u) :
                type == TypeBase.WebVideo ? WebVideo.FromUrl(u) :
                WebFile.FromUrl(u);
                */
            if (content != null)
            {
                var serializer = new JsonSerializer();

                serializer.AddAwdeeConverters();
                using (var sr = new StringReader(content))
                using (var jr = Utils.CreateJsonReader(sr))
                {
                    serializer.Deserialize(jr, type.NativeType);
                }

            }

            return file;
        }