コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SsdpServerPublisher"/> class.
        /// </summary>
        /// <param name="configuration">The <see cref="IConfigurationManager"/> instance.</param>
        /// <param name="logger">The <see cref="ILogger"/> instance.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFacory"/> instance.</param>
        /// <param name="networkManager">The <see cref="INetworkManager"/> instance.</param>
        /// <param name="interfaces">The interfaces IP's to advertise on.</param>
        /// <param name="messageInterval">The discovery message interval.</param>
        /// <param name="enableWindowsSupport">True to enable windows support.</param>
        public SsdpServerPublisher(
            IConfigurationManager configuration,
            ILogger logger,
            ILoggerFactory loggerFactory,
            INetworkManager networkManager,
            IPNetAddress[] interfaces,
            int messageInterval,
            bool enableWindowsSupport)
        {
            _aliveMessageInterval = messageInterval;
            _devices              = new List <SsdpRootDevice>();
            _logger               = logger;
            _networkManager       = networkManager;
            _random               = new Random();
            _readOnlyDevices      = new ReadOnlyCollection <SsdpRootDevice>(_devices);
            _recentSearchRequests = new Dictionary <string, SearchRequest>(StringComparer.OrdinalIgnoreCase);

            Server = SsdpServer.GetOrCreateInstance(
                configuration,
                loggerFactory,
                interfaces,
                networkManager);

            DlnaServerPlugin.Instance !.ConfigurationChanging += UpdateConfiguration;
            _networkManager.NetworkChanged += NetworkChanged;
            EnableWindowsExplorerSupport    = enableWindowsSupport;

            _logger.LogDebug("DLNA Server : Starting DLNA advertisements using DLNA version {Version}", Server.DlnaVersion.ToString());
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SsdpServerPublisher"/> class.
        /// </summary>
        /// <param name="dlnaServerManager">The <see cref="IDlnaServerManager"/> instance.</param>
        /// <param name="configuration">The <see cref="IConfigurationManager"/> instance.</param>
        /// <param name="logger">The <see cref="ILogger"/> instance.</param>
        /// <param name="loggerFactory">The <see cref="ILoggerFacory"/> instance.</param>
        /// <param name="networkManager">The <see cref="INetworkManager"/> instance.</param>
        public SsdpServerPublisher(
            IDlnaServerManager dlnaServerManager,
            IConfigurationManager configuration,
            ILogger logger,
            ILoggerFactory loggerFactory,
            INetworkManager networkManager)
        {
            _dlnaServerManager    = dlnaServerManager;
            _networkManager       = networkManager;
            _logger               = logger;
            _devices              = new List <SsdpRootDevice>();
            _readOnlyDevices      = new ReadOnlyCollection <SsdpRootDevice>(_devices);
            _recentSearchRequests = new Dictionary <string, SearchRequest>(StringComparer.OrdinalIgnoreCase);
            _random               = new Random();

            Server = SsdpServer.GetOrCreateInstance(
                configuration,
                loggerFactory,
                networkManager.GetInternalBindAddresses(),
                networkManager);

            _dlnaServerManager.ConfigurationChanged += UpdateConfiguration;
            _networkManager.NetworkChanged          += NetworkChanged;
        }