예제 #1
0
        public T FromEntity <T>(IMediaSourceEntity entity) where T : IMediaSource
        {
            IMediaSource    result     = null;
            MediaFileEntity fileEntity = entity as MediaFileEntity;

            if (fileEntity != null)
            {
                var fileSource = new FileMediaSource(fileEntity);
                result = fileSource;
            }
            else
            {
                ChannelInfo ci = entity as ChannelInfo;
                if (ci != null)
                {
                    var channelSource = new ChannelMediaSource(ci);
                    result = channelSource;
                }
                else
                {
                    throw new ArgumentException();
                }
            }
            return((T)result);
        }
예제 #2
0
        public static IMediaSource ToMediaSource(this MediaSourceEntity entity, PlaybillItemEntity billItemEntity)
        {
            IMediaSource    result     = null;
            MediaFileEntity fileEntity = entity as MediaFileEntity;

            if (fileEntity != null)
            {
                var fileSource = new FileMediaSource(fileEntity);
                fileSource.AudioGain = billItemEntity.AudioGain;
                result = fileSource;
            }
            else
            {
                ChannelInfo ci = entity as ChannelInfo;
                if (ci != null)
                {
                    var channelSource = new ChannelMediaSource(ci);
                    result = channelSource;
                }
                else
                {
                    throw new ArgumentException();
                }
            }
            return(result);
        }
예제 #3
0
        //public override IMediaSource Clone()
        //{
        //    var result = new ChannelMediaSource(this.Channel);
        //    result.Id = this.Id;
        //    return result;
        //}

        public override bool Equals(IMediaSource other)
        {
            ChannelMediaSource temp = other as ChannelMediaSource;

            return(temp != null && temp.Id == this.Id);
        }