예제 #1
0
        private object ExecuteRemoveCommand(IDictionary <string, object> args)
        {
            FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args);

            FileSystemProvider.Remove(pathInfoParam);
            return(null);
        }
예제 #2
0
        private object ExecuteGetDirContentCommand(IDictionary <string, object> args)
        {
            FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args);

            return((from item in FileSystemProvider.GetDirectoryContents(pathInfoParam)
                    where item.IsDirectory || IsValidFileExtension(item.Name)
                    select item).ToList());
        }
예제 #3
0
        private object ExecuteCopyCommand(IDictionary <string, object> args)
        {
            FileItemPathInfo pathInfoParam  = GetPathInfoParam("sourcePathInfo", args);
            FileItemPathInfo pathInfoParam2 = GetPathInfoParam("destinationPathInfo", args);

            FileSystemProvider.Copy(pathInfoParam, pathInfoParam2);
            return(null);
        }
예제 #4
0
        private object ExecuteCreateDirCommand(IDictionary <string, object> args)
        {
            FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args);
            string           commandParam  = GetCommandParam("name", args);

            FileSystemProvider.CreateDirectory(pathInfoParam, commandParam);
            return(null);
        }
예제 #5
0
        private object ExecuteRenameCommand(IDictionary <string, object> args)
        {
            FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args);
            string           commandParam  = GetCommandParam("name", args);

            ValidateFileExtension(commandParam);
            FileSystemProvider.Rename(pathInfoParam, commandParam);
            return(null);
        }
예제 #6
0
        private static FileItemPathInfo[] GetPathInfoListParam(string key, IDictionary <string, object> args)
        {
            JArray jArray = args.ContainsKey(key) ? (args[key] as JArray) : null;

            if (jArray == null)
            {
                return(new FileItemPathInfo[0]);
            }
            return((from JArray rawInfo in jArray
                    select FileItemPathInfo.Create(rawInfo)).ToArray());
        }
예제 #7
0
 private object ExecuteDownloadCommand(IDictionary <string, object> args)
 {
     FileItemPathInfo[] pathInfoListParam = GetPathInfoListParam("pathInfoList", args);
     if (pathInfoListParam.Length == 0)
     {
         return(null);
     }
     if (pathInfoListParam.Length == 1)
     {
         FileItemPathInfo pathInfo = pathInfoListParam[0];
         return(GetFileContentResult(pathInfo));
     }
     return(CreateZipArchive(pathInfoListParam));
 }
예제 #8
0
        public Stream GetFileContent(FileItemPathInfo pathInfo)
        {
            string path = pathInfo?.GetPath();
            string text = Path.Combine(RootDirectoryPath, PreparePath(path));

            if (Path.GetDirectoryName(text) == null)
            {
                _ = string.Empty;
            }
            if (FileSystemService.FileExists(text))
            {
                return(FileSystemService.GetFileContent(text));
            }
            FileManagementExceptionExecutor.ThrowFileNotFound(text);
            return(null);
        }
예제 #9
0
 private static FileItemPathInfo GetPathInfoParam(string key, IDictionary <string, object> args)
 {
     return(FileItemPathInfo.Create(args.ContainsKey(key) ? (args[key] as JArray) : null));
 }
예제 #10
0
        private FileContentResult GetFileContentResult(FileItemPathInfo pathInfo)
        {
            string fileItemName = pathInfo.GetFileItemName();

            return(new FileContentResult(FileSystemProvider.GetFileContent(pathInfo), fileItemName));
        }
예제 #11
0
 public void CreateDirectory(FileItemPathInfo pathInfo, string name)
 {
     CreateDirectory(pathInfo?.GetPath(), name);
 }
예제 #12
0
 public IList <IClientFileSystemItem> GetDirectoryContents(FileItemPathInfo pathInfo)
 {
     return(GetDirectoryContents(pathInfo?.GetPath()));
 }
예제 #13
0
 public void Remove(FileItemPathInfo pathInfo)
 {
     Remove(pathInfo?.GetPath());
 }
예제 #14
0
 public void Copy(FileItemPathInfo sourcePathInfo, FileItemPathInfo destinationPathInfo)
 {
     Copy(sourcePathInfo?.GetPath(), destinationPathInfo?.GetPath());
 }
예제 #15
0
 public void Move(FileItemPathInfo sourcePathInfo, FileItemPathInfo destinationPathInfo)
 {
     Move(sourcePathInfo?.GetPath(), destinationPathInfo?.GetPath());
 }
예제 #16
0
 public void Rename(FileItemPathInfo pathInfo, string newName)
 {
     Rename(pathInfo?.GetPath(), newName);
 }