public ActionResult FileActionDefault(AzureFileExplorerParams args)
        {
            //Please specify the path of azure blob
            string startPath = "https://filebrowsercontent.blob.core.windows.net/blob1/";

            if (args.Path != null)
            {
                args.Path = args.Path.Replace(startPath, "");
            }
            if (args.LocationFrom != null)
            {
                args.LocationFrom = args.LocationFrom.Replace(startPath, "");
            }
            if (args.LocationTo != null)
            {
                args.LocationTo = args.LocationTo.Replace(startPath, "");
            }

            //Here you have to specify the azure account name, key and blob name
            AzureFileOperations operation = new AzureFileOperations("filebrowsercontent", "rbAvmn82fmt7oZ7N/3SXQ9+d9MiQmW2i1FzwAtPfUJL9sb2gZ/+cC6Ei1mkwSbMA1iVSy9hzH1unWfL0fPny0A==", "blob1");

            switch (args.ActionType)
            {
            case "Read":
                return(Json(operation.Read(args.Path, args.ExtensionsAllow)));

            case "CreateFolder":
                return(Json(operation.CreateFolder(args.Path, args.Name)));

            case "Paste":
                return(Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles, args.SelectedItems)));

            case "Remove":
                return(Json(operation.Remove(args.Names, args.Path, args.SelectedItems)));

            case "Rename":
                return(Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles, args.SelectedItems)));

            case "GetDetails":
                return(Json(operation.GetDetails(args.Path, args.Names, args.SelectedItems)));

            case "Download":
                operation.Download(args.Path, args.Names);
                break;

            case "Upload":
                operation.Upload(args.FileUpload, args.Path);
                break;

            case "Search":
                return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive)));
            }
            return(Json(""));
        }
コード例 #2
0
 public FileExplorerController()
 {
     operation = new AzureFileOperations("filebrowsercontent", "rbAvmn82fmt7oZ7N/3SXQ9+d9MiQmW2i1FzwAtPfUJL9sb2gZ/+cC6Ei1mkwSbMA1iVSy9hzH1unWfL0fPny0A==", "blob1");
 }