Ejemplo n.º 1
0
        /// <summary>
        /// Creates a playlist asset picker
        /// </summary>
        /// <param name="playlist">The playlist to search in</param>
        /// <param name="assetScheduler">AssetScheduler object to determine if an asset has temporal availability</param>
        /// <param name="displayMessageAssetDisplayLength">Display length of the "no assets" asset</param>
        /// <param name="assetFilePath">Directory path of the playlist assets</param>
        /// <param name="requestTimeout">The number of seconds to wait before the request for testing net/website availability times out</param>
        /// <param name="bErrorOnSetup">If an error occurred on setup, an asset won't be attempted</param>
        public PlaylistAssetPicker(Playlist playlist,
                                   AssetScheduler assetScheduler,
                                   float displayMessageAssetDisplayLength,
                                   string assetFilePath,
                                   int requestTimeout,
                                   bool bErrorOnSetup,
                                   Logger logger,
                                   bool bInsufficientMemoryForLargeFiles)
        {
            _consumedChannelBuckets        = new HashSet <ChannelBucket>();
            _consumedContentPlaylistAssets = new HashSet <ContentPlaylistAsset>();
            _random = new RNGCryptoServiceProvider();
            _logger = logger;

            _bErrorOnSetup = bErrorOnSetup;

            _displayMessageAssetDisplayLength = displayMessageAssetDisplayLength;

            if (_bErrorOnSetup)
            {
                _logger.WriteMessage("There was an error on initial setup; remaining Picker members will not be initialised.");
                return;
            }

            _playlist          = playlist;
            _assetScheduler    = assetScheduler;
            _noChannelBuckets  = playlist.ChannelBuckets.Count;
            _noPlaylistAdverts = playlist.AdvertBucket.AdvertAssets.Count;
            _assetFilePath     = assetFilePath;
            _requestTimeout    = requestTimeout;
            _randomNumbers     = new byte[8];
            _bInsufficientMemoryForLargeFiles = bInsufficientMemoryForLargeFiles;

            _logger.WriteMessage("Picker members all initialised.");
        }
Ejemplo n.º 2
0
        public void PickRandomContentPlaylistAssetTest()
        {
            Playlist             playlist       = (Playlist)Serializer.Deserialize(typeof(Playlist), @"c:\OxigenIIAppDataSamples\AppData\ss_play_list.dat", true, "password");
            AssetScheduler       assetScheduler = new AssetScheduler();
            ContentPlaylistAsset actual;

            PlaylistAssetPicker cpp = new PlaylistAssetPicker(playlist, assetScheduler);

            actual = cpp.SelectAsset();

            Assert.IsNotNull(actual);
        }
