Ejemplo n.º 1
0
        /// <summary>
        /// Finds the parts.
        /// </summary>
        protected override void FindParts()
        {
            base.FindParts();

            if (IsFirstRun)
            {
                RegisterServerWithAdministratorAccess();
            }

            Parallel.Invoke(

                () =>
            {
                HttpServer.Init(GetExports <IRestfulService>(false));

                ServerManager.AddWebSocketListeners(GetExports <IWebSocketListener>(false));
                ServerManager.Start();
            },

                () => LibraryManager.AddParts(GetExports <IResolverIgnoreRule>(), GetExports <IVirtualFolderCreator>(), GetExports <IItemResolver>(), GetExports <IIntroProvider>(), GetExports <IBaseItemComparer>()),

                () => ProviderManager.AddMetadataProviders(GetExports <BaseMetadataProvider>().OrderBy(e => e.Priority).ToArray())
                );

            UdpServer = new UdpServer(Logger, NetworkManager, ServerConfigurationManager);

            try
            {
                UdpServer.Start(UdpServerPort);
            }
            catch (SocketException ex)
            {
                Logger.ErrorException("Failed to start UDP Server", ex);
            }
        }