Пример #1
0
        public static void SaveCGItems(CGItemCollection cgItems)
        {
            _cgItems = cgItems;
            var value = CGItemCollection.ToXml(cgItems);

            SaveSetting(null, null, null, "CGItems", value, null);
        }
Пример #2
0
        public static PlaybillItemEntity ToEntity(PlaybillEntity billEntity, IPlaybillItem billItem, IMediaSource replaceAutoPadding)
        {
            var dtoItem = new PlaybillItemEntity();

            dtoItem.Id = billItem.Id;

            dtoItem.Playbill = billEntity;

            dtoItem.StartTime      = billItem.StartTime;
            dtoItem.MarkerIn       = billItem.PlayRange.StartPosition.TotalSeconds;
            dtoItem.ScheduleMode   = billItem.ScheduleMode;
            dtoItem.MarkerDuration = billItem.PlayRange.Duration.TotalSeconds;
            //_dtoItem.SegmentId = this.SegmentId;

            if (billItem.MediaSource.Category != MediaSourceCategory.Null)
            {
                dtoItem.MediaSourceId = billItem.MediaSource.Id;
            }
            else
            {
                dtoItem.MediaSourceTitle    = billItem.MediaSource.Title;
                dtoItem.MediaSourceDuration = billItem.MediaSource.Duration.Value.TotalSeconds;
            }

            var autoBillItem = billItem as AutoPlaybillItem;

            if (autoBillItem != null)
            {
                if (autoBillItem.IsAutoPadding && replaceAutoPadding != null)
                {
                    // TODO: 替换自动垫片。

                    dtoItem.MediaSourceId = replaceAutoPadding.Id;

                    //dtoItem.IsAutoPadding = autoBillItem.IsAutoPadding;
                }
            }


            var fileMediaSource = billItem.MediaSource as IFileMediaSource;

            if (fileMediaSource != null)
            {
                dtoItem.AudioGain = fileMediaSource.AudioGain;
            }

            if (billItem.CGItems != null)
            {
                dtoItem.CGContents = CGItemCollection.ToXml(billItem.CGItems);
            }

            return(dtoItem);
        }
Пример #3
0
        public PlaybillItemEntity(IPlaybillItem billItem, Func <IMediaSource, MediaSourceEntity> converter)
        {
            this.Id = billItem.Id;

            //this.Playbill = billEntity;

            this.StartTime      = billItem.StartTime;
            this.MarkerIn       = billItem.PlayRange.StartPosition.TotalSeconds;
            this.ScheduleMode   = billItem.ScheduleMode;
            this.MarkerDuration = billItem.PlayRange.Duration.TotalSeconds;

            if (billItem.MediaSource.Category != MediaSourceCategory.Null)
            {
                this.MediaSourceId = billItem.MediaSource.Id;

                if (converter != null)
                {
                    this.MediaSource = converter(billItem.MediaSource);
                }
            }
            else
            {
                this.MediaSourceTitle    = billItem.MediaSource.Title;
                this.MediaSourceDuration = billItem.MediaSource.Duration.Value.TotalSeconds;
            }

            var autoBillItem = billItem as AutoPlaybillItem;

            if (autoBillItem != null)
            {
                this.IsAutoPadding = autoBillItem.IsAutoPadding;
            }


            var fileMediaSource = billItem.MediaSource as IFileMediaSource;

            if (fileMediaSource != null)
            {
                this.AudioGain = fileMediaSource.AudioGain;
            }

            if (billItem.CGItems != null)
            {
                this.CGContents = CGItemCollection.ToXml(billItem.CGItems);
            }
        }