Ejemplo n.º 3
0
        public void PickRandomContentPlaylistAssetTest1()
        {
            Playlist             playlist       = null;                                              // TODO: Initialize to an appropriate value
            AssetScheduler       assetScheduler = null;                                              // TODO: Initialize to an appropriate value
            PlaylistAssetPicker  target         = new PlaylistAssetPicker(playlist, assetScheduler); // TODO: Initialize to an appropriate value
            ContentPlaylistAsset expected       = null;                                              // TODO: Initialize to an appropriate value
            ContentPlaylistAsset actual;

            actual = target.SelectAsset();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Ejemplo n.º 4
0
        public void TestOverflow()
        {
            AssetScheduler target = new AssetScheduler();

            string[] inputConditionsCollection = new string[1];

            inputConditionsCollection[0] = "dayofmonth > 10000000000000000000000000000000000000000000000000000000000000000000000";

            bool expected = false;
            bool actual;

            actual = target.IsAssetPlayable(inputConditionsCollection);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void IsAssetPlayableTest7()
        {
            AssetScheduler target = new AssetScheduler();

            string[] inputConditionsCollection = new string[1];

            inputConditionsCollection[0] = " time > 1400 and time < 1900 ";

            bool expected = false;
            bool actual;

            actual = target.IsAssetPlayable(inputConditionsCollection);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 6
0
        public void IsAssetPlayableIndividualLine2()
        {
            AssetScheduler assetScheduling = new AssetScheduler();

            PrivateObject           assetSchedulingPrivateObj = new PrivateObject(assetScheduling);
            AssetScheduler_Accessor target = new AssetScheduler_Accessor(assetSchedulingPrivateObj);

            string inputCondition = "time>1550 and time<2000 and dayofweek < Thursday";

            bool expected = false;
            bool actual;

            actual = target.IsAssetPlayableIndividualLine(inputCondition);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void IsAssetPlayableTest4()
        {
            AssetScheduler target = new AssetScheduler();

            string[] inputConditionsCollection = new string[3];

            inputConditionsCollection[0] = "time>1550 and time<1730 and dayofweek < Thursday";
            inputConditionsCollection[1] = "time>1550 and time<1730 and dayofweek >= Thursday and month>=7 and month<=9";
            inputConditionsCollection[2] = "dayofmonth = 8";

            bool expected = false;
            bool actual;

            actual = target.IsAssetPlayable(inputConditionsCollection);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Default constructor that runs the screensaver in normal mode
        /// </summary>
        /// <param name="screenNo">index number of screen to run screensaver on</param>
        /// <param name="playlist">The playlist from which to draw assets</param>
        /// <param name="advertDisplayThreshold">threshold to determine whether to display an asset or an advert as the next asset</param>
        /// <param name="bErrorOnSetup">When error has occurred during setting up, screen saver will not run in normal mode</param>
        public ScreenSaver(int screenNo, Playlist playlist, float advertDisplayThreshold,
                           float protectedContentTime, float displayMessageAssetDisplayLength, int requestTimeout,
                           bool bMuteFlash, bool bMuteVideo, int flashVolume, int videoVolume,
                           bool bErrorOnSetup, string displayMessage, string appToRun,
                           string tempDecryptPath, string assetPath, bool bInsufficientMemoryForLargeFiles, float defaultDisplayLength, Logger logger)
        {
            _logger = logger;

            InitializeComponent();

            _logger.WriteTimestampedMessage("successfully InitializeComponent.");

            Cursor.Hide();

            _logger.WriteTimestampedMessage("successfully hidden the cursor.");

            this.ShowInTaskbar = false;

            _logger.WriteTimestampedMessage("successfully removed from taskbar.");

            _screenNo = screenNo;

            _logSingletonAccessor = new LogSingletonAccessor();

            _logger.WriteTimestampedMessage("successfully created a LogSingletonAccessor object.");

            _advertDisplayThreshold           = advertDisplayThreshold;
            _protectedContentTime             = protectedContentTime;
            _displayMessageAssetDisplayLength = displayMessageAssetDisplayLength == -1F ? 15F : displayMessageAssetDisplayLength;
            _requestTimeout = requestTimeout;
            _bErrorOnSetup  = bErrorOnSetup;
            _bInsufficientMemoryForLargeFiles = bInsufficientMemoryForLargeFiles;
            _displayMessage       = displayMessage;
            _appToRun             = appToRun;
            _tempDecryptPath      = tempDecryptPath;
            _assetPath            = assetPath;
            _defaultDisplayLength = defaultDisplayLength;

            _bPrimaryMonitor = IsPrimaryMonitor();

            if (!_bErrorOnSetup)
            {
                _bMuteFlash = bMuteFlash;
                _bMuteVideo = bMuteVideo;

                _flashVolume = flashVolume;
                _videoVolume = videoVolume;
            }

            if (_bErrorOnSetup)
            {
                _assetPath = "";
            }

            _logger.WriteTimestampedMessage("successfully allocated global variables.");

            _assetScheduler = new AssetScheduler();

            _logger.WriteTimestampedMessage("successfully created an AssetScheduler object.");

            _playlistAssetPicker = new PlaylistAssetPicker(playlist, _assetScheduler, _displayMessageAssetDisplayLength, assetPath,
                                                           _requestTimeout, _bErrorOnSetup, _logger, _bInsufficientMemoryForLargeFiles);

            _logger.WriteTimestampedMessage("successfully created a PlaylistAssetPicker object.");

            _stopwatch = new Stopwatch();

            _logger.WriteTimestampedMessage("successfully created a Stopwatch object.");

            _players = new PlayerContainer();

            if (PlayerContainer.QuickTimeRightVersionExists())
            {
                _players.Add(PlayerType.VideoQT, new QuicktimePlayer(_bMuteVideo, _videoVolume, _logger));
            }

            if (PlayerContainer.WindowsMediaPlayerRightVersionExists())
            {
                _players.Add(PlayerType.VideoNonQT, new WindowsMediaPlayer(_bMuteVideo, _videoVolume, _logger));
            }

            // these players always exist
            _players.Add(PlayerType.Flash, new FlashPlayer(bMuteFlash, _logger));
            _players.Add(PlayerType.Image, new ImagePlayer());
            _players.Add(PlayerType.WebSite, new WebsitePlayer(_logger));
            _players.Add(PlayerType.NoAssetsAnimator, new NoAssetsPlayer());

            foreach (IPlayer player in _players.AllPlayers())
            {
                Controls.Add(player.Control);
            }

            //Control.CheckForIllegalCrossThreadCalls = false;

            // set z-index of all containers/players to the same value
            int index = 2;

            foreach (IPlayer player in _players.AllPlayers())
            {
                _logger.WriteMessage(player.GetType() + " index set to " + index);
                Controls.SetChildIndex(player.Control, index);
                index++;
            }

            _currentSlide            = new Slide(_players.APlayers);
            _previousSlide           = new Slide(_players.BPlayers);
            _faderForm               = new FaderForm();
            _ddFormFader             = new DDFormFader(_faderForm.Handle);
            _faderForm.StartPosition = FormStartPosition.Manual;
            AddOwnedForm(_faderForm);

            _logger.WriteTimestampedMessage("successfully added the fader form as a form owned by the Screensaver Form.");
        }