public object FileOperations([FromBody] ReadArgs args)
        {
            try
            {
                switch (args.Action)
                {
                // Add your custom action here
                case "read":
                    // Path - Current path; ShowHiddenItems - Boolean value to show/hide hidden items
                    return(this.operation.ToCamelCase(this.operation.GetFiles(args.Path, args.ShowHiddenItems)));

                case "search":
                case "details":
                case "delete":
                case "copy":
                case "move":
                case "create":
                case "rename":
                    FileManagerResponse response = new FileManagerResponse();
                    response.Error = new ErrorDetails()
                    {
                        Code = "401", Message = "Extract the Zip file to perform this action"
                    };
                    return(this.operation.ToCamelCase(response));
                }
                return(null);
            }
            catch (IOException e)
            {
                throw e;
            }
        }
Пример #2
0
        public object FileOperations([FromBody] ReadArgs args)
        {
            try
            {
                switch (args.Action)
                {
                // Add your custom action here
                case "read":
                    // Path - Current path; ShowHiddenItems - Boolean value to show/hide hidden items
                    return(this.operation.ToCamelCase(this.GetFiles()));

                case "search":
                    // Path - Current path where the search is performed; SearchString - String typed in the searchbox; CaseSensitive - Boolean value which specifies whether the search must be casesensitive
                    //return this.operation.ToCamelCase(this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive));
                    return(this.operation.ToCamelCase(this.SearchFiles(args.SearchString, args.CaseSensitive)));

                case "details":
                    // Path - Current path where details of file/folder is requested; Name - Names of the requested folders
                    return(this.operation.ToCamelCase(this.GetDetails(args.Data)));

                case "delete":
                    // Path - Current path where of the folder to be deleted; Names - Name of the files to be deleted
                    return(this.operation.ToCamelCase(this.DeleteFiles(args.Data)));

                case "rename":
                case "create":
                case "move":
                case "copy":
                    // Path - Current path of the renamed file; Name - Old file name; NewName - New file name
                    // return this.operation.ToCamelCase(this.operation.Rename(args.Path, args.Name, args.NewName));
                    FileManagerResponse response = new FileManagerResponse();
                    response.Error = new ErrorDetails()
                    {
                        Code = "401", Message = "Restore file to perform this action"
                    };
                    return(this.operation.ToCamelCase(response));
                }
                return(null);
            }
            catch (IOException e)
            {
                throw e;
            }
        }