protected virtual List <UfeFile> CreateDeleteSourceFiles(MemoryLibraryItem[] messages) { List <UfeFile> deletedFiles = new List <UfeFile>(); if (messages != null && messages.Length > 0) { foreach (var item in messages) { var file = new UfeFile(); file.Id = item.Id; switch (item.Type) { case LibraryType.Message: file.Type = FileType.Message; break; case LibraryType.TimeSliceGroup: file.Type = FileType.TimesliceGroup; break; case LibraryType.Playlist: file.Type = FileType.Playlist; break; case LibraryType.Schedule: file.Type = FileType.Schedule; break; } deletedFiles.Add(file); } } return(deletedFiles); }
private List <UfeFile> CreateDeleteSourceFiles(List <MessageInfo> messages, List <TimeSliceGroupInfo> timeSliceGroups, List <PlaylistInfo> playlists) { List <UfeFile> deletedFiles = new List <UfeFile>(); UfeFile file; if (_item != null) { file = new UfeFile(); file.Id = _item.Id; file.Type = FileType.Schedule; deletedFiles.Add(file); } if (messages != null && messages.Count > 0) { foreach (MessageInfo item in messages) { file = new UfeFile(); file.Id = item.Id; file.Type = FileType.Message; deletedFiles.Add(file); //Add Nail Image to delete //file = new UfeFile(); //file.Id = item.Id; //file.Type = FileType.MessageNailImage; //deletedFiles.Add(file); } } if (timeSliceGroups != null && timeSliceGroups.Count > 0) { foreach (TimeSliceGroupInfo item in timeSliceGroups) { file = new UfeFile(); file.Id = item.Id; file.Type = FileType.TimesliceGroup; deletedFiles.Add(file); } } if (playlists != null && playlists.Count > 0) { foreach (PlaylistInfo item in playlists) { file = new UfeFile(); file.Id = item.Id; file.Type = FileType.Playlist; deletedFiles.Add(file); } } return(deletedFiles); }
/// <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); }
private bool PutFile(UfeFile item) { _waitForm.Info(Resource.GetFormatString(Resource.Strings.UploadSchedulerUploadFtpFileStart, " - " + item.Type + " - " + item.Name + " - " + item.ToFilePath)); try { _sign.Controller.Connection.FtpManager.Put(item.FromFilePath, item.ToFilePath); _waitForm.Info(Resource.GetFormatString(Resource.Strings.UploadSchedulerUploadFtpFileEnd, " - " + item.Type + " - " + item.Name + " - " + item.ToFilePath)); return(true); } catch (Exception ex) { _waitForm.Error(Resource.GetFormatString(Resource.Strings.UploadFailed), ex); return(false); } }
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); }
/// <summary> /// Function: Is exist in server libraries /// Author : Jerry Xu /// Date : 2008-12-8 /// </summary> /// <param name="memory">MemoryLibraryItem</param> /// <returns>ExistType</returns> private void IsDeleteServerLibraries(List <UfeFile> items) { UfeFile file = null; FileType type = FileType.Message; foreach (var item in _sign.Controller.Connection.ServerLibraries) { var memory = items.Find(p => { return(p.Id == item.Id); }); if (memory == null) { file = new UfeFile(); file.Id = item.Id; if (item.Type == ServerLibraryType.Message) { type = FileType.Message; file.Type = type; _deletedItems.Add(file); //TODO:Add nail image to delete //file = new UfeFile(); //file.Id = item.Id; //file.Type = FileType.MessageNailImage; //_deletedItems.Add(file); } else if (item.Type == ServerLibraryType.TimesliceGroup) { type = FileType.TimesliceGroup; } else if (item.Type == ServerLibraryType.Playlist) { type = FileType.Playlist; } else if (item.Type == ServerLibraryType.Schedule) { type = FileType.Schedule; } //else if(item.Type == ServerLibraryType. file.Type = type; _deletedItems.Add(file); } } }
internal void Populate() { Check.Require(_library != null, "_library != null"); object result = _converter.Convert(_library); UfeFile file = result as UfeFile; if (file != null) { _files.Add(file); } else { List <UfeFile> files = result as List <UfeFile>; if (files != null) { _files = files; } } }
/// <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 UfeFile ConvertNailImage(MessageInfo message) { UfeFile file = new UfeFile(); file.Id = message.Id; file.Name = message.Name; file.CreateTime = message.CreateTime.ToString(); file.ModifyTime = message.ModifyTime.ToString(); file.Length = float.Parse(message.Length.ToString()); file.FromFilePath = message.ImagePath;// LocalFilePathMapping.GetFile(FileType.Message, file.Id); file.ToFilePath = FilePathMapping.GetNailImagePath(file.Id); file.Type = FileType.MessageNailImage; Image desImg = IOHelper.GetImageFromFile(message.ImagePath); System.IO.File.Copy(message.ImagePath, File.FromFilePath.Replace(".xml", ".png")); //Config.CopyDir(message.ImagePath,File.FromFilePath.Replace(".xml",".png")); //IOHelper.SaveImage(desImg, File.FromFilePath.Replace(".xml", ".png"), ImageFormat.Png); file.Content = IOHelper.ReadAllBytes(message.ImagePath); file.Size = IOHelper.GetFileLength(File.FromFilePath); return(file); }
/// <summary> /// Function: Is exist in server libraries /// </summary> /// <param name="memory">MemoryLibraryItem</param> /// <returns>ExistType</returns> private void IsDeleteServerLibraries(List <UfeFile> items) { UfeFile file = null; FileType type = FileType.Message; foreach (var item in _sign.Controller.Connection.ServerLibraries) { var memory = items.FirstOrDefault(p => p.Id == item.Id); if (memory == null) { file = new UfeFile(); file.Id = item.Id; if (item.Type == ServerLibraryType.Message) { type = FileType.Message; file.Type = type; _deletedItems.Add(file); } else if (item.Type == ServerLibraryType.TimesliceGroup) { type = FileType.TimesliceGroup; } else if (item.Type == ServerLibraryType.Playlist) { type = FileType.Playlist; } else if (item.Type == ServerLibraryType.Schedule) { type = FileType.Schedule; } file.Type = type; _deletedItems.Add(file); } } }