Esempio n. 1
0
        public HttpResponseMessage Process()
        {
            FileSystemCommand command;

            Enum.TryParse(CurrentContext.Request["command"], out command);
            string arguments = CurrentContext.Request["arguments"];

            AzureStorageAccount account = AzureStorageAccount.FileManager.Value;
            var provider = new AzureBlobFileProvider(account.AccountName, account.AccessKey, account.ContainerName, TempDirectoryPath);

            var config = new FileSystemConfiguration {
                Request            = new HttpContextWrapper(CurrentContext).Request,
                FileSystemProvider = provider,
                //uncomment the code below to enable file/folder management
                //AllowCopy = true,
                //AllowCreate = true,
                //AllowMove = true,
                //AllowDelete = true,
                //AllowRename = true,
                //AllowUpload = true,
                AllowDownload       = true,
                UploadConfiguration = new UploadConfiguration {
                    MaxFileSize = 1048576
                },
                TempDirectory = TempDirectoryPath
            };
            var processor     = new FileSystemCommandProcessor(config);
            var commandResult = processor.Execute(command, arguments);
            var result        = commandResult.GetClientCommandResult();

            return(command == FileSystemCommand.Download && commandResult.Success ? CreateDownloadResponse(result) : Request.CreateResponse(result));
        }
        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 HttpResponseMessage FileSystem()
        {
            FileSystemCommand command;

            Enum.TryParse(CurrentContext.Request["command"], out command);
            string arguments = CurrentContext.Request["arguments"];
            var    config    = new FileSystemConfiguration {
                Request            = new HttpContextWrapper(CurrentContext).Request,
                FileSystemProvider = new PhysicalFileSystemProvider(CurrentContext.Server.MapPath("~/Scripts")),
                //uncomment the code below to enable file/folder management
                //AllowCopy = true,
                //AllowCreate = true,
                //AllowMove = true,
                //AllowDelete = true,
                //AllowRename = true,
                //AllowUpload = true,
                AllowDownload         = true,
                AllowedFileExtensions = new[] { ".js", ".json", ".css" },
                TempDirectory         = TempDirectoryPath
            };
            var processor     = new FileSystemCommandProcessor(config);
            var commandResult = processor.Execute(command, arguments);
            var result        = commandResult.GetClientCommandResult();

            return(command == FileSystemCommand.Download && commandResult.Success ? CreateDownloadResponse(result) : Request.CreateResponse(result));
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        public object FileSystem()
        {
            var request = new HttpContextWrapper(HttpContext.Current).Request;
            FileSystemCommand command;

            Enum.TryParse(request["command"], out command);
            string arguments = request["arguments"];
            var    config    = new FileSystemConfiguration {
                Request            = request,
                FileSystemProvider = new PhysicalFileSystemProvider(
                    Path.Combine(HostingEnvironment.ApplicationPhysicalPath, 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,
                TempDirectory = HttpContext.Current.Server.MapPath("~/App_Data/UploadTemp")
            };
            var processor     = new FileSystemCommandProcessor(config);
            var commandResult = processor.Execute(command, arguments);
            var result        = commandResult.GetClientCommandResult();

            return(command == FileSystemCommand.Download && commandResult.Success ? CreateDownloadResponse(result) : Request.CreateResponse(result));
        }
        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()));
        }
Esempio n. 7
0
        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()));
        }
Esempio n. 8
0
        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 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());
        }
Esempio n. 12
0
        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 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());
        }