예제 #1
0
        internal void FetchResults()
        {
            uint returned_count, total_count, update_id;
            var  xml = FetchXml(out returned_count, out total_count, out update_id);

            ReturnedCount = returned_count;
            TotalCount    = total_count;
            if (content_directory.CheckIfContainerIsOutOfDate(object_id, update_id) && offset != 0)
            {
                IsOutOfDate = true;
            }
            else
            {
                foreach (var result in content_directory.Deserialize <T> (filter, xml))
                {
                    results.Add(result);
                }
            }
        }
예제 #2
0
        public T CreateObject <T> (ObjectBuilder builder) where T : Object
        {
            // TODO update resources
            var xml = new StringBuilder();

            using (var stream = new StringWriter(xml)) {
                using (var writer = XmlWriter.Create(stream)) {
                    writer.WriteStartElement("DIDL-Lite", Schemas.DidlLiteSchema);
                    writer.WriteAttributeString("xmlns", "dc", null, Schemas.DublinCoreSchema);
                    writer.WriteAttributeString("xmlns", "upnp", null, Schemas.UpnpSchema);
                    var serializer = new XmlSerializer(builder.GetType());
                    serializer.Serialize(writer, builder);
                }
            }
            var @object = ContentDirectory.Controller.CreateObject(Id, xml.ToString());

            foreach (var result in ContentDirectory.Deserialize <T> ("*", @object))
            {
                return(result);
            }
            return(null);
        }