Ejemplo n.º 1
0
        public ForStreamCollection <TCollection> Add <TItem>(TItem item)
            where TItem : TCollection
        {
            var applierType = item.GetType();

            if (!AttributeValidation.AttributeTypeEquals(applierType, _restrictedType))
            {
                throw new ForStreamInvalidException(applierType, _restrictedType);
            }

            if (Contains(item))
            {
                throw new InvalidOperationException(string.Format("A member '{0}' already exists in the collection.", applierType.Name));
            }

            _collection.Add(item);

            return(this);
        }
Ejemplo n.º 2
0
        public ForStreamCollection <TCollection> Merge <TItem>(TItem item, FFmpegMergeOptionType optionType)
            where TItem : TCollection
        {
            var applierType = item.GetType();

            if (!AttributeValidation.AttributeTypeEquals(applierType, _restrictedType))
            {
                throw new ForStreamInvalidException(applierType, _restrictedType);
            }

            var indexOfItem = IndexOf(item);

            if (indexOfItem != -1 && optionType == FFmpegMergeOptionType.NewWins)
            {
                _collection.RemoveAt(indexOfItem);
                _collection.Insert(indexOfItem, item);
            }
            else if (indexOfItem == -1)
            {
                _collection.Add(item);
            }

            return(this);
        }
Ejemplo n.º 3
0
        public void ForStreamAttribute_Verify()
        {
            Assert.True(AttributeValidation.AttributeTypeEquals(typeof(ForStreamTestType), typeof(VideoStream)));

            Assert.False(AttributeValidation.AttributeTypeEquals(typeof(ForStreamTestType), typeof(AudioStream)));
        }
Ejemplo n.º 4
0
 private void TestAppliesTo <TFilter>(bool iVideo, bool iAudio)
     where TFilter : IFilter
 {
     Assert.True(iVideo == AttributeValidation.AttributeTypeEquals <TFilter, VideoStream>());
     Assert.True(iAudio == AttributeValidation.AttributeTypeEquals <TFilter, AudioStream>());
 }