/// <summary>
        /// Determines if a given <see cref="Media"/> can be accepted by the channel,
        /// which it can if it implements interface <see cref="AbstractTextMedia"/>
        /// </summary>
        /// <param name="m">The given media</param>
        /// <returns>A <see cref="bool"/> indicating if the given media can be accepted</returns>
        public override bool CanAccept(urakawa.media.Media m)
        {
            if (!base.CanAccept(m))
            {
                return(false);
            }
            if (m is AbstractTextMedia)
            {
                return(true);
            }

#if ENABLE_SEQ_MEDIA
            if (m is SequenceMedia)
            {
                foreach (Media sm in ((SequenceMedia)m).ChildMedias.ContentsAs_Enumerable)
                {
                    if (!(sm is AbstractTextMedia))
                    {
                        return(false);
                    }
                }
                return(true);
            }
#endif //ENABLE_SEQ_MEDIA

            return(false);
        }
Example #2
0
        /// <summary>
        /// Pre-visit action: If <see cref="Media"/> is present in <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// this is removed and the child <see cref="TreeNode"/>s are not visited
        /// </summary>
        /// <param name="node">The <see cref="TreeNode"/> to visit</param>
        /// <returns>
        /// <c>false</c> if <see cref="Media"/> is found if <see cref="Channel"/> <see cref="ChannelToClear"/>,
        /// <c>false</c> else
        /// </returns>
        public bool PreVisit(TreeNode node)
        {
            ChannelsProperty chProp = node.GetChannelsProperty();

            if (chProp != null)
            {
                urakawa.media.Media m = null;

                //try
                //{
                m = chProp.GetMedia(ChannelToClear);
//                }
//                catch (ChannelDoesNotExistException ex)
//                {
//#if DEBUG
//                    Debugger.Break();
//#endif
//                    return false;
//                }

                if (m != null)
                {
                    chProp.SetMedia(ChannelToClear, null);
                }
            }

            return(true);
        }