Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        /// <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
            });
        }