public override void Do() { foreach (var folder in FoldersToOpen) { if (!FileSystemCommand.DirectoryExists(folder)) { DidCommandSucceed = false; SendReport($"Windows Explorer cannot open directory {folder} because it doesn't exist", ReportType.DoneTaskWithFailure); return; } if (CommandLineArguments.Any()) { CommandLineArguments[0] = $"/open, {folder}"; } else { CommandLineArguments.Add($"/open, {folder}"); } runCommand(); SendReport($"Windows Explorer exited with code {ExitCode} for directory {folder}", ReportType.Progress); } DidCommandSucceed = true; SendReport($"Windows Explorer opened all requested folders successfully", ReportType.DoneTaskWithSuccess); }
public object FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new PhysicalFileSystemProvider( Path.Combine(HostingEnvironment.WebRootPath, SampleImagesRelativePath), (fileSystemItem, clientItem) => { if (!clientItem.IsDirectory) { clientItem.CustomFields["url"] = GetFileItemUrl(fileSystemItem); } } ), //uncomment the code below to enable file/directory management //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowDelete = true, //AllowRename = true, //AllowUpload = true, AllowDownload = true }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(result.GetClientCommandResult()); }
public IActionResult FileSystem(FileSystemCommand command, string arguments) { try { var config = new FileSystemConfiguration { Request = Request, //FileSystemProvider = new DefaultFileProvider(CreateGlavnaFolder()), //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowRemove = true, //AllowRename = true, //AllowUpload = true }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); } catch (Exception) { } return(Ok()); }
public override bool PreFlightCheck() { if (!FileSystemCommand.FileExists(Target)) { SendReport($"Command likely to fail because {Target} does not exist", ReportType.DonePreFlightWithFailure); return(false); } return(DefaultPreFlightCheckSuccess()); }
public override bool PreFlightCheck() { if (FileSystemCommand.DirectoryGetFiles(LocalCloneDirectory).Any()) { SendReport($"{ShortName} will likely FAIL because target directory {LocalCloneDirectory} is not empty", ReportType.DonePreFlightWithFailure); return(false); } return(DefaultPreFlightCheckSuccess()); }
public void Read(TProtocol iprot) { iprot.IncrementRecursionDepth(); try { TField field; iprot.ReadStructBegin(); while (true) { field = iprot.ReadFieldBegin(); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 0: if (field.Type == TType.Struct) { Success = new FileSystemCommand(); Success.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 1: if (field.Type == TType.Struct) { E = new AlluxioTException(); E.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); } finally { iprot.DecrementRecursionDepth(); } }
public override bool PreFlightCheck() { foreach (var folder in FoldersToOpen) { if (!FileSystemCommand.DirectoryExists(folder)) { SendReport($"Command will likely fail because folder \"{folder}\" doesn't exist", ReportType.DoneTaskWithFailure); return(false); } } return(DefaultPreFlightCheckSuccess()); }
public FileSystemCommandResult Execute(FileSystemCommand command, IDictionary <string, object> arguments) { FileSystemCommandResult fileSystemCommandResult = new FileSystemCommandResult(); try { fileSystemCommandResult.Result = ExecuteUnsafe(command, arguments); return(fileSystemCommandResult); } catch (Exception ex) { Exception ex3 = fileSystemCommandResult.Exception = ex; return(fileSystemCommandResult); } }
public IActionResult Process(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = DBFileProvider, AllowCopy = true, AllowCreate = true, AllowMove = true, AllowRemove = true, AllowRename = true, AllowedFileExtensions = new string[0] }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); }
public object Process(FileSystemCommand command, string arguments) { var request = new HttpContextWrapper(HttpContext.Current).Request; var config = new FileSystemConfiguration { Request = request, FileSystemProvider = new DbFileProvider(), AllowCopy = true, AllowCreate = true, AllowMove = true, AllowDelete = true, AllowRename = true, AllowedFileExtensions = new string[0] }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); }
public IActionResult FileSystem(FileSystemCommand command, string arguments) { var rootPath = Path.Combine(Environment.WebRootPath, "ContentFolder"); var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new DefaultFileProvider(rootPath, ThumbnailGenerator.AssignThumbnailUrl), AllowCopy = true, AllowCreate = true, AllowMove = true, AllowRemove = true, AllowRename = true, AllowUpload = true }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); }
public IActionResult FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new AzureBlobFileProvider(), AllowCopy = true, AllowCreate = true, AllowMove = true, AllowRemove = true, AllowRename = true, AllowUpload = true, UploadTempPath = _hostingEnvironment.ContentRootPath + "/wwwroot/UploadTemp" }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); }
public object FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new DefaultFileProvider(_hostingEnvironment.ContentRootPath + "/wwwroot"), //uncomment the code below to enable file/folder management //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowRemove = true, //AllowRename = true, //AllowUpload = true, AllowDownload = true, AllowedFileExtensions = new[] { ".js", ".json", ".css" } }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(result.GetClientCommandResult()); }
public IActionResult FileSystem(FileSystemCommand command, string arguments) { var rootPath = Path.Combine(Environment.WebRootPath, "ContentFolder"); var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new PhysicalFileSystemProvider(rootPath, ThumbnailGenerator.AssignThumbnailUrl), AllowCopy = true, AllowCreate = true, AllowMove = true, AllowDelete = true, AllowRename = true, AllowUpload = true }; config.AllowedFileExtensions = new[] { ".png", ".gif", ".jpg", ".jpeg", ".ico", ".bmp" }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(Ok(result.GetClientCommandResult())); }
public object FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = new PhysicalFileSystemProvider(Path.Combine(HostingEnvironment.WebRootPath, "SampleDocs")), AllowCopy = true, AllowCreate = true, AllowMove = true, AllowDelete = true, AllowRename = true, AllowUpload = true, AllowDownload = true, AllowedFileExtensions = new string[] { ".xlsx", ".rtf", ".txt", ".docx", ".json", ".jpg" } }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(result.GetClientCommandResult()); }
public object FileSystem(FileSystemCommand command, string arguments) { var config = new FileSystemConfiguration { Request = Request, FileSystemProvider = AzureFileProvider, //uncomment the code below to enable file/folder management //AllowCopy = true, //AllowCreate = true, //AllowMove = true, //AllowRemove = true, //AllowRename = true, //AllowUpload = true, AllowDownload = true, AllowedFileExtensions = new string[0], MaxUploadFileSize = 1048576, UploadTempPath = HostingEnvironment.ContentRootPath + "/UploadTemp" }; var processor = new FileSystemCommandProcessor(config); var result = processor.Execute(command, arguments); return(result.GetClientCommandResult()); }
public override bool PreFlightCheck() { var preFlightCheck = base.PreFlightCheck(); if (!preFlightCheck) { return(false); } if (!FileSystemCommand.DirectoryExists(DirectoryToUpdate)) { SendReport($"{ShortName} will FAIL because target directory {DirectoryToUpdate} was not found", ReportType.DonePreFlightWithFailure); return(false); } if (!isValidSvnRepo(DirectoryToUpdate)) { SendReport($"{ShortName} will FAIL because target directory {DirectoryToUpdate} does not seem to be a valid SVN repo", ReportType.DonePreFlightWithFailure); return(false); } return(DefaultPreFlightCheckSuccess()); }
private object ExecuteUnsafe(FileSystemCommand command, IDictionary <string, object> arguments) { switch (command) { case FileSystemCommand.GetDirContents: return(ExecuteGetDirContentCommand(arguments)); case FileSystemCommand.CreateDir: if (!FileSystemConfiguration.AllowCreate) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteCreateDirCommand(arguments)); case FileSystemCommand.Rename: if (!FileSystemConfiguration.AllowRename) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteRenameCommand(arguments)); case FileSystemCommand.Move: if (!FileSystemConfiguration.AllowMove) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteMoveCommand(arguments)); case FileSystemCommand.Copy: if (!FileSystemConfiguration.AllowCopy) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteCopyCommand(arguments)); case FileSystemCommand.Remove: if (!FileSystemConfiguration.AllowRemove) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteRemoveCommand(arguments)); case FileSystemCommand.UploadChunk: if (!FileSystemConfiguration.AllowUpload) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteUploadChunkCommand(arguments)); case FileSystemCommand.AbortUpload: if (!FileSystemConfiguration.AllowUpload) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteAbortUploadCommand(arguments)); case FileSystemCommand.Download: if (!FileSystemConfiguration.AllowDownload) { FileManagementExceptionExecutor.ThrowNoAccess(); } return(ExecuteDownloadCommand(arguments)); default: throw new NotSupportedException(); } }
public FileSystemCommandResult Execute(FileSystemCommand command, string arguments) { return(Execute(command, JsonConvert.DeserializeObject <IDictionary <string, object> >(arguments))); }