Exemple #1
0
        internal void StartMe()
        {
            this.configHost.Open();

            //Ak este neexistuju nastavenie je vyhlasena chyba
            try
            {
                MediaCenter.LoadSettings();
            }
            catch { }

            //Aj ked sa nepodari spustit MediaCenter, stale je zapnuty ConfigHost
            try
            {
                MediaCenter.Start();
                MediaCenter.IItemManager.BuildDatabaseAsync();
            }
            catch { }
        }
        /// <summary>
        /// Starts the UPnP server.
        /// </summary>
        public static void Start()
        {
            if (IsRunning)
            {
                Log.Info("An UPnP/DLNA server start was requested, but it is already running.");
                Stop();
            }

            if (!Signature.IsActivated)
            {
                Log.Error("An UPnP/DLNA server start was requested, but the software is not activated.");
                return;
            }

            Log.Info("Starting UPnP/DLNA server...");

            _ms = new MediaServerDevice(_di, null, true, "http-get:*:*:*", "");
            _dw = new UPnPDeviceWatcher(_ms._Device);

            var dv = _ms.GetUPnPDevice();

            if (_favicon == null)
            {
                _favicon = new Icon(Application.GetResourceStream(new Uri("pack://application:,,,/RSTVShowTracker;component/tv.ico")).Stream);
                _icon    = new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/RSTVShowTracker;component/Images/tv48.png")).Stream);
                _icon2   = new Bitmap(Application.GetResourceStream(new Uri("pack://application:,,,/RSTVShowTracker;component/Images/tv64.png")).Stream);
            }

            dv.favicon = _favicon;
            dv.Icon    = _icon;
            dv.Icon2   = _icon2;

            _ms.Start();

            IsRunning = true;

            _mimes = new HashSet <string>();

            RebuildList();
        }