/// <summary>
        /// 保存文件信息
        /// </summary>
        /// <param name="info">文件信息</param>
        public DiskFileInfo Save(DirectoryInfo directoryInfo, DiskFileInfo info)
        {
            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }

            InnerSaveFile(directoryInfo.FullName, info.FileName, info.FileStream, info.FileChunkInfo);

            //文件流清空
            info.FileStream = null;

            return(info);
        }
        /// <summary>
        /// 获取文件信息(包括文件流),不存在返回null
        /// </summary>
        /// <param name="id">文件信息ID</param>
        /// <returns></returns>
        public DiskFileInfo Get(DirectoryInfo directoryInfo, string key)
        {
            FileInfo havedFile = InnerGetFileInfo(directoryInfo, key);

            if (havedFile != null)
            {
                DiskFileInfo info = new DiskFileInfo();

                info.FileStream  = new FileStream(havedFile.FullName, FileMode.Open, FileAccess.Read);
                info.FileName    = havedFile.Name;
                info.FileSize    = havedFile.Length;
                info.ContentType = havedFile.Extension;

                return(info);
            }
            return(null);
        }
        /// <summary>
        /// 获取所有文件信息列表(不包括文件流)
        /// </summary>
        /// <returns></returns>
        public List <DiskFileInfo> GetAll(DirectoryInfo directoryInfo)
        {
            List <DiskFileInfo> rl = new List <DiskFileInfo>();

            if (directoryInfo.Exists)
            {
                //查找文件
                FileInfo[] files = directoryInfo.GetFiles();
                foreach (FileInfo havedFilename in files)
                {
                    DiskFileInfo a = new DiskFileInfo();
                    a.FileName    = havedFilename.Name;
                    a.FileSize    = havedFilename.Length;
                    a.ContentType = havedFilename.Extension;

                    rl.Add(a);
                }
            }

            return(rl);
        }
        /// <summary>
        /// 获得文件缩略图流
        /// </summary>
        /// <param name="id">文件信息ID</param>
        /// <param name="thumbnailSize">缩略图大小</param>
        /// <returns>缩略图流</returns>
        public Stream GetThumbnail(DirectoryInfo directoryInfo, string key, Size thumbnailSize)
        {
            Stream       targetStream = null;
            DiskFileInfo info         = Get(directoryInfo, key);

            if (info == null)
            {
                return(null);
            }
            Stream sourceStream = info.FileStream;

            if (sourceStream == null)
            {
                return(null);
            }

            targetStream = FileExtensionTypeHelper.GetThumbnail(sourceStream, thumbnailSize);

            //所以要手动释放
            sourceStream.Flush();
            sourceStream.Close();

            return(targetStream);
        }