/// <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); }
/// <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); }