コード例 #1
0
ファイル: Results.cs プロジェクト: MustafaUzumcuCom/mono-upnp
 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;
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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 {
            }
        }
コード例 #5
0
        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 {
            }
        }
コード例 #6
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);
        }
コード例 #7
0
 BrowseResults(ContentDirectory contentDirectory, string objectId,
               string sortCriteria, string filter, uint requestCount, uint offset)
     : base(contentDirectory, objectId, sortCriteria, filter, requestCount, offset)
 {
 }
コード例 #8
0
 public BrowseResults(ContentDirectory contentDirectory, string objectId, ResultsSettings settings)
     : this(contentDirectory, objectId, settings.SortCriteria,
            settings.Filter, settings.RequestCount, settings.Offset)
 {
 }
コード例 #9
0
ファイル: Object.cs プロジェクト: MustafaUzumcuCom/mono-upnp
        internal void Deserialize (ContentDirectory contentDirectory, XmlReader reader)
        {
			ContentDirectory = contentDirectory;
            DeserializeRootElement (reader);
            Verify ();
        }
コード例 #10
0
ファイル: Object.cs プロジェクト: MustafaUzumcuCom/mono-upnp
		public Container GetParent ()
		{
			return ParentId == "-1" ? null : ContentDirectory.GetObject<Container> (ParentId);
		}
コード例 #11
0
ファイル: Object.cs プロジェクト: MustafaUzumcuCom/mono-upnp
 internal void Deserialize(ContentDirectory contentDirectory, XmlReader reader)
 {
     ContentDirectory = contentDirectory;
     DeserializeRootElement (reader);
     Verify ();
 }