/// <summary>
        /// 通过给定文件夹下的文件
        /// </summary>
        /// <param name="path">文件夹路径</param>
        ///  <param name="searchOption">搜索方式</param>
        /// <returns>文件集合</returns>
        public List <IStorageFile> GetFiles(string path, PathSearchOption searchOption)
        {
            List <IStorageFile> files = new List <IStorageFile>();

            string localPath  = GetFullLocalPath(path, string.Empty);
            string parentPath = localPath.Substring(0, localPath.LastIndexOf(Path.DirectorySeparatorChar));

            if (Directory.Exists(localPath))
            {
                foreach (FileInfo file in (new DirectoryInfo(localPath)).GetFiles("*.*",
                                                                                  searchOption == PathSearchOption.AllPaths ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly))
                {
                    if (file.Name != PlaceHolderFileName && (file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
                    {
                        FileSystemStorageFile fsFile = new FileSystemStorageFile(this._fileStoreKey, GetPath(file.FullName), file);
                        files.Add(fsFile);
                    }
                }
            }
            else if (Directory.Exists(parentPath))
            {
                foreach (FileInfo file in (new DirectoryInfo(parentPath)).GetFiles("*.*", SearchOption.AllDirectories))
                {
                    if ((file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden &&
                        GetPath(file.FullName).StartsWith(path))
                    {
                        FileSystemStorageFile fsFile = new FileSystemStorageFile(this._fileStoreKey, GetPath(file.FullName), file);
                        files.Add(fsFile);
                    }
                }
            }

            return(files);
        }
        /// <summary>
        /// 添加文件
        /// </summary>
        /// <param name="path">文件路径</param>
        /// <param name="fileName">文件名称</param>
        /// <param name="contentStream">文件流</param>
        /// <returns>CFS文件</returns>
        public IStorageFile AddUpdateFile(string path, string fileName, Stream contentStream)
        {
            if (GlobalSettings.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            string fullPath = GetFullLocalPath(path, fileName);

            EnsurePathExists(fullPath);

            contentStream.Position = 0;
            using (FileStream outStream = File.OpenWrite(fullPath))
            {
                byte[] buffer   = new byte[contentStream.Length > 65536 ? 65536 : contentStream.Length];
                int    position = 0;
                while (position < contentStream.Length)
                {
                    int read = contentStream.Read(buffer, 0, buffer.Length);
                    outStream.Write(buffer, 0, read);
                    position += read;
                }

                outStream.Flush();
            }

            FileSystemStorageFile file = new FileSystemStorageFile(_fileStoreKey, path, new FileInfo(fullPath));

            return(file);
        }
        /// <summary>
        /// 文件系统下的文件
        /// </summary>
        /// <param name="searchOption"><搜索方式/param>
        /// <returns>文件集合</returns>
        public List <IStorageFile> GetFiles(PathSearchOption searchOption)
        {
            List <IStorageFile> files = new List <IStorageFile>();

            foreach (FileInfo file in (new DirectoryInfo(GetBaseFolder())).
                     GetFiles("*.*", searchOption == PathSearchOption.AllPaths ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly))
            {
                if (file.Name != PlaceHolderFileName && (file.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
                {
                    FileSystemStorageFile fsFile = new FileSystemStorageFile(this.FileStoreKey, GetPath(file.FullName), file);
                    files.Add(fsFile);
                }
            }

            return(files);
        }