Exemplo n.º 1
0
        protected override IDictionary <string, MediaCategory> GetAllAvailableCategories()
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(new Dictionary <string, MediaCategory>(
                       ris.GetMediaCategoriesFromMetadataExtractors().ToDictionary(mediaCategory => mediaCategory.CategoryName)));
        }
Exemplo n.º 2
0
        protected static IResourceInformationService GetResourceInformationService()
        {
            IResourceInformationService ris = ServiceRegistration.Get <IServerConnectionManager>().ResourceInformationService;

            if (ris != null)
            {
                return(ris);
            }
            throw new NotConnectedException();
        }
Exemplo n.º 3
0
        protected IResourceInformationService GetResourceInformationService(string systemId)
        {
            IResourceInformationService result = FindResourceInformationService(systemId);

            if (result == null)
            {
                throw new NotConnectedException("The system '{0}' is not connected", systemId);
            }
            return(result);
        }
Exemplo n.º 4
0
 public static string GetServerResourcePathDisplayName(ResourcePath path)
 {
     try
     {
         IResourceInformationService ris = GetResourceInformationService();
         return(ris.GetResourcePathDisplayName(path));
     }
     catch (Exception e)
     {
         ServiceRegistration.Get <ILogger>().Warn("Problem updating display name of choosen path '{0}'", e, path);
         return(string.Empty);
     }
 }
Exemplo n.º 5
0
        public bool GetFileHttpUrl(string nativeSystemId, ResourcePath nativeResourcePath, out string fileHttpUrl, out IPAddress localIpAddress)
        {
            fileHttpUrl    = null;
            localIpAddress = null;
            IResourceInformationService ris = FindResourceInformationService(nativeSystemId);

            if (ris == null)
            {
                return(false);
            }
            fileHttpUrl = ResourceHttpAccessUrlUtils.GetResourceURL(ris.GetResourceServerBaseURL(out localIpAddress), nativeResourcePath);
            return(true);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Checks if there is a resource information UPnP service available on the system with the
 /// given <paramref name="systemId"/>.
 /// </summary>
 /// <param name="systemId">Id of the system to check.</param>
 /// <returns>Proxy object to access the resource information service at the system with the given
 /// <paramref name="systemId"/> or <c>null</c>, if the system neither provides an MP2 client nor an MP2 server.</returns>
 protected IResourceInformationService FindResourceInformationService(string systemId)
 {
     lock (_networkTracker.SharedControlPointData.SyncObj)
         foreach (RootDescriptor rootDeviceDescriptor in _networkTracker.KnownRootDevices.Values)
         {
             if (rootDeviceDescriptor.State == RootDescriptorState.Ready && rootDeviceDescriptor.SSDPRootEntry.RootDeviceUUID == systemId)
             {
                 IResourceInformationService ris = TryGetResourceInformationService(rootDeviceDescriptor);
                 if (ris != null)
                 {
                     return(ris);
                 }
             }
         }
     return(null);
 }
Exemplo n.º 7
0
        public static ResourceProviderMetadata GetServerResourceProviderMetadata(Guid resourceProviderId)
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(ris.GetResourceProviderMetadata(resourceProviderId));
        }
Exemplo n.º 8
0
        protected override IEnumerable <ResourceProviderMetadata> GetAvailableBaseResourceProviders()
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(new List <ResourceProviderMetadata>(ris.GetAllBaseResourceProviderMetadata()));
        }
Exemplo n.º 9
0
        protected override IEnumerable <ResourcePathMetadata> GetChildDirectoriesData(ResourcePath path)
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(ris.GetChildDirectoriesData(path));
        }
Exemplo n.º 10
0
        protected override bool GetIsPathValid(ResourcePath path)
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(ris.DoesResourceExist(path));
        }
Exemplo n.º 11
0
        protected override ResourcePath ExpandResourcePathFromString(string path)
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(ris.ExpandResourcePathFromString(BaseResourceProvider.ResourceProviderId, path));
        }
Exemplo n.º 12
0
        protected override string SuggestShareName()
        {
            IResourceInformationService ris = GetResourceInformationService();

            return(ris.GetResourceDisplayName(ChoosenResourcePath));
        }