/// <summary> /// Function: Convert MemoryLibraryItem(MessageInfo) to UfeFile(Need uploaded files) /// Author : Jerry Xu /// Date : 2008-12-8 /// </summary> /// <param name="item">MemoryLibraryItem</param> /// <returns>UfeFile</returns> private static UfeFile ConvertFile(MemoryLibraryItem item) { UfeFile file = new UfeFile(); file.Id = item.Id; file.Name = item.Name; file.CreateTime = item.CreateTime.ToString(); file.ModifyTime = item.ModifyTime.ToString(); file.Length = float.Parse(item.Length.ToString()); file.FromFilePath = LocalFilePathMapping.GetFile(FileType.Message, file.Id); file.ToFilePath = FilePathMapping.GetMessagePath(file.Id); file.Type = FileType.Message; return(file); }
public override UfeFile Convert(TLibrary item) { Item = item; LocalPath = LocalFilePathMapping.GetFile(item.Type, item.Id.ToString()); File = new UfeFile(); File.Id = item.Id.ToString(); File.Name = item.Name; File.CreateTime = item.CreateTime.ToString(); File.ModifyTime = item.ModifyTime.ToString(); File.Length = float.Parse(item.Length.ToString()); File.FromFilePath = LocalPath; File.ToFilePath = FilePathMapping.GetFile(item.Type, item.Id.ToString()); File.Type = LocalFilePathMapping.ConvertType(item.Type);; return(File); }
private void Generate(string name) { //ScheduleInfo var item = project.LibraryGroups[0].Schedulers.GetByName(name); //Serialiser object Serialiser <ScheduleType> _ser = Serialiser <ScheduleType> .Xml; //Schedule Converter SchedulerConverter converter = new SchedulerConverter(); //UFE Schedule ScheduleType ufeItem = converter.Convert(item); //Serialize schedule _ser.Serialize(ufeItem, LocalFilePathMapping.GetFile(FileType.Schedule, ufeItem.Id)); }
private void Generate(string name) { //PlaylistInfo var item = project.LibraryGroups[0].Playlists.GetByName(name); //Serialiser object Serialiser <PlaylistType> _ser = Serialiser <PlaylistType> .Xml; //Playlist Converter PlaylistConverter converter = new PlaylistConverter(); //UFE Playlist PlaylistType ufeItem = converter.Convert(item); //Serialize playlist _ser.Serialize(ufeItem, LocalFilePathMapping.GetFile(FileType.Playlist, ufeItem.Id)); }
private void Generate(string name) { //TimeSliceGroupInfo var item = project.LibraryGroups[0].TimeSliceGroups.GetByName(name); //Serialiser object Serialiser <TimeSliceGroupType> _ser = Serialiser <TimeSliceGroupType> .Xml; //TimeSliceGroup Converter TimeSliceGroupConverter converter = new TimeSliceGroupConverter(); //UFE TimeSliceGroup TimeSliceGroupType ufeItem = converter.Convert(item); //Serialize timeslicegroup _ser.Serialize(ufeItem, LocalFilePathMapping.GetFile(FileType.TimesliceGroup, ufeItem.Id)); }
/// <summary> /// Function: Convert ShapeBase(ShapeBase) to UfeFile(Need uploaded files) /// Author : Jerry Xu /// Date : 2008-12-8 /// </summary> /// <param name="item">ShapeBase</param> /// <returns>UfeFile</returns> public override ShapePair Convert(ShapeBase item) { var type = ConvertFileType(item.LayerType); if (type == FileType.None) { return(null); } UfeFile file = new UfeFile(); file.Type = type; if (item.Type == ShapeType.Video) { if (string.IsNullOrEmpty(item.VideoFileID)) { file.FromFilePath = (item as ShapeVideo).VideoUrl; } else { file.FromFilePath = LocalFilePathMapping.GetFile(file.Type, item.VideoFileID); } } else { file.Id = Guid.NewGuid().ToString().Replace("-", ""); if (file.Type != FileType.None) { file.FromFilePath = LocalFilePathMapping.GetFile(file.Type, file.Id); } } if (file.Type != FileType.None) { file.ToFilePath = FilePathMapping.GetFile(file.Type, file.Id); } return(new ShapePair { Shape = item, File = file, Sign = this.Sign }); }
private ShapeLayer MergeVideoLayers(MessageInfo mes, ShapeLayer[] videoLayers) { string fileID = Guid.NewGuid().ToString().Replace("-", ""); string fileName = LocalFilePathMapping.GetFile(FileType.Video, fileID); var layers = new VideoLayerCollection(); Layer layer = null; long minStartTime = 0; long maxEndTime = 0; Array.ForEach <ShapeLayer>(videoLayers, item => { layer = DESLayerConverter.Instance.Convert(item); //comment out by Louis,for change video start time same as video layer's start time //layer.Level++; if (layer.Level == 0) { minStartTime = layer.StartTime; maxEndTime = layer.EndTime; } else { if (layer.StartTime < minStartTime) { minStartTime = layer.StartTime; } if (layer.EndTime > maxEndTime) { maxEndTime = layer.EndTime; } } layer.Rect = new System.Drawing.Rectangle(layer.Rect.X / mes.Zoom, layer.Rect.Y / mes.Zoom, layer.Rect.Width / mes.Zoom, layer.Rect.Height / mes.Zoom); layers.Add(layer); }); layers.BackColor = mes.BackColor; layers.SignType = SignType.RGB; layers.VideoSize = videoLayers[0].Shape.SignSize; layers.Name = mes.Name; layers.Zoom = 1; layers.PlayLength = maxEndTime - minStartTime; layers.ParentName = ""; layers.EmphasisEffect = mes.EmphasisEffect; if (layers.Count > 1) { layers.Sort(new SortComparer <Layer>("Level", false)); } IBaseFilter ibfVideoCompressor = DESHelper.GetVideoCompressor("Indeo?video 5.10 Compression Filter"); PlayState state = ProWrite.Core.PlayState.Stop; var des = new DESCombine(DESConsts.FPS, DESConsts.BitCount, layers.VideoSize.Width, layers.VideoSize.Height, layers); des.Completed += (s, e) => state = PlayState.Stop; des.RenderToVideo(MediaSubType.Mpeg2Video, fileName, ibfVideoCompressor, null, null, null, new List <Layer>(), 0, mes.Length, layers.VideoSize); des.StartRendering(); state = PlayState.Run; while (state == PlayState.Run) { Thread.Sleep(100); } des.Dispose(); des = null; var newLayer = videoLayers[0].Copy(); ShapeVideo shape = newLayer.Shape as ShapeVideo; if (shape == null)//shape.Type == Gif { shape = new ShapeVideo(); shape.FromTo(newLayer.Shape); newLayer.Shape = shape; } shape.VideoFileID = fileID; shape.VideoUrl = fileName; newLayer.EntryEffect = LayerEffect.Empty; newLayer.ExitEffect = LayerEffect.Empty; newLayer.EmphasisEffect = LayerEffect.Empty; newLayer.EmphasisEffect.Left = (int)minStartTime * Constance.Effect.UnitWidth; newLayer.EmphasisEffect.Width = (int)maxEndTime * Constance.Effect.UnitWidth; return(newLayer); }