private object ExecuteRemoveCommand(IDictionary <string, object> args) { FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args); FileSystemProvider.Remove(pathInfoParam); return(null); }
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()); }
private object ExecuteCopyCommand(IDictionary <string, object> args) { FileItemPathInfo pathInfoParam = GetPathInfoParam("sourcePathInfo", args); FileItemPathInfo pathInfoParam2 = GetPathInfoParam("destinationPathInfo", args); FileSystemProvider.Copy(pathInfoParam, pathInfoParam2); return(null); }
private object ExecuteCreateDirCommand(IDictionary <string, object> args) { FileItemPathInfo pathInfoParam = GetPathInfoParam("pathInfo", args); string commandParam = GetCommandParam("name", args); FileSystemProvider.CreateDirectory(pathInfoParam, commandParam); return(null); }
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); }
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()); }
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)); }
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); }
private static FileItemPathInfo GetPathInfoParam(string key, IDictionary <string, object> args) { return(FileItemPathInfo.Create(args.ContainsKey(key) ? (args[key] as JArray) : null)); }
private FileContentResult GetFileContentResult(FileItemPathInfo pathInfo) { string fileItemName = pathInfo.GetFileItemName(); return(new FileContentResult(FileSystemProvider.GetFileContent(pathInfo), fileItemName)); }
public void CreateDirectory(FileItemPathInfo pathInfo, string name) { CreateDirectory(pathInfo?.GetPath(), name); }
public IList <IClientFileSystemItem> GetDirectoryContents(FileItemPathInfo pathInfo) { return(GetDirectoryContents(pathInfo?.GetPath())); }
public void Remove(FileItemPathInfo pathInfo) { Remove(pathInfo?.GetPath()); }
public void Copy(FileItemPathInfo sourcePathInfo, FileItemPathInfo destinationPathInfo) { Copy(sourcePathInfo?.GetPath(), destinationPathInfo?.GetPath()); }
public void Move(FileItemPathInfo sourcePathInfo, FileItemPathInfo destinationPathInfo) { Move(sourcePathInfo?.GetPath(), destinationPathInfo?.GetPath()); }
public void Rename(FileItemPathInfo pathInfo, string newName) { Rename(pathInfo?.GetPath(), newName); }