internal Results(ContentDirectory contentDirectory, string objectId, string sortCriteria, string filter, uint requestCount, uint offset) { this.content_directory = contentDirectory; this.object_id = objectId; this.sort_criteria = sortCriteria; this.filter = filter; this.request_count = requestCount; this.offset = offset; }
public Item GetReferedObject() { if (RefId == null) { throw new InvalidOperationException( "Cannot get refered object because the item is not a reference."); } return(ContentDirectory.GetObject <Item> (RefId)); }
public Object CreateReference(Object target) { // TODO return actual object? That is another network call // (but we're doing network calls anyway, so it's not like // speed is SOOO important if (IsRestricted) { throw new InvalidOperationException( "A reference cannot be created because the parent object is restricted."); } var id = ContentDirectory.Controller.CreateReference(Id, target.Id); return(ContentDirectory.GetObject <Object> (id)); }
void ClientServiceAdded(object sender, ServiceEventArgs args) { if (args.Service.Type != ContentDirectory.ServiceType) return; try { var description = args.Service.GetDescription (); if (description != null) { var controller = description.GetController (); if (controller != null) { var service = new ContentDirectory (new ContentDirectoryController (controller)); OnContentDirectoryAdded (new DiscoveryEventArgs<ContentDirectory> (service)); } } } catch { } }
void ClientServiceAdded(object sender, ServiceEventArgs args) { if (args.Service.Type != ContentDirectory.ServiceType) { return; } try { var description = args.Service.GetDescription(); if (description != null) { var controller = description.GetController(); if (controller != null) { var service = new ContentDirectory(new ContentDirectoryController(controller)); OnContentDirectoryAdded(new DiscoveryEventArgs <ContentDirectory> (service)); } } } catch { } }
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); }
BrowseResults(ContentDirectory contentDirectory, string objectId, string sortCriteria, string filter, uint requestCount, uint offset) : base(contentDirectory, objectId, sortCriteria, filter, requestCount, offset) { }
public BrowseResults(ContentDirectory contentDirectory, string objectId, ResultsSettings settings) : this(contentDirectory, objectId, settings.SortCriteria, settings.Filter, settings.RequestCount, settings.Offset) { }
internal void Deserialize (ContentDirectory contentDirectory, XmlReader reader) { ContentDirectory = contentDirectory; DeserializeRootElement (reader); Verify (); }
public Container GetParent () { return ParentId == "-1" ? null : ContentDirectory.GetObject<Container> (ParentId); }
internal void Deserialize(ContentDirectory contentDirectory, XmlReader reader) { ContentDirectory = contentDirectory; DeserializeRootElement (reader); Verify (); }