コード例 #1
0
        private async Task <uBaseObject> GetMediaInfo()
        {
            var command = AvCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");

            if (command == null)
            {
                return(null);
            }

            var service = Properties.Services.FirstOrDefault(s => s.ServiceType == ServiceAvtransportType);

            if (service == null)
            {
                throw new InvalidOperationException("Unable to find service");
            }

            var result = await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, RendererCommands.BuildPost(command, service.ServiceType), false)
                         .ConfigureAwait(false);

            if (result == null || result.Document == null)
            {
                return(null);
            }

            var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();

            if (track == null)
            {
                return(null);
            }

            var e = track.Element(uPnpNamespaces.items) ?? track;

            return(UpnpContainer.Create(e));
        }
コード例 #2
0
 public static uBaseObject CreateObjectFromXML(uParserObject uItem)
 {
     return(UpnpContainer.Create(uItem.Element));
 }