├── server
├── wwwroot
│ ├── User
│ │ ├── trash.json
│ │ ├── star.json
│ │ └── User1.png
│ ├── VirtualConnections
│ │ └── 9fa997ef-e430-4c00-be2b-34df7feed887
│ │ │ ├── User
│ │ │ ├── trash.json
│ │ │ ├── star.json
│ │ │ └── User1.png
│ │ │ ├── Files
│ │ │ ├── Pictures
│ │ │ │ ├── Employees
│ │ │ │ │ ├── 1.png
│ │ │ │ │ ├── 2.png
│ │ │ │ │ ├── 3.png
│ │ │ │ │ ├── 4.png
│ │ │ │ │ ├── 5.png
│ │ │ │ │ └── 6.png
│ │ │ │ ├── Food
│ │ │ │ │ ├── Bread.png
│ │ │ │ │ ├── Apple pie.png
│ │ │ │ │ ├── Doughnut.png
│ │ │ │ │ ├── Nuggets.png
│ │ │ │ │ └── Sugar cookie.png
│ │ │ │ └── Nature
│ │ │ │ │ ├── bird.jpg
│ │ │ │ │ ├── sea.jpg
│ │ │ │ │ ├── snow.jpg
│ │ │ │ │ ├── seaview.jpg
│ │ │ │ │ └── snowfall.jpg
│ │ │ └── Documents
│ │ │ │ ├── Giant Panda.docx
│ │ │ │ ├── Company History.pptx
│ │ │ │ ├── Northwind Report.pdf
│ │ │ │ └── File Manager.txt
│ │ │ └── Trash
│ │ │ └── 132368656344891076
│ │ │ └── Desktop-Dec-18.jpg
│ ├── favicon.ico
│ ├── favicon.png
│ ├── SharedFiles
│ │ ├── User1.png
│ │ ├── User
│ │ │ └── User1.png
│ │ └── css
│ │ │ ├── open-iconic
│ │ │ ├── font
│ │ │ │ ├── fonts
│ │ │ │ │ ├── open-iconic.eot
│ │ │ │ │ ├── open-iconic.otf
│ │ │ │ │ ├── open-iconic.ttf
│ │ │ │ │ └── open-iconic.woff
│ │ │ │ └── css
│ │ │ │ │ └── open-iconic-bootstrap.min.css
│ │ │ ├── ICON-LICENSE
│ │ │ ├── README.md
│ │ │ └── FONT-LICENSE
│ │ │ └── site.css
│ ├── Files
│ │ ├── Pictures
│ │ │ ├── Food
│ │ │ │ ├── Bread.png
│ │ │ │ ├── Nuggets.png
│ │ │ │ ├── Apple pie.png
│ │ │ │ ├── Doughnut.png
│ │ │ │ └── Sugar cookie.png
│ │ │ ├── Nature
│ │ │ │ ├── sea.jpg
│ │ │ │ ├── bird.jpg
│ │ │ │ ├── snow.jpg
│ │ │ │ ├── seaview.jpg
│ │ │ │ └── snowfall.jpg
│ │ │ └── Employees
│ │ │ │ ├── 1.png
│ │ │ │ ├── 2.png
│ │ │ │ ├── 3.png
│ │ │ │ ├── 4.png
│ │ │ │ ├── 5.png
│ │ │ │ └── 6.png
│ │ └── Documents
│ │ │ ├── Giant Panda.docx
│ │ │ ├── Company History.pptx
│ │ │ ├── Northwind Report.pdf
│ │ │ └── File Manager.txt
│ ├── Trash
│ │ └── 132368656344891076
│ │ │ └── Desktop-Dec-18.jpg
│ ├── css
│ │ └── open-iconic
│ │ │ ├── font
│ │ │ ├── fonts
│ │ │ │ ├── open-iconic.eot
│ │ │ │ ├── open-iconic.otf
│ │ │ │ ├── open-iconic.ttf
│ │ │ │ └── open-iconic.woff
│ │ │ └── css
│ │ │ │ └── open-iconic-bootstrap.min.css
│ │ │ ├── ICON-LICENSE
│ │ │ ├── README.md
│ │ │ └── FONT-LICENSE
│ ├── app.css
│ └── Script
│ │ └── JsInteropHelper.js
├── .gitignore
├── appsettings.json
├── appsettings.Development.json
├── Components
│ ├── Routes.razor
│ ├── _Imports.razor
│ └── App.razor
├── Models
│ ├── FileManager
│ │ ├── ImageSize.cs
│ │ ├── ErrorDetails.cs
│ │ ├── AccessPermission.cs
│ │ ├── FileDetails.cs
│ │ ├── FileManagerResponse.cs
│ │ ├── IPhysicalFileProvider.cs
│ │ ├── FileManagerParams.cs
│ │ ├── AccessDetails.cs
│ │ ├── FileManagerDirectoryContent.cs
│ │ └── IFileProvider.cs
│ ├── ThumbnailImage.cs
│ └── Constants.cs
├── Shared
│ ├── MainLayout.razor
│ └── NavMenu.razor
├── NuGet.config
├── Properties
│ └── launchSettings.json
├── _Imports.razor
├── Pages
│ ├── ImageEditor.razor
│ ├── TopToolbar.razor
│ ├── About.razor
│ ├── PdfViewer.razor
│ ├── WordViewer.razor
│ ├── PresentationViewer.razor
│ └── ZipViewer.razor
├── Controllers
│ ├── PresentationController.cs
│ ├── ZipViewerController.cs
│ ├── DocumentEditorController.cs
│ ├── PreviewController.cs
│ ├── SharedFilesController.cs
│ ├── TrashController.cs
│ └── FileManagerController.cs
├── Program.cs
└── DocumentExplorer.csproj
├── .gitignore
├── .github
└── workflows
│ └── dotnet.yml
└── README.md
/server/wwwroot/User/trash.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.vs/
2 | .git/
3 | **/bin/
4 | **/obj
--------------------------------------------------------------------------------
/server/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode/
2 | node_modules/
3 | bin/
4 | obj/
5 | deploy/
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/User/trash.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/server/wwwroot/User/star.json:
--------------------------------------------------------------------------------
1 | ["/Documents/File Manager.txt","/Documents/Giant Panda.docx","/Documents/Company History.pptx"]
--------------------------------------------------------------------------------
/server/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/server/wwwroot/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/favicon.png
--------------------------------------------------------------------------------
/server/wwwroot/User/User1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/User/User1.png
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/User1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/User1.png
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/User/User1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/User/User1.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Food/Bread.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Food/Bread.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Nature/sea.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Nature/sea.jpg
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/1.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/2.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/3.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/4.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/5.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Employees/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Employees/6.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Food/Nuggets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Food/Nuggets.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Nature/bird.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Nature/bird.jpg
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Nature/snow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Nature/snow.jpg
--------------------------------------------------------------------------------
/server/wwwroot/Files/Documents/Giant Panda.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Documents/Giant Panda.docx
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Food/Apple pie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Food/Apple pie.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Food/Doughnut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Food/Doughnut.png
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Nature/seaview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Nature/seaview.jpg
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Nature/snowfall.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Nature/snowfall.jpg
--------------------------------------------------------------------------------
/server/wwwroot/Files/Documents/Company History.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Documents/Company History.pptx
--------------------------------------------------------------------------------
/server/wwwroot/Files/Documents/Northwind Report.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Documents/Northwind Report.pdf
--------------------------------------------------------------------------------
/server/wwwroot/Files/Pictures/Food/Sugar cookie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Files/Pictures/Food/Sugar cookie.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/User/star.json:
--------------------------------------------------------------------------------
1 | ["/Documents/File Manager.txt","/Documents/Giant Panda.docx","/Documents/Company History.pptx"]
--------------------------------------------------------------------------------
/server/wwwroot/Trash/132368656344891076/Desktop-Dec-18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/Trash/132368656344891076/Desktop-Dec-18.jpg
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/font/fonts/open-iconic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/css/open-iconic/font/fonts/open-iconic.eot
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/font/fonts/open-iconic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/css/open-iconic/font/fonts/open-iconic.otf
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/font/fonts/open-iconic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/css/open-iconic/font/fonts/open-iconic.woff
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.eot
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.otf
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.ttf
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/SharedFiles/css/open-iconic/font/fonts/open-iconic.woff
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/User/User1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/User/User1.png
--------------------------------------------------------------------------------
/server/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information"
7 | }
8 | },
9 | "AllowedHosts": "*"
10 | }
11 |
--------------------------------------------------------------------------------
/server/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "DetailedErrors": true,
3 | "Logging": {
4 | "LogLevel": {
5 | "Default": "Information",
6 | "Microsoft": "Warning",
7 | "Microsoft.Hosting.Lifetime": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/1.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/2.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/3.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/4.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/5.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Employees/6.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Bread.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Bread.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/bird.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/bird.jpg
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/sea.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/sea.jpg
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/snow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/snow.jpg
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Giant Panda.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Giant Panda.docx
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Apple pie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Apple pie.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Doughnut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Doughnut.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Nuggets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Nuggets.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/seaview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/seaview.jpg
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/snowfall.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Nature/snowfall.jpg
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Company History.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Company History.pptx
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Northwind Report.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/Northwind Report.pdf
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Sugar cookie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Pictures/Food/Sugar cookie.png
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Trash/132368656344891076/Desktop-Dec-18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/syncfusion/blazor-showcase-document-explorer/HEAD/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Trash/132368656344891076/Desktop-Dec-18.jpg
--------------------------------------------------------------------------------
/server/Components/Routes.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/server/wwwroot/Files/Documents/File Manager.txt:
--------------------------------------------------------------------------------
1 | EJ2-File manager
2 |
3 | File Manager components is used to explore a file system through a web application, similar to the windows explorer for windows.
4 | It supports all the basic file operations such as create, rename, delete, cut, copy, paste, upload, download and so on.
5 |
6 |
--------------------------------------------------------------------------------
/server/Models/FileManager/ImageSize.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | #if EJ2_DNX
5 | using System.Web;
6 | #endif
7 |
8 | namespace DocumentExplorer.Models.FileManager
9 | {
10 | public class ImageSize
11 | {
12 | public int Height { get; set; }
13 | public int Width { get; set; }
14 | }
15 | }
--------------------------------------------------------------------------------
/server/wwwroot/VirtualConnections/9fa997ef-e430-4c00-be2b-34df7feed887/Files/Documents/File Manager.txt:
--------------------------------------------------------------------------------
1 | EJ2-File manager
2 |
3 | File Manager components is used to explore a file system through a web application, similar to the windows explorer for windows.
4 | It supports all the basic file operations such as create, rename, delete, cut, copy, paste, upload, download and so on.
5 |
6 |
--------------------------------------------------------------------------------
/server/Shared/MainLayout.razor:
--------------------------------------------------------------------------------
1 | @inherits LayoutComponentBase
2 |
3 | @*
*@
6 |
7 | @*
8 |
11 |
12 |
*@
13 | @Body
14 | @*
15 |
*@
16 |
--------------------------------------------------------------------------------
/server/Models/FileManager/ErrorDetails.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | #if EJ2_DNX
5 | using System.Web;
6 | #endif
7 |
8 | namespace DocumentExplorer.Models.FileManager
9 | {
10 | public class ErrorDetails
11 | {
12 |
13 | public string Code { get; set; }
14 |
15 | public string Message { get; set; }
16 |
17 | public IEnumerable FileExists { get; set; }
18 | }
19 | }
--------------------------------------------------------------------------------
/server/Models/ThumbnailImage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace DocumentExplorer.Models
7 | {
8 | public class ThumbnailImage
9 | {
10 | public string Src { get; set; }
11 | public int PageNumber { get; set; }
12 |
13 | public ThumbnailImage(int pageNumber, string src)
14 | {
15 | PageNumber = pageNumber;
16 | Src = src;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/server/Models/FileManager/AccessPermission.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace DocumentExplorer.Models.FileManager
6 | {
7 | public class AccessPermission
8 | {
9 | public bool Copy = true;
10 | public bool Download = true;
11 | public bool Write = true;
12 | public bool WriteContents = true;
13 | public bool Read = true;
14 | public bool Upload = true;
15 | public string Message = String.Empty;
16 | }
17 | }
--------------------------------------------------------------------------------
/server/Models/FileManager/FileDetails.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace DocumentExplorer.Models.FileManager
4 | {
5 | public class FileDetails
6 | {
7 | public string Name { get; set; }
8 | public string Location { get; set; }
9 | public bool IsFile { get; set; }
10 | public string Size { get; set; }
11 | public DateTime Created { get; set; }
12 | public DateTime Modified { get; set; }
13 | public bool MultipleFiles { get; set; }
14 | public AccessPermission Permission { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/server/Models/FileManager/FileManagerResponse.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | #if EJ2_DNX
5 | using System.Web;
6 | #endif
7 |
8 | namespace DocumentExplorer.Models.FileManager
9 | {
10 |
11 | public class FileManagerResponse
12 | {
13 | public FileManagerDirectoryContent CWD { get; set; }
14 | public IEnumerable Files { get; set; }
15 |
16 | public ErrorDetails Error { get; set; }
17 |
18 | public FileDetails Details { get; set; }
19 |
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/server/Models/FileManager/IPhysicalFileProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using DocumentExplorer.Models.FileManager;
7 |
8 | using Microsoft.AspNetCore.Mvc;
9 | using Microsoft.AspNetCore.Http;
10 | using Microsoft.Net.Http.Headers;
11 |
12 |
13 | namespace DocumentExplorer.Models.FileManager
14 | {
15 | public interface IPhysicalFileProvider : IFileProvider
16 | {
17 | void RootFolder(string folderName);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/server/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/server/Components/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using Microsoft.AspNetCore.Authorization
3 | @using Microsoft.AspNetCore.Components.Authorization
4 | @using Microsoft.AspNetCore.Components.Forms
5 | @using Microsoft.AspNetCore.Components.Routing
6 | @using Microsoft.AspNetCore.Components.Web
7 | @using Microsoft.JSInterop
8 | @using DocumentExplorer
9 | @using DocumentExplorer.Models
10 | @using DocumentExplorer.Shared
11 | @using Newtonsoft.Json
12 | @using Newtonsoft.Json.Linq
13 | @using Syncfusion.Blazor
14 | @using Syncfusion.Blazor.Navigations
15 | @using Microsoft.AspNetCore.WebUtilities
16 | @using System.Text
17 | @using IO = System.IO
18 | @inject IJSRuntime JSRuntime
19 | @inject HttpClient Http
20 | @inject NavigationManager NavigationManager;
21 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a .NET project
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3 |
4 | name: .NET
5 |
6 | on:
7 | push:
8 | branches: [ "master" ]
9 | pull_request:
10 | branches: [ "master" ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 | - name: Setup .NET8
20 | uses: actions/setup-dotnet@v4
21 | with:
22 | dotnet-version: 8.0.x
23 | - name: Setup .NET9
24 | uses: actions/setup-dotnet@v4
25 | with:
26 | dotnet-version: 9.0.x
27 | - name: Build Server
28 | run: dotnet build ./server/DocumentExplorer.csproj
29 |
30 |
--------------------------------------------------------------------------------
/server/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:6085/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "ASPCoreIOShowcaseDemo": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:6085/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/server/_Imports.razor:
--------------------------------------------------------------------------------
1 | @using System.Net.Http
2 | @using Microsoft.AspNetCore.Authorization
3 | @using Microsoft.AspNetCore.Components.Authorization
4 | @using Microsoft.AspNetCore.Components.Forms
5 | @using Microsoft.AspNetCore.Components.Routing
6 | @using Microsoft.AspNetCore.Components.Web
7 | @using static Microsoft.AspNetCore.Components.Web.RenderMode
8 | @using Microsoft.JSInterop
9 | @using DocumentExplorer
10 | @using DocumentExplorer.Models
11 | @using DocumentExplorer.Shared
12 | @using Newtonsoft.Json
13 | @using Newtonsoft.Json.Linq
14 | @using Syncfusion.Blazor
15 | @using Syncfusion.Blazor.Navigations
16 | @using Microsoft.AspNetCore.WebUtilities
17 | @using System.Text
18 | @using IO = System.IO
19 | @inject IJSRuntime JSRuntime
20 | @inject HttpClient Http
21 | @inject NavigationManager NavigationManager;
22 |
--------------------------------------------------------------------------------
/server/Models/FileManager/FileManagerParams.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | #if EJ2_DNX
5 | using System.Web;
6 | #else
7 | using Microsoft.AspNetCore.Http;
8 | #endif
9 |
10 | namespace DocumentExplorer.Models.FileManager
11 | {
12 | public class FileManagerParams
13 | {
14 | public string Name { get; set; }
15 |
16 | public string[] Names { get; set; }
17 |
18 | public string Path { get; set; }
19 |
20 | public string TargetPath { get; set; }
21 |
22 | public string NewName { get; set; }
23 |
24 | public object Date { get; set; }
25 | #if EJ2_DNX
26 | public IEnumerable FileUpload { get; set; }
27 | #else
28 | public IEnumerable FileUpload { get; set; }
29 |
30 | #endif
31 | public string[] ReplacedItemNames { get; set; }
32 | }
33 | }
--------------------------------------------------------------------------------
/server/Models/FileManager/AccessDetails.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | #if EJ2_DNX
5 | using System.Web;
6 | #endif
7 |
8 | namespace DocumentExplorer.Models.FileManager
9 | {
10 | public class AccessDetails
11 | {
12 | public string Role { get; set; }
13 | public IEnumerable AccessRules { get; set; }
14 | }
15 |
16 | public class AccessRule
17 | {
18 | public Permission Copy { get; set; }
19 | public Permission Download { get; set; }
20 | public Permission Write { get; set; }
21 | public string Path { get; set; }
22 | public Permission Read { get; set; }
23 | public string Role { get; set; }
24 | public Permission WriteContents { get; set; }
25 | public Permission Upload { get; set; }
26 | public bool IsFile { get; set; }
27 | public string Message { get; set; }
28 | }
29 | public enum Permission
30 | {
31 | Allow,
32 | Deny
33 | }
34 | }
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/ICON-LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/ICON-LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/server/Pages/ImageEditor.razor:
--------------------------------------------------------------------------------
1 | @page "/image-viewer"
2 | @using Syncfusion.Blazor
3 | @using Syncfusion.Blazor.ImageEditor
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | @code {
14 | SfImageEditor _imageEditor;
15 | TopToolbar _topToolbar;
16 | Index _indexDetails;
17 | private void created()
18 | {
19 | var data = QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query);
20 | if (data.TryGetValue("fileName", out var fileName))
21 | {
22 | _topToolbar.RootName = fileName.ToString();
23 | }
24 | if (data.TryGetValue("imageUrl", out var imageUrl))
25 | {
26 | string imageUrlString = imageUrl.ToString(); // Convert to string explicitly
27 | _imageEditor.OpenAsync(imageUrlString);
28 | }
29 | }
30 | private void BackClickHandler()
31 | {
32 | NavigationManager.NavigateTo(NavigationManager.BaseUri);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/server/Shared/NavMenu.razor:
--------------------------------------------------------------------------------
1 | @*
7 |
8 |
27 |
28 | @code {
29 | private bool collapseNavMenu = true;
30 |
31 | private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
32 |
33 | private void ToggleNavMenu()
34 | {
35 | collapseNavMenu = !collapseNavMenu;
36 | }
37 | }*@
38 |
--------------------------------------------------------------------------------
/server/Models/Constants.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 |
6 | namespace DocumentExplorer.Models
7 | {
8 | public class Constants
9 | {
10 | public const string Zip = ".zip";
11 | public const string Pptx = ".pptx";
12 | public const string Pdf = ".pdf";
13 | public const string Docx = ".docx";
14 | public const string Doc = ".doc";
15 | public const string Rtf = ".rtf";
16 | public const string Txt = ".txt";
17 | public const string Dotx = ".dotx";
18 | public const string Docm = ".docm";
19 | public const string Dotm = ".dotm";
20 | public const string Dot = ".dot";
21 | public const string Xml = ".xml";
22 | public const string Html = ".html";
23 | public const string Bmp = ".bmp";
24 | public const string Dib = ".dib";
25 | public const string Jpg = ".jpg";
26 | public const string Jpeg = ".jpeg";
27 | public const string Jpe = ".jpe";
28 | public const string Jfif = ".jfif";
29 | public const string Gif = ".gif";
30 | public const string Tif = ".tif";
31 | public const string Tiff = ".tiff";
32 | public const string Png = ".png";
33 | public const string Ico = ".ico";
34 |
35 |
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/server/Pages/TopToolbar.razor:
--------------------------------------------------------------------------------
1 | @*@page "/topToolbar"*@
2 |
3 | @using Syncfusion.Blazor.Navigations
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | @RootName
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | @code {
28 | public string RootName { get; set; }
29 |
30 | private async void CallBackClick()
31 | {
32 | await BackClick.InvokeAsync("Back");
33 | }
34 |
35 | [Parameter]
36 | public EventCallback BackClick { get; set; }
37 | }
--------------------------------------------------------------------------------
/server/Models/FileManager/FileManagerDirectoryContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Microsoft.AspNetCore.Http;
4 |
5 |
6 | namespace DocumentExplorer.Models.FileManager
7 | {
8 | public class FileManagerDirectoryContent
9 | {
10 | public string Path { get; set; }
11 |
12 | public string Action { get; set; }
13 |
14 | public string NewName { get; set; }
15 |
16 | public string[] Names { get; set; }
17 |
18 | public string Name { get; set; }
19 |
20 | public long Size { get; set; }
21 |
22 | public string PreviousName { get; set; }
23 |
24 | public DateTime DateModified { get; set; }
25 |
26 | public DateTime DateCreated { get; set; }
27 |
28 | public bool HasChild { get; set; }
29 |
30 | public bool IsFile { get; set; }
31 |
32 | public string Type { get; set; }
33 |
34 | public string Id { get; set; }
35 |
36 | public string FilterPath { get; set; }
37 |
38 | public string FilterId { get; set; }
39 |
40 | public string ParentId { get; set; }
41 |
42 | public string TargetPath { get; set; }
43 |
44 | public string[] RenameFiles { get; set; }
45 |
46 | public IList UploadFiles { get; set; }
47 |
48 | public bool CaseSensitive { get; set; }
49 |
50 | public string SearchString { get; set; }
51 |
52 | public bool ShowHiddenItems { get; set; }
53 |
54 | public FileManagerDirectoryContent[] Data { get; set; }
55 |
56 | public FileManagerDirectoryContent TargetData { get; set; }
57 |
58 | public AccessPermission Permission { get; set; }
59 | }
60 | }
--------------------------------------------------------------------------------
/server/Models/FileManager/IFileProvider.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Serialization;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.IO.Compression;
7 | using System.Linq;
8 | using System.Text.RegularExpressions;
9 | using Microsoft.AspNetCore.Mvc;
10 | using Microsoft.AspNetCore.Http;
11 | using Microsoft.Net.Http.Headers;
12 |
13 | namespace DocumentExplorer.Models.FileManager
14 | {
15 | public interface IFileProvider
16 | {
17 |
18 | FileManagerResponse GetFiles(string path, bool showHiddenItems, params FileManagerDirectoryContent[] data);
19 | FileManagerResponse Create(string path, string name, params FileManagerDirectoryContent[] data);
20 |
21 | FileManagerResponse Details(string path, string[] names, params FileManagerDirectoryContent[] data);
22 |
23 | FileManagerResponse Delete(string path, string[] names, params FileManagerDirectoryContent[] data);
24 |
25 | FileManagerResponse Rename(string path, string name, string newName, bool replace = false, params FileManagerDirectoryContent[] data);
26 |
27 | FileManagerResponse Copy(string path, string targetPath, string[] names, string[] renameFiles, FileManagerDirectoryContent targetData, params FileManagerDirectoryContent[] data);
28 |
29 | FileManagerResponse Move(string path, string targetPath, string[] names, string[] renameFiles, FileManagerDirectoryContent targetData, params FileManagerDirectoryContent[] data);
30 |
31 | FileManagerResponse Search(string path, string searchString, bool showHiddenItems, bool caseSensitive, params FileManagerDirectoryContent[] data);
32 |
33 | FileStreamResult Download(string path, string[] names, params FileManagerDirectoryContent[] data);
34 | #if EJ2_DNX
35 | FileManagerResponse Upload(string path, IList uploadFiles, string action, params FileManagerDirectoryContent[] data);
36 | #else
37 | FileManagerResponse Upload(string path, IList uploadFiles, string action, string basePath, params FileManagerDirectoryContent[] data);
38 | #endif
39 |
40 | FileStreamResult GetImage(string path, string id, bool allowCompress, ImageSize size, params FileManagerDirectoryContent[] data);
41 |
42 | }
43 |
44 | }
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/server/Controllers/PresentationController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.Mvc;
8 | using DocumentExplorer.Models.FileManager;
9 | using Syncfusion.Pdf;
10 | using Syncfusion.Presentation;
11 | using Syncfusion.PresentationRenderer;
12 |
13 | namespace DocumentExplorer.Controllers
14 | {
15 | [Route("api/[controller]")]
16 | [ApiController]
17 | public class PresentationController : ControllerBase
18 | {
19 | private string basePath;
20 | private string baseLocation;
21 | private IWebHostEnvironment _hostingEnvironment;
22 | public PresentationController(IWebHostEnvironment hostingEnvironment)
23 | {
24 | _hostingEnvironment = hostingEnvironment;
25 | basePath = _hostingEnvironment.ContentRootPath;
26 | baseLocation = basePath + "\\wwwroot\\";
27 | }
28 |
29 | [Route("ConvertToPDF")]
30 | public string[] ConvertToPDF([FromBody] FileManagerDirectoryContent args)
31 | {
32 | string fileLocation = this.baseLocation + args.Path.Replace("/", "\\");
33 | // If document get open from zip file, we have maintained the extracted document path in TargetPath property.
34 | if (args.TargetPath != null)
35 | fileLocation = args.TargetPath;
36 | List returnArray = new List();
37 | using FileStream fs = new FileStream(fileLocation, FileMode.Open, FileAccess.Read);
38 | //Open the existing presentation
39 | IPresentation presentation = Syncfusion.Presentation.Presentation.Open(fs);
40 | //Convert the PowerPoint document to PDF document.
41 | PdfDocument pdfDocument = PresentationToPdfConverter.Convert(presentation);
42 | //Save the document as a stream and retrun the stream
43 | MemoryStream stream = new MemoryStream();
44 | //Save the created PowerPoint document to MemoryStream
45 | pdfDocument.Save(stream);
46 | stream.Position = 0;
47 | returnArray.Add("data:application/pdf;base64," + Convert.ToBase64String(stream.ToArray()));
48 | //Dispose the document objects.
49 | presentation.Dispose();
50 | pdfDocument.Dispose();
51 | stream.Dispose();
52 | return returnArray.ToArray();
53 |
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/server/Program.cs:
--------------------------------------------------------------------------------
1 | using DocumentExplorer.Components;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Builder;
7 | using Microsoft.AspNetCore.Components;
8 | using Microsoft.AspNetCore.Hosting;
9 | using Microsoft.AspNetCore.HttpsPolicy;
10 | using Microsoft.Extensions.Configuration;
11 | using Microsoft.Extensions.DependencyInjection;
12 | using Microsoft.Extensions.Hosting;
13 | using Syncfusion.Blazor;
14 | using Microsoft.Net.Http.Headers;
15 | using Newtonsoft.Json.Serialization;
16 | using System.IO;
17 | using Syncfusion.Licensing;
18 |
19 | var builder = WebApplication.CreateBuilder(args);
20 |
21 | // Add services to the container.
22 | builder.Services.AddRazorComponents()
23 | .AddInteractiveServerComponents();
24 | builder.Services.AddServerSideBlazor().AddHubOptions(o => { o.MaximumReceiveMessageSize = 102400000; });
25 | builder.Services.AddSyncfusionBlazor();
26 | builder.Services.AddMemoryCache();
27 | builder.Services.AddHttpClient();
28 | builder.Services.AddSession();
29 | builder.Services.AddDistributedMemoryCache();
30 | builder.Services.AddCors(options =>
31 | {
32 | options.AddPolicy("AllowAllOrigins", builder =>
33 | {
34 | builder.AllowAnyOrigin()
35 | .AllowAnyMethod()
36 | .AllowAnyHeader();
37 | });
38 | });
39 | builder.Services.AddControllers().AddNewtonsoftJson(options =>
40 | {
41 | options.SerializerSettings.ContractResolver = new DefaultContractResolver();
42 | });
43 | if (File.Exists(Directory.GetCurrentDirectory() + "/SyncfusionLicense.txt"))
44 | {
45 | string licenseKey = System.IO.File.ReadAllText(Directory.GetCurrentDirectory() + "/SyncfusionLicense.txt");
46 | SyncfusionLicenseProvider.RegisterLicense(licenseKey);
47 | }
48 | var app = builder.Build();
49 |
50 | // Configure the HTTP request pipeline.
51 | if (!app.Environment.IsDevelopment())
52 | {
53 | app.UseExceptionHandler("/Error", createScopeForErrors: true);
54 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
55 | app.UseHsts();
56 | }
57 |
58 | app.UseHttpsRedirection();
59 | app.UseSession();
60 | app.UseStaticFiles();
61 | app.UseAntiforgery();
62 |
63 | app.MapRazorComponents()
64 | .AddInteractiveServerRenderMode();
65 | app.MapControllers();
66 |
67 | app.MapDefaultControllerRoute();
68 | //app.MapBlazorHub();
69 | app.UseCors();
70 |
71 | app.Run();
72 |
--------------------------------------------------------------------------------
/server/wwwroot/app.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
3 | }
4 |
5 | a, .btn-link {
6 | color: #006bb7;
7 | }
8 |
9 | .btn-primary {
10 | color: #fff;
11 | background-color: #1b6ec2;
12 | border-color: #1861ac;
13 | }
14 |
15 | .btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
16 | box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
17 | }
18 |
19 | .content {
20 | padding-top: 1.1rem;
21 | }
22 |
23 | h1:focus {
24 | outline: none;
25 | }
26 |
27 | .valid.modified:not([type=checkbox]) {
28 | outline: 1px solid #26b050;
29 | }
30 |
31 | .invalid {
32 | outline: 1px solid #e50000;
33 | }
34 |
35 | .validation-message {
36 | color: #e50000;
37 | }
38 |
39 | .blazor-error-boundary {
40 | background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
41 | padding: 1rem 1rem 1rem 3.7rem;
42 | color: white;
43 | }
44 |
45 | .blazor-error-boundary::after {
46 | content: "An error has occurred."
47 | }
48 |
49 | .darker-border-checkbox.form-check-input {
50 | border-color: #929292;
51 | }
52 |
--------------------------------------------------------------------------------
/server/DocumentExplorer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | DocumentExplorer
6 | Debug;Release;Publish
7 |
8 |
9 |
10 | TRACE;Publish
11 |
12 |
13 |
14 | False
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | Always
53 |
54 |
55 |
56 |
57 |
58 | Always
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/server/Components/App.razor:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Blazor Document Explorer Showcase example | Syncfusion Demos
8 |
9 |
10 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | @**@
40 |
41 | @* *@
42 |
43 |
44 |
45 | An error has occurred. This application may no longer respond until reloaded.
46 |
47 |
48 | An unhandled exception has occurred. See browser dev tools for details.
49 |
50 |
Reload
51 |
🗙
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/server/Pages/About.razor:
--------------------------------------------------------------------------------
1 | @page "/about"
2 |
3 |
4 |
5 |
6 |
7 |
8 | This document explorer demo application showcases several Syncfusion Blazor UI components together in a real-world application scenario. You can explore the source code of this application and use it as a reference for integrating Syncfusion Blazor UI components into your applications.
9 |
10 |
List of Syncfusion Blazor UI components used in this sample
11 |
12 |
16 |
20 |
24 |
28 |
32 |
36 |
40 |
44 |
48 |
49 |
50 | @code {
51 | private TopToolbar _topToolbar;
52 | protected override void OnAfterRender(bool firstRender)
53 | {
54 | if (_topToolbar != null)
55 | {
56 | _topToolbar.RootName = "About";
57 | }
58 | }
59 | #region TopToolBar Interaction
60 | private void BackClickHandler()
61 | {
62 | NavigationManager.NavigateTo(NavigationManager.BaseUri);
63 | }
64 | #endregion
65 | }
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/README.md:
--------------------------------------------------------------------------------
1 | [Open Iconic v1.1.1](http://useiconic.com/open)
2 | ===========
3 |
4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons)
5 |
6 |
7 |
8 | ## What's in Open Iconic?
9 |
10 | * 223 icons designed to be legible down to 8 pixels
11 | * Super-light SVG files - 61.8 for the entire set
12 | * SVG sprite—the modern replacement for icon fonts
13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
16 |
17 |
18 | ## Getting Started
19 |
20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections.
21 |
22 | ### General Usage
23 |
24 | #### Using Open Iconic's SVGs
25 |
26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
27 |
28 | ```
29 |
30 | ```
31 |
32 | #### Using Open Iconic's SVG Sprite
33 |
34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
35 |
36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.*
37 |
38 | ```
39 |
40 |
41 |
42 | ```
43 |
44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions.
45 |
46 | ```
47 | .icon {
48 | width: 16px;
49 | height: 16px;
50 | }
51 | ```
52 |
53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag.
54 |
55 | ```
56 | .icon-account-login {
57 | fill: #f00;
58 | }
59 | ```
60 |
61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/).
62 |
63 | #### Using Open Iconic's Icon Font...
64 |
65 |
66 | ##### …with Bootstrap
67 |
68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}`
69 |
70 |
71 | ```
72 |
73 | ```
74 |
75 |
76 | ```
77 |
78 | ```
79 |
80 | ##### …with Foundation
81 |
82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}`
83 |
84 | ```
85 |
86 | ```
87 |
88 |
89 | ```
90 |
91 | ```
92 |
93 | ##### …on its own
94 |
95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}`
96 |
97 | ```
98 |
99 | ```
100 |
101 | ```
102 |
103 | ```
104 |
105 |
106 | ## License
107 |
108 | ### Icons
109 |
110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT).
111 |
112 | ### Fonts
113 |
114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web).
115 |
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/README.md:
--------------------------------------------------------------------------------
1 | [Open Iconic v1.1.1](http://useiconic.com/open)
2 | ===========
3 |
4 | ### Open Iconic is the open source sibling of [Iconic](http://useiconic.com). It is a hyper-legible collection of 223 icons with a tiny footprint—ready to use with Bootstrap and Foundation. [View the collection](http://useiconic.com/open#icons)
5 |
6 |
7 |
8 | ## What's in Open Iconic?
9 |
10 | * 223 icons designed to be legible down to 8 pixels
11 | * Super-light SVG files - 61.8 for the entire set
12 | * SVG sprite—the modern replacement for icon fonts
13 | * Webfont (EOT, OTF, SVG, TTF, WOFF), PNG and WebP formats
14 | * Webfont stylesheets (including versions for Bootstrap and Foundation) in CSS, LESS, SCSS and Stylus formats
15 | * PNG and WebP raster images in 8px, 16px, 24px, 32px, 48px and 64px.
16 |
17 |
18 | ## Getting Started
19 |
20 | #### For code samples and everything else you need to get started with Open Iconic, check out our [Icons](http://useiconic.com/open#icons) and [Reference](http://useiconic.com/open#reference) sections.
21 |
22 | ### General Usage
23 |
24 | #### Using Open Iconic's SVGs
25 |
26 | We like SVGs and we think they're the way to display icons on the web. Since Open Iconic are just basic SVGs, we suggest you display them like you would any other image (don't forget the `alt` attribute).
27 |
28 | ```
29 |
30 | ```
31 |
32 | #### Using Open Iconic's SVG Sprite
33 |
34 | Open Iconic also comes in a SVG sprite which allows you to display all the icons in the set with a single request. It's like an icon font, without being a hack.
35 |
36 | Adding an icon from an SVG sprite is a little different than what you're used to, but it's still a piece of cake. *Tip: To make your icons easily style able, we suggest adding a general class to the* `` *tag and a unique class name for each different icon in the* `` *tag.*
37 |
38 | ```
39 |
40 |
41 |
42 | ```
43 |
44 | Sizing icons only needs basic CSS. All the icons are in a square format, so just set the `` tag with equal width and height dimensions.
45 |
46 | ```
47 | .icon {
48 | width: 16px;
49 | height: 16px;
50 | }
51 | ```
52 |
53 | Coloring icons is even easier. All you need to do is set the `fill` rule on the `` tag.
54 |
55 | ```
56 | .icon-account-login {
57 | fill: #f00;
58 | }
59 | ```
60 |
61 | To learn more about SVG Sprites, read [Chris Coyier's guide](http://css-tricks.com/svg-sprites-use-better-icon-fonts/).
62 |
63 | #### Using Open Iconic's Icon Font...
64 |
65 |
66 | ##### …with Bootstrap
67 |
68 | You can find our Bootstrap stylesheets in `font/css/open-iconic-bootstrap.{css, less, scss, styl}`
69 |
70 |
71 | ```
72 |
73 | ```
74 |
75 |
76 | ```
77 |
78 | ```
79 |
80 | ##### …with Foundation
81 |
82 | You can find our Foundation stylesheets in `font/css/open-iconic-foundation.{css, less, scss, styl}`
83 |
84 | ```
85 |
86 | ```
87 |
88 |
89 | ```
90 |
91 | ```
92 |
93 | ##### …on its own
94 |
95 | You can find our default stylesheets in `font/css/open-iconic.{css, less, scss, styl}`
96 |
97 | ```
98 |
99 | ```
100 |
101 | ```
102 |
103 | ```
104 |
105 |
106 | ## License
107 |
108 | ### Icons
109 |
110 | All code (including SVG markup) is under the [MIT License](http://opensource.org/licenses/MIT).
111 |
112 | ### Fonts
113 |
114 | All fonts are under the [SIL Licensed](http://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web).
115 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/syncfusion/blazor-showcase-document-explorer/actions/workflows/dotnet.yml)
2 |
3 | # Essential® Studio for Blazor - Document Explorer
4 |
5 | This document explorer demo application showcases several Syncfusion® Blazor UI components together in a real-world application scenario. This demo manages the file system that allows users to perform most common file operations like accessing, editing, and sorting files or folders and also opens Word, RTF, Text, PowerPoint and PDF documents.
6 |
7 | ## Requirements to run the demo
8 |
9 | * [System requirements](https://blazor.syncfusion.com/documentation/system-requirements/)
10 |
11 | * [.NET 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
12 |
13 | ## How to run the demo
14 |
15 | Clone the repository.This repository contains Blazor Document Explorer Server app.
16 | * `server` folder has solution and project files to run Document Explorer server app.
17 |
18 | ### Run the demo using .NET CLI
19 |
20 | * Open the command prompt from the demo's directory.
21 | * Run the demo using the following command.
22 |
23 | To run .NET 8 Document Explorer Server project
24 | > `dotnet run --project server/DocumentExplorer.csproj`
25 |
26 | ### Run the demo using Visual Studio
27 |
28 | * Open the solution file using Visual Studio.
29 | * Press `Ctrl + F5` to run the demo.
30 |
31 | ### Run the demo using Visual Studio code
32 |
33 | * Open the Visual Studio code from the Demo directory where the project file is present.
34 |
35 | * Press `Ctrl + F5` to run the demo.
36 |
37 |
38 | ## Live Demo
39 |
40 | #### Document Explorer Live Demo
41 |
42 | Check all the showcase samples from here .
43 |
44 | ## License
45 |
46 | Syncfusion® Blazor Components is available under the Syncfusion® Essential Studio program, and can be licensed either under the Syncfusion® Community License Program or the Syncfusion commercial license.
47 |
48 | To be qualified for the Syncfusion® Community License Program, you must have gross revenue of less than one (1) million U.S. dollars (USD 1,000,000.00) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion's terms and conditions.
49 |
50 | Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
51 |
52 | Use of Syncfusion® Blazor Components requires prior acquisition of either a Community License or a Commercial License. Additionally, usage is subject to acceptance of and compliance with Syncfusion's license terms and conditions.
53 |
54 | The Syncfusion® license that contains the terms and conditions can be found at
55 | [https://www.syncfusion.com/content/downloads/syncfusion_license.pdf](https://www.syncfusion.com/content/downloads/syncfusion_license.pdf)
56 |
57 | ## Support and feedback
58 |
59 | * For any other queries, reach the [Syncfusion® support team](https://support.syncfusion.com/) or post the queries through the [community forums](https://www.syncfusion.com/forums?utm_source=github&utm_medium=listing&utm_campaign=blazor-samples).
60 |
61 | * To renew the subscription, click [here](https://www.syncfusion.com/sales/products?utm_source=github&utm_medium=listing&utm_campaign=blazor-samples) or contact our sales team at .
62 |
63 | * If the required information is not available, it can be submitted through the Syncfusion® Blazor Components Feedback Portal [feedback portal](https://www.syncfusion.com/feedback/blazor-components).
64 |
65 | ## See also
66 |
67 | * [Blazor Documentation](https://blazor.syncfusion.com/documentation/introduction)
68 | * [Blazor Components](https://www.syncfusion.com/blazor-components)
69 | * [Blazor Live Demos - Server](https://blazor.syncfusion.com/demos/)
70 | * [Blazor Live Demos - WebAssembly](https://blazor.syncfusion.com/wasm/demos/)
71 | * [Blazor Playground](https://blazorplayground.syncfusion.com/)
72 | * [Blazor Smart/AI Samples](https://github.com/syncfusion/smart-ai-samples)
73 |
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/site.css:
--------------------------------------------------------------------------------
1 | @import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
2 |
3 | html, body {
4 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
5 | }
6 |
7 | a, .btn-link {
8 | color: #0366d6;
9 | }
10 |
11 | .btn-primary {
12 | color: #fff;
13 | background-color: #1b6ec2;
14 | border-color: #1861ac;
15 | }
16 |
17 | app {
18 | position: relative;
19 | display: flex;
20 | flex-direction: column;
21 | }
22 |
23 | .top-row {
24 | height: 3.5rem;
25 | display: flex;
26 | align-items: center;
27 | }
28 |
29 | .main {
30 | flex: 1;
31 | }
32 |
33 | .main .top-row {
34 | background-color: #f7f7f7;
35 | border-bottom: 1px solid #d6d5d5;
36 | justify-content: flex-end;
37 | }
38 |
39 | .main .top-row > a, .main .top-row .btn-link {
40 | white-space: nowrap;
41 | margin-left: 1.5rem;
42 | }
43 |
44 | .main .top-row a:first-child {
45 | overflow: hidden;
46 | text-overflow: ellipsis;
47 | }
48 |
49 | .sidebar {
50 | background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
51 | }
52 |
53 | .sidebar .top-row {
54 | background-color: rgba(0,0,0,0.4);
55 | }
56 |
57 | .sidebar .navbar-brand {
58 | font-size: 1.1rem;
59 | }
60 |
61 | .sidebar .oi {
62 | width: 2rem;
63 | font-size: 1.1rem;
64 | vertical-align: text-top;
65 | top: -2px;
66 | }
67 |
68 | .sidebar .nav-item {
69 | font-size: 0.9rem;
70 | padding-bottom: 0.5rem;
71 | }
72 |
73 | .sidebar .nav-item:first-of-type {
74 | padding-top: 1rem;
75 | }
76 |
77 | .sidebar .nav-item:last-of-type {
78 | padding-bottom: 1rem;
79 | }
80 |
81 | .sidebar .nav-item a {
82 | color: #d7d7d7;
83 | border-radius: 4px;
84 | height: 3rem;
85 | display: flex;
86 | align-items: center;
87 | line-height: 3rem;
88 | }
89 |
90 | .sidebar .nav-item a.active {
91 | background-color: rgba(255,255,255,0.25);
92 | color: white;
93 | }
94 |
95 | .sidebar .nav-item a:hover {
96 | background-color: rgba(255,255,255,0.1);
97 | color: white;
98 | }
99 |
100 | .content {
101 | padding-top: 1.1rem;
102 | }
103 |
104 | .navbar-toggler {
105 | background-color: rgba(255, 255, 255, 0.1);
106 | }
107 |
108 | .valid.modified:not([type=checkbox]) {
109 | outline: 1px solid #26b050;
110 | }
111 |
112 | .invalid {
113 | outline: 1px solid red;
114 | }
115 |
116 | .validation-message {
117 | color: red;
118 | }
119 |
120 | #blazor-error-ui {
121 | background: lightyellow;
122 | bottom: 0;
123 | box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
124 | display: none;
125 | left: 0;
126 | padding: 0.6rem 1.25rem 0.7rem 1.25rem;
127 | position: fixed;
128 | width: 100%;
129 | z-index: 1000;
130 | }
131 |
132 | #blazor-error-ui .dismiss {
133 | cursor: pointer;
134 | position: absolute;
135 | right: 0.75rem;
136 | top: 0.5rem;
137 | }
138 |
139 | @media (max-width: 767.98px) {
140 | .main .top-row:not(.auth) {
141 | display: none;
142 | }
143 |
144 | .main .top-row.auth {
145 | justify-content: space-between;
146 | }
147 |
148 | .main .top-row a, .main .top-row .btn-link {
149 | margin-left: 0;
150 | }
151 | }
152 |
153 | @media (min-width: 768px) {
154 | app {
155 | flex-direction: row;
156 | }
157 |
158 | .sidebar {
159 | width: 250px;
160 | height: 100vh;
161 | position: sticky;
162 | top: 0;
163 | }
164 |
165 | .main .top-row {
166 | position: sticky;
167 | top: 0;
168 | }
169 |
170 | .main > div {
171 | padding-left: 2rem !important;
172 | padding-right: 1.5rem !important;
173 | }
174 |
175 | .navbar-toggler {
176 | display: none;
177 | }
178 |
179 | .sidebar .collapse {
180 | /* Never collapse the sidebar for wide screens */
181 | display: block;
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/FONT-LICENSE:
--------------------------------------------------------------------------------
1 | SIL OPEN FONT LICENSE Version 1.1
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | PREAMBLE
6 | The goals of the Open Font License (OFL) are to stimulate worldwide
7 | development of collaborative font projects, to support the font creation
8 | efforts of academic and linguistic communities, and to provide a free and
9 | open framework in which fonts may be shared and improved in partnership
10 | with others.
11 |
12 | The OFL allows the licensed fonts to be used, studied, modified and
13 | redistributed freely as long as they are not sold by themselves. The
14 | fonts, including any derivative works, can be bundled, embedded,
15 | redistributed and/or sold with any software provided that any reserved
16 | names are not used by derivative works. The fonts and derivatives,
17 | however, cannot be released under any other type of license. The
18 | requirement for fonts to remain under this license does not apply
19 | to any document created using the fonts or their derivatives.
20 |
21 | DEFINITIONS
22 | "Font Software" refers to the set of files released by the Copyright
23 | Holder(s) under this license and clearly marked as such. This may
24 | include source files, build scripts and documentation.
25 |
26 | "Reserved Font Name" refers to any names specified as such after the
27 | copyright statement(s).
28 |
29 | "Original Version" refers to the collection of Font Software components as
30 | distributed by the Copyright Holder(s).
31 |
32 | "Modified Version" refers to any derivative made by adding to, deleting,
33 | or substituting -- in part or in whole -- any of the components of the
34 | Original Version, by changing formats or by porting the Font Software to a
35 | new environment.
36 |
37 | "Author" refers to any designer, engineer, programmer, technical
38 | writer or other person who contributed to the Font Software.
39 |
40 | PERMISSION & CONDITIONS
41 | Permission is hereby granted, free of charge, to any person obtaining
42 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
43 | redistribute, and sell modified and unmodified copies of the Font
44 | Software, subject to the following conditions:
45 |
46 | 1) Neither the Font Software nor any of its individual components,
47 | in Original or Modified Versions, may be sold by itself.
48 |
49 | 2) Original or Modified Versions of the Font Software may be bundled,
50 | redistributed and/or sold with any software, provided that each copy
51 | contains the above copyright notice and this license. These can be
52 | included either as stand-alone text files, human-readable headers or
53 | in the appropriate machine-readable metadata fields within text or
54 | binary files as long as those fields can be easily viewed by the user.
55 |
56 | 3) No Modified Version of the Font Software may use the Reserved Font
57 | Name(s) unless explicit written permission is granted by the corresponding
58 | Copyright Holder. This restriction only applies to the primary font name as
59 | presented to the users.
60 |
61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
62 | Software shall not be used to promote, endorse or advertise any
63 | Modified Version, except to acknowledge the contribution(s) of the
64 | Copyright Holder(s) and the Author(s) or with their explicit written
65 | permission.
66 |
67 | 5) The Font Software, modified or unmodified, in part or in whole,
68 | must be distributed entirely under this license, and must not be
69 | distributed under any other license. The requirement for fonts to
70 | remain under this license does not apply to any document created
71 | using the Font Software.
72 |
73 | TERMINATION
74 | This license becomes null and void if any of the above conditions are
75 | not met.
76 |
77 | DISCLAIMER
78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
86 | OTHER DEALINGS IN THE FONT SOFTWARE.
87 |
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/FONT-LICENSE:
--------------------------------------------------------------------------------
1 | SIL OPEN FONT LICENSE Version 1.1
2 |
3 | Copyright (c) 2014 Waybury
4 |
5 | PREAMBLE
6 | The goals of the Open Font License (OFL) are to stimulate worldwide
7 | development of collaborative font projects, to support the font creation
8 | efforts of academic and linguistic communities, and to provide a free and
9 | open framework in which fonts may be shared and improved in partnership
10 | with others.
11 |
12 | The OFL allows the licensed fonts to be used, studied, modified and
13 | redistributed freely as long as they are not sold by themselves. The
14 | fonts, including any derivative works, can be bundled, embedded,
15 | redistributed and/or sold with any software provided that any reserved
16 | names are not used by derivative works. The fonts and derivatives,
17 | however, cannot be released under any other type of license. The
18 | requirement for fonts to remain under this license does not apply
19 | to any document created using the fonts or their derivatives.
20 |
21 | DEFINITIONS
22 | "Font Software" refers to the set of files released by the Copyright
23 | Holder(s) under this license and clearly marked as such. This may
24 | include source files, build scripts and documentation.
25 |
26 | "Reserved Font Name" refers to any names specified as such after the
27 | copyright statement(s).
28 |
29 | "Original Version" refers to the collection of Font Software components as
30 | distributed by the Copyright Holder(s).
31 |
32 | "Modified Version" refers to any derivative made by adding to, deleting,
33 | or substituting -- in part or in whole -- any of the components of the
34 | Original Version, by changing formats or by porting the Font Software to a
35 | new environment.
36 |
37 | "Author" refers to any designer, engineer, programmer, technical
38 | writer or other person who contributed to the Font Software.
39 |
40 | PERMISSION & CONDITIONS
41 | Permission is hereby granted, free of charge, to any person obtaining
42 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
43 | redistribute, and sell modified and unmodified copies of the Font
44 | Software, subject to the following conditions:
45 |
46 | 1) Neither the Font Software nor any of its individual components,
47 | in Original or Modified Versions, may be sold by itself.
48 |
49 | 2) Original or Modified Versions of the Font Software may be bundled,
50 | redistributed and/or sold with any software, provided that each copy
51 | contains the above copyright notice and this license. These can be
52 | included either as stand-alone text files, human-readable headers or
53 | in the appropriate machine-readable metadata fields within text or
54 | binary files as long as those fields can be easily viewed by the user.
55 |
56 | 3) No Modified Version of the Font Software may use the Reserved Font
57 | Name(s) unless explicit written permission is granted by the corresponding
58 | Copyright Holder. This restriction only applies to the primary font name as
59 | presented to the users.
60 |
61 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
62 | Software shall not be used to promote, endorse or advertise any
63 | Modified Version, except to acknowledge the contribution(s) of the
64 | Copyright Holder(s) and the Author(s) or with their explicit written
65 | permission.
66 |
67 | 5) The Font Software, modified or unmodified, in part or in whole,
68 | must be distributed entirely under this license, and must not be
69 | distributed under any other license. The requirement for fonts to
70 | remain under this license does not apply to any document created
71 | using the Font Software.
72 |
73 | TERMINATION
74 | This license becomes null and void if any of the above conditions are
75 | not met.
76 |
77 | DISCLAIMER
78 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
79 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
80 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
81 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
82 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
83 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
84 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
85 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
86 | OTHER DEALINGS IN THE FONT SOFTWARE.
87 |
--------------------------------------------------------------------------------
/server/Pages/PdfViewer.razor:
--------------------------------------------------------------------------------
1 | @page "/pdf-viewer"
2 |
3 | @using Syncfusion.Blazor.SfPdfViewer
4 |
5 |
6 |
7 |
8 |
9 |
@DocumentName
10 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 | @code {
28 | private string OverlayStyle { get; set; } = "overlayShow";
29 | private string DocumentName { get; set; }
30 | private string PreviewPath { get; set; }
31 | private string FileName { get; set; }
32 | private string SubPath { get; set; }
33 | private string Path { get; set; }
34 | private string DocumentPath { get; set; }
35 | private int PageNumber { get; set; }
36 | private string ThumbnailStyle { get; set; } = "thumbnailShow";
37 | private string DeMarginStyle { get; set; } = "e-word-right-layout";
38 | private int Zoom { get; set; }
39 | private SfPdfViewer2 _viewer;
40 | private TopToolbar _topToolbar;
41 |
42 | protected override void OnInitialized()
43 | {
44 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("path", out var pathparam))
45 | {
46 | Path = pathparam.First();
47 | }
48 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("preview", out var param))
49 | {
50 | FileName = param.First();
51 | DocumentName = "File is loading...";
52 | PreviewPath = Path + FileName;
53 | }
54 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("subpath", out var subPathparam))
55 | {
56 | SubPath = subPathparam.First();
57 | DocumentPath = IO.Path.GetTempPath() + "tempZipStorage" + SubPath;
58 | }
59 | else
60 | {
61 | DocumentPath = "wwwroot/" + PreviewPath;
62 | }
63 | }
64 |
65 | protected override void OnAfterRender(bool firstRender)
66 | {
67 | if (SubPath != null)
68 | {
69 | _topToolbar.RootName = IO.Path.GetFileName(SubPath);
70 | }
71 | else
72 | {
73 | _topToolbar.RootName = IO.Path.GetFileName(PreviewPath);
74 | }
75 | }
76 |
77 | protected async void OnDocumentLoaded(LoadEventArgs args)
78 | {
79 | DocumentName = "";
80 | OverlayStyle = "overlayHide";
81 | StateHasChanged();
82 | }
83 |
84 | private async void BackClickHandler()
85 | {
86 | if (_viewer != null)
87 | {
88 | await _viewer.UnloadAsync();
89 | }
90 | if (SubPath != null)
91 | {
92 | string file = IO.Path.GetFileName(PreviewPath);
93 | Dictionary query = new Dictionary { { "preview", file }, { "path", PreviewPath.Replace((file), "") } };
94 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "zip-viewer/", query));
95 | }
96 | else
97 | {
98 | Dictionary query = new Dictionary { { "preview", FileName }, { "path", Path } };
99 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri, query));
100 | }
101 | }
102 |
103 | private async void Goto(int args)
104 | {
105 | await _viewer.GoToPageAsync(args);
106 | }
107 | private void OnPageChanged(PageChangeEventArgs args)
108 | {
109 | StateHasChanged();
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/server/Pages/WordViewer.razor:
--------------------------------------------------------------------------------
1 | @page "/word-viewer"
2 |
3 | @using Syncfusion.Blazor.DocumentEditor
4 |
5 |
6 |
7 |
8 |
9 |
@DocumentName
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | @code {
29 | private string OverlayStyle { get; set; } = "overlayShow";
30 | private string DocumentName { get; set; }
31 | private string PreviewPath { get; set; }
32 | private string FileName { get; set; }
33 | private string SubPath { get; set; }
34 | private string Path { get; set; }
35 | private string ThumbnailStyle { get; set; } = "thumbnailShow";
36 | private double ZoomFactor { get; set; } = 1;
37 | private SfDocumentEditorContainer _documenteditorcontainer;
38 | private TopToolbar _topToolbar;
39 | protected override async void OnInitialized()
40 | {
41 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("path", out var pathparam))
42 | {
43 | Path = pathparam.First();
44 | }
45 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("preview", out var param))
46 | {
47 | FileName = param.First();
48 | DocumentName = "File is loading...";
49 | PreviewPath = Path + FileName;
50 | }
51 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("subpath", out var subPathparam))
52 | {
53 | SubPath = subPathparam.First();
54 | }
55 | }
56 |
57 | #region TopToolBar Interaction
58 | private void BackClickHandler()
59 | {
60 | if (SubPath != null)
61 | {
62 | string file = IO.Path.GetFileName(PreviewPath);
63 | Dictionary query = new Dictionary { { "preview", file }, { "path", PreviewPath.Replace((file), "") } };
64 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "zip-viewer/", query));
65 | }
66 | else
67 | {
68 | Dictionary query = new Dictionary { { "preview", FileName }, { "path", Path } };
69 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri, query));
70 | }
71 | }
72 | #endregion
73 |
74 | #region DocumentEditor Event
75 | private async void AfterCreated()
76 | {
77 | await _documenteditorcontainer.ResizeAsync();
78 | HttpResponseMessage docresponse;
79 | if (SubPath != null)
80 | {
81 | _topToolbar.RootName = IO.Path.GetFileName(SubPath);
82 | string rooturl = NavigationManager.BaseUri + "api/ZipViewer/Root";
83 | string docpath = "";
84 | HttpResponseMessage rootresponse = await Http.GetAsync(rooturl);
85 | string root = await rootresponse.Content.ReadAsStringAsync();
86 | if (rootresponse.IsSuccessStatusCode)
87 | {
88 | docpath = (root + SubPath);
89 | }
90 | HttpRequestMessage docrequest = new HttpRequestMessage(HttpMethod.Post, NavigationManager.BaseUri + "api/DocumentEditor/OpenFromZip");
91 | docrequest.Content = new StringContent(JsonConvert.SerializeObject(new { Path = docpath }), Encoding.UTF8, "application/json");
92 | docresponse = await Http.SendAsync(docrequest);
93 | }
94 | else
95 | {
96 | _topToolbar.RootName = IO.Path.GetFileName(PreviewPath);
97 | HttpRequestMessage docrequest = new HttpRequestMessage(HttpMethod.Post, NavigationManager.BaseUri + "api/DocumentEditor/Import");
98 | docrequest.Content = new StringContent(JsonConvert.SerializeObject(new { Path = PreviewPath }), Encoding.UTF8, "application/json");
99 | docresponse = await Http.SendAsync(docrequest);
100 | }
101 | string output = await docresponse.Content.ReadAsStringAsync();
102 | await _documenteditorcontainer.DocumentEditor.OpenAsync(output);
103 | await _documenteditorcontainer.ResizeAsync();
104 | DocumentName = "";
105 | OverlayStyle = "overlayHide";
106 | StateHasChanged();
107 | }
108 | #endregion
109 | }
110 |
--------------------------------------------------------------------------------
/server/Pages/PresentationViewer.razor:
--------------------------------------------------------------------------------
1 | @page "/presentation-viewer"
2 |
3 | @using Syncfusion.Blazor.SfPdfViewer
4 |
5 |
6 |
7 |
8 |
9 |
@DocumentName
10 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 | @code {
28 | private string OverlayStyle { get; set; } = "overlayShow";
29 | private string DocumentName { get; set; }
30 | private string PreviewPath { get; set; }
31 | private string FileName { get; set; }
32 | private string SubPath { get; set; }
33 | private string Path { get; set; }
34 | private int Zoom { get; set; }
35 | private SfPdfViewer2 _viewer;
36 | private TopToolbar _topToolbar;
37 |
38 | protected override void OnInitialized()
39 | {
40 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("path", out var pathparam))
41 | {
42 | Path = pathparam.First();
43 | }
44 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("preview", out var param))
45 | {
46 | FileName = param.First();
47 | DocumentName = "File is loading...";
48 | PreviewPath = Path + FileName;
49 | }
50 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("subpath", out var subPathparam))
51 | {
52 | SubPath = subPathparam.First();
53 | }
54 | }
55 |
56 | protected override async void OnAfterRender(bool firstRender)
57 | {
58 | if (firstRender)
59 | {
60 | string targetPath = null;
61 | string rootName = null;
62 | if (SubPath != null)
63 | {
64 | rootName = IO.Path.GetFileName(SubPath);
65 | string rooturl = NavigationManager.BaseUri + "api/ZipViewer/Root";
66 | HttpResponseMessage rootresponse = await Http.GetAsync(rooturl);
67 | string root = await rootresponse.Content.ReadAsStringAsync();
68 | if (rootresponse.IsSuccessStatusCode)
69 | {
70 | targetPath = (root + SubPath);
71 | }
72 | }
73 | else
74 | {
75 | rootName = IO.Path.GetFileName(PreviewPath);
76 | }
77 | _topToolbar.RootName = rootName;
78 | HttpRequestMessage docrequest = new HttpRequestMessage(HttpMethod.Post, NavigationManager.BaseUri + "api/Presentation/ConvertToPDF");
79 | docrequest.Content = new StringContent(JsonConvert.SerializeObject(new { Path = PreviewPath, TargetPath = targetPath }), Encoding.UTF8, "application/json");
80 | HttpResponseMessage docresponse = await Http.SendAsync(docrequest);
81 | string output = await docresponse.Content.ReadAsStringAsync();
82 | if (docresponse.IsSuccessStatusCode)
83 | {
84 | Newtonsoft.Json.Linq.JArray jArray = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(output);
85 | string sfdt = ((JValue)jArray[0]).Value.ToString();
86 | await _viewer.LoadAsync(sfdt, null);
87 | }
88 | }
89 | }
90 |
91 | protected async void OnDocumentLoaded(LoadEventArgs args)
92 | {
93 | DocumentName = "";
94 | OverlayStyle = "overlayHide";
95 | StateHasChanged();
96 | }
97 |
98 | private async void BackClickHandler()
99 | {
100 | if (_viewer != null)
101 | {
102 | await _viewer.UnloadAsync();
103 | }
104 | if (SubPath != null)
105 | {
106 | string file = IO.Path.GetFileName(PreviewPath);
107 | Dictionary query = new Dictionary { { "preview", file }, { "path", PreviewPath.Replace((file), "") } };
108 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "zip-viewer/", query));
109 | }
110 | else
111 | {
112 | Dictionary query = new Dictionary { { "preview", FileName }, { "path", Path } };
113 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri, query));
114 | }
115 | }
116 |
117 | private async void Goto(int args)
118 | {
119 | await _viewer.GoToPageAsync(args);
120 | }
121 |
122 | private void OnPageChanged(PageChangeEventArgs args)
123 | {
124 | StateHasChanged();
125 | }
126 | }
--------------------------------------------------------------------------------
/server/Controllers/ZipViewerController.cs:
--------------------------------------------------------------------------------
1 | using DocumentExplorer.Shared;
2 | using Microsoft.AspNetCore.Mvc;
3 | using System;
4 | using System.Collections.Generic;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Http;
7 | using Microsoft.AspNetCore.Http.Features;
8 | //File Manager's base functions are available in the below namespace
9 | using DocumentExplorer.Models.FileManager;
10 | //File Manager's operations are available in the below namespace
11 | using DocumentExplorer.Data;
12 | using Newtonsoft.Json;
13 | using System.Linq;
14 | using System.Threading.Tasks;
15 | using System.IO;
16 | using System.IO.Compression;
17 |
18 | namespace DocumentExplorer.Controllers
19 | {
20 | [Route("api/[controller]")]
21 | [ApiController]
22 | public class ZipViewerController : ControllerBase
23 | {
24 | private PhysicalFileProvider operation;
25 | private string tempDir;
26 | private string basePath;
27 | private string baseLocation;
28 | private IWebHostEnvironment _hostingEnvironment;
29 |
30 |
31 | public ZipViewerController(IWebHostEnvironment hostingEnvironment)
32 | {
33 | _hostingEnvironment = hostingEnvironment;
34 | this.basePath = _hostingEnvironment.ContentRootPath;
35 | this.baseLocation = this.basePath + "\\wwwroot\\";
36 | // Temprorary location to store content of the zip file
37 | // this.tempDir = this.basePath + "\\" + "tempZipStorage";
38 | this.tempDir = Path.GetTempPath() + "tempZipStorage";
39 | if (!Directory.Exists(this.tempDir))
40 | Directory.CreateDirectory(this.tempDir);
41 | this.operation = new PhysicalFileProvider();
42 | //this.operation.RootFolder(this.basePath + "\\wwwroot\\Files"); // Data\\Files denotes in which files and folders are available.
43 | this.operation.RootFolder(this.tempDir);
44 | }
45 |
46 | [Route("Root")]
47 | public string Root()
48 | {
49 | return this.tempDir;
50 | }
51 |
52 | // Processing the File Manager operations
53 | [Route("FileOperations")]
54 | public object FileOperations([FromBody] ReadArgs args)
55 | {
56 | try
57 | {
58 | switch (args.Action)
59 | {
60 | // Add your custom action here
61 | case "read":
62 | // Path - Current path; ShowHiddenItems - Boolean value to show/hide hidden items
63 | return this.operation.ToCamelCase(this.operation.GetFiles(args.Path, args.ShowHiddenItems));
64 | case "search":
65 | case "details":
66 | case "delete":
67 | case "copy":
68 | case "move":
69 | case "create":
70 | case "rename":
71 | FileManagerResponse response = new FileManagerResponse();
72 | response.Error = new ErrorDetails() { Code = "401", Message = "Extract the Zip file to perform this action" };
73 | return this.operation.ToCamelCase(response);
74 | }
75 | return null;
76 | }
77 | catch (IOException e)
78 | {
79 | throw e;
80 | }
81 | }
82 | [Route("ExtractZip")]
83 | public IActionResult ExtractZip([FromBody] FileManagerDirectoryContent args)
84 | {
85 | DeleteDirectoryContent();
86 | string zipLocation = this.baseLocation + args.Path;
87 | ZipFile.ExtractToDirectory(zipLocation, this.tempDir);
88 | return Content("Extracted");
89 | }
90 |
91 | public string Extract(string ZipPath)
92 | {
93 | try
94 | {
95 | DeleteDirectoryContent();
96 | string zipLocation = this.baseLocation + ZipPath;
97 | if (System.IO.File.Exists(zipLocation))
98 | {
99 | ZipFile.ExtractToDirectory(zipLocation, this.tempDir);
100 | return "Extracted";
101 | }
102 | else
103 | {
104 | return "PathNotFound";
105 | }
106 | }
107 | catch (IOException e)
108 | {
109 | throw e;
110 | }
111 | }
112 |
113 | public void DeleteDirectoryContent()
114 | {
115 | string path = tempDir;
116 | try
117 | {
118 | string[] files = Directory.GetFiles(path);
119 | string[] dirs = Directory.GetDirectories(path);
120 | foreach (string file in files)
121 | {
122 | System.IO.File.SetAttributes(file, FileAttributes.Normal);
123 | System.IO.File.Delete(file);
124 | }
125 | foreach (string dir in dirs)
126 | {
127 | DeleteDirectory(dir);
128 | }
129 | }
130 | catch (IOException e)
131 | {
132 | throw e;
133 | }
134 | }
135 | public void DeleteDirectory(string path)
136 | {
137 |
138 | try
139 | {
140 | string[] files = Directory.GetFiles(path);
141 | string[] dirs = Directory.GetDirectories(path);
142 | foreach (string file in files)
143 | {
144 | System.IO.File.SetAttributes(file, FileAttributes.Normal);
145 | System.IO.File.Delete(file);
146 | }
147 | foreach (string dir in dirs)
148 | {
149 | DeleteDirectory(dir);
150 | }
151 | Directory.Delete(path, true);
152 | }
153 | catch (IOException e)
154 | {
155 | throw e;
156 | }
157 | }
158 | }
159 | public class ReadArgs : FileManagerDirectoryContent
160 | {
161 | public string ZipPath { get; set; }
162 | }
163 | }
--------------------------------------------------------------------------------
/server/Controllers/DocumentEditorController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Drawing;
4 | using System.Collections.Generic;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Mvc;
7 | //File Manager's base functions are available in the below namespace
8 | using DocumentExplorer.Models.FileManager;
9 | using Syncfusion.Blazor.DocumentEditor;
10 | using DocIO = Syncfusion.DocIO.DLS;
11 | using Syncfusion.DocIORenderer;
12 | using Syncfusion.Pdf;
13 | using Syncfusion.Blazor.SfPdfViewer;
14 | using DocumentExplorer.Models;
15 | using SkiaSharp;
16 | using System.Text.Json;
17 |
18 | namespace DocumentExplorer.Controllers
19 | {
20 | [Route("api/[controller]")]
21 | [ApiController]
22 | public class DocumentEditorController : ControllerBase
23 | {
24 | private string basePath;
25 | private string baseLocation;
26 | IWebHostEnvironment _hostingEnvironment;
27 | public DocumentEditorController(IWebHostEnvironment hostingEnvironment)
28 | {
29 | _hostingEnvironment = hostingEnvironment;
30 | this.basePath = _hostingEnvironment.ContentRootPath;
31 | this.baseLocation = this.basePath + "\\wwwroot\\";
32 | }
33 |
34 | [Route("Import")]
35 | public string Import([FromBody] FileManagerDirectoryContent args)
36 | {
37 | string fileLocation = this.baseLocation + args.Path.Replace("/", "\\");
38 | using (FileStream fs = new FileStream(fileLocation, FileMode.Open, FileAccess.Read))
39 | {
40 | WordDocument document = WordDocument.Load(fs, GetImportFormatType(Path.GetExtension(fileLocation).ToLower()));
41 | string json = JsonSerializer.Serialize(document);
42 | document.Dispose();
43 | return json;
44 | }
45 | }
46 | private List ConvertToImages(FileStream fs, List returnStrings, Syncfusion.DocIO.FormatType type)
47 | {
48 | //DocIO.WordDocument wd = new DocIO.WordDocument(fs, type);
49 | ////Instantiation of DocIORenderer for Word to PDF conversion
50 | //DocIORenderer render = new DocIORenderer();
51 | ////Converts Word document into PDF document
52 | //PdfDocument pdfDocument = render.ConvertToPDF(wd);
53 | ////Releases all resources used by the Word document and DocIO Renderer objects
54 | //render.Dispose();
55 | //wd.Dispose();
56 | ////Saves the PDF file
57 | //MemoryStream outputStream = new MemoryStream();
58 | //pdfDocument.Save(outputStream);
59 | //outputStream.Position = 0;
60 | ////Closes the instance of PDF document object
61 | //pdfDocument.Close();
62 |
63 | //SfPdfViewer2 pdfExportImage = new SfPdfViewer2();
64 | ////Loads the PDF document
65 | //pdfExportImage.LoadAsync(outputStream);
66 |
67 | ////Exports the PDF document pages into images
68 | //SKBitmap[] bitmapimage = pdfExportImage.ExportAsImage(0, pdfExportImage.PageCount - 1);
69 | //Bitmap[] bitmapImages = new Bitmap[bitmapimage.Length];
70 |
71 | //for (int i = 0; i < bitmapimage.Length; i++)
72 | //{
73 | // using (SKImage skImage = SKImage.FromBitmap(bitmapimage[i]))
74 | // using (SKData skData = skImage.Encode(SKEncodedImageFormat.Png, 100))
75 | // using (System.IO.MemoryStream stream = new System.IO.MemoryStream(skData.ToArray()))
76 | // {
77 | // bitmapImages[i] = new Bitmap(stream);
78 | // }
79 | //}
80 |
81 | //foreach (Bitmap bitmap in bitmapImages)
82 | //{
83 | // using (MemoryStream ms = new MemoryStream())
84 | // {
85 | // bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
86 | // returnStrings.Add("data:image/png;base64," + Convert.ToBase64String(ms.ToArray()));
87 | // }
88 | //}
89 | return returnStrings;
90 | }
91 | [Route("OpenFromZip")]
92 | public string[] OpenFromZip([FromBody] FileManagerDirectoryContent args)
93 | {
94 | List returnArray = new List();
95 | using (FileStream fs = new FileStream(args.Path, FileMode.Open, FileAccess.Read))
96 | {
97 | WordDocument document = WordDocument.Load(fs, GetImportFormatType(Path.GetExtension(args.Path).ToLower()));
98 | string json = Newtonsoft.Json.JsonConvert.SerializeObject(document);
99 | document.Dispose();
100 | returnArray.Add(json);
101 | return ConvertToImages(fs, returnArray, GetDocIOFormatType(Path.GetExtension(args.Path).ToLower())).ToArray();
102 | }
103 |
104 | }
105 |
106 | private ImportFormatType GetImportFormatType(string format)
107 | {
108 | if (string.IsNullOrEmpty(format))
109 | throw new NotSupportedException("DocumentEditor does not support this file format.");
110 | switch (format.ToLower())
111 | {
112 | case Constants.Dotx:
113 | case Constants.Docx:
114 | case Constants.Docm:
115 | case Constants.Dotm:
116 | return ImportFormatType.Docx;
117 | case Constants.Dot:
118 | case Constants.Doc:
119 | return ImportFormatType.Doc;
120 | case Constants.Rtf:
121 | return ImportFormatType.Rtf;
122 | case Constants.Txt:
123 | return ImportFormatType.Txt;
124 | case Constants.Xml:
125 | return ImportFormatType.WordML;
126 | case Constants.Html:
127 | return ImportFormatType.Html;
128 | default:
129 | throw new NotSupportedException("DocumentEditor does not support this file format.");
130 | }
131 | }
132 |
133 | private Syncfusion.DocIO.FormatType GetDocIOFormatType(string format)
134 | {
135 | if (string.IsNullOrEmpty(format))
136 | throw new NotSupportedException("DocumentEditor does not support this file format.");
137 | switch (format.ToLower())
138 | {
139 | case Constants.Dotx:
140 | case Constants.Docx:
141 | case Constants.Docm:
142 | case Constants.Dotm:
143 | return Syncfusion.DocIO.FormatType.Docx;
144 | case Constants.Dot:
145 | case Constants.Doc:
146 | return Syncfusion.DocIO.FormatType.Doc;
147 | case Constants.Rtf:
148 | return Syncfusion.DocIO.FormatType.Rtf;
149 | case Constants.Txt:
150 | return Syncfusion.DocIO.FormatType.Txt;
151 | case Constants.Xml:
152 | return Syncfusion.DocIO.FormatType.WordML;
153 | case Constants.Html:
154 | return Syncfusion.DocIO.FormatType.Html;
155 | default:
156 | throw new NotSupportedException("DocumentEditor does not support this file format.");
157 | }
158 | }
159 | }
160 | }
--------------------------------------------------------------------------------
/server/Pages/ZipViewer.razor:
--------------------------------------------------------------------------------
1 | @page "/zip-viewer"
2 |
3 | @using Syncfusion.Blazor.FileManager
4 | @using System.Text
5 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 | @*
23 |
24 |
25 |
26 |
27 | *@
28 |
29 |
30 |
31 |
32 | @code {
33 | public string ZipPath { get; set; } = null;
34 | public string ViewerPath { get; set; }
35 | public string RootName { get; set; }
36 | private string PreviewPath { get; set; }
37 | private string FileName { get; set; }
38 | private string SubPath { get; set; }
39 | private string Path { get; set; }
40 | public string OverlayStyle { get; set; } = "overlayHide";
41 | private SfFileManager _zipManager;
42 | private TopToolbar _topToolbar;
43 | private string SpinnerTarget { get; set; } = "#zipContainer";
44 | public bool isRootNameChange = true;
45 | protected override void OnInitialized()
46 | {
47 | ViewerPath = "/";
48 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("path", out var pathparam))
49 | {
50 | Path = pathparam.First();
51 | }
52 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("preview", out var param))
53 | {
54 | FileName = param.First();
55 | PreviewPath = Path + FileName;
56 | }
57 | if (QueryHelpers.ParseQuery(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).Query).TryGetValue("subpath", out var subPathparam))
58 | {
59 | SubPath = subPathparam.First();
60 | }
61 | }
62 | private async void AfterCreated()
63 | {
64 | ZipPath = PreviewPath;
65 | string Name = IO.Path.GetFileName(PreviewPath);
66 | if (_topToolbar.RootName != Name)
67 | {
68 | _topToolbar.RootName = RootName = Name;
69 | isRootNameChange = true;
70 | }
71 | string url = NavigationManager.BaseUri + "api/ZipViewer/ExtractZip";
72 | HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
73 | request.Content = new StringContent(JsonConvert.SerializeObject(new { Path = PreviewPath }), Encoding.UTF8, "application/json");
74 | HttpResponseMessage response = await Http.SendAsync(request);
75 | if (response.IsSuccessStatusCode)
76 | {
77 | await _zipManager.RefreshFilesAsync();
78 | }
79 | }
80 | private void BackClickHandler()
81 | {
82 | if (SubPath != null)
83 | {
84 | Dictionary query = new Dictionary { { "preview", PreviewPath } };
85 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "zip-viewer/", query));
86 | }
87 | else
88 | {
89 | Dictionary query = new Dictionary { { "preview", FileName }, { "path", Path } };
90 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri, query));
91 | }
92 | }
93 | private void BeforeSend(BeforeSendEventArgs args)
94 | {
95 | if (isRootNameChange) { args.Cancel = true; isRootNameChange = false; return; }
96 | OverlayStyle = "overlayHide";
97 | if (args.Action == "read")
98 | {
99 | string AjaxSettingsString = JsonConvert.SerializeObject(args.HttpClientInstance);
100 | Dictionary AjaxSettings = JsonConvert.DeserializeObject>(AjaxSettingsString);
101 | string dataString = AjaxSettings["data"];
102 | Dictionary data = JsonConvert.DeserializeObject>(dataString);
103 | data.Add("ZipPath", ZipPath);
104 | string modifiedDataString = JsonConvert.SerializeObject(data);
105 | AjaxSettings["data"] = modifiedDataString;
106 | string returnString = JsonConvert.SerializeObject(AjaxSettings);
107 | //args.AjaxSettings = JsonConvert.DeserializeObject(returnString);
108 | }
109 | }
110 | private void FileOpen(Syncfusion.Blazor.FileManager.FileOpenEventArgs args)
111 | {
112 | string dataString = JsonConvert.SerializeObject(args.FileDetails);
113 | Dictionary fileDetails = JsonConvert.DeserializeObject>(dataString);
114 | if ((fileDetails["type"] == Constants.Bmp) || (fileDetails["type"] == Constants.Dib) || (fileDetails["type"] == Constants.Jpg) || (fileDetails["type"] == Constants.Jpeg)
115 | || (fileDetails["type"] == Constants.Jpe) || (fileDetails["type"] == Constants.Jfif) || (fileDetails["type"] == Constants.Gif) || (fileDetails["type"] == Constants.Tif)
116 | || (fileDetails["type"] == Constants.Tiff) || (fileDetails["type"] == Constants.Png) || (fileDetails["type"] == Constants.Ico))
117 | {
118 | args.Cancel = true;
119 | }
120 | string filePath = (fileDetails["filterPath"] + fileDetails["name"]);
121 | Dictionary query = new Dictionary { { "preview", PreviewPath }, { "subpath", filePath } };
122 | if (fileDetails["type"] == Constants.Zip)
123 | {
124 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "zip-viewer/", query));
125 | }
126 | if (fileDetails["type"] == Constants.Pptx)
127 | {
128 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "presentation-viewer/", query));
129 | }
130 | if (fileDetails["type"] == Constants.Pdf)
131 | {
132 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "pdf-viewer/", query));
133 | }
134 | if (fileDetails["type"] == Constants.Docx || fileDetails["type"] == Constants.Doc || fileDetails["type"] == Constants.Rtf || fileDetails["type"] == Constants.Txt)
135 | {
136 | NavigationManager.NavigateTo(QueryHelpers.AddQueryString(NavigationManager.BaseUri + "word-viewer/", query));
137 | }
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/server/wwwroot/css/open-iconic/font/css/open-iconic-bootstrap.min.css:
--------------------------------------------------------------------------------
1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'}
--------------------------------------------------------------------------------
/server/wwwroot/SharedFiles/css/open-iconic/font/css/open-iconic-bootstrap.min.css:
--------------------------------------------------------------------------------
1 | @font-face{font-family:Icons;src:url(../fonts/open-iconic.eot);src:url(../fonts/open-iconic.eot?#iconic-sm) format('embedded-opentype'),url(../fonts/open-iconic.woff) format('woff'),url(../fonts/open-iconic.ttf) format('truetype'),url(../fonts/open-iconic.otf) format('opentype'),url(../fonts/open-iconic.svg#iconic-sm) format('svg');font-weight:400;font-style:normal}.oi{position:relative;top:1px;display:inline-block;speak:none;font-family:Icons;font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.oi:empty:before{width:1em;text-align:center;box-sizing:content-box}.oi.oi-align-center:before{text-align:center}.oi.oi-align-left:before{text-align:left}.oi.oi-align-right:before{text-align:right}.oi.oi-flip-horizontal:before{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.oi.oi-flip-vertical:before{-webkit-transform:scale(1,-1);-ms-transform:scale(-1,1);transform:scale(1,-1)}.oi.oi-flip-horizontal-vertical:before{-webkit-transform:scale(-1,-1);-ms-transform:scale(-1,1);transform:scale(-1,-1)}.oi-account-login:before{content:'\e000'}.oi-account-logout:before{content:'\e001'}.oi-action-redo:before{content:'\e002'}.oi-action-undo:before{content:'\e003'}.oi-align-center:before{content:'\e004'}.oi-align-left:before{content:'\e005'}.oi-align-right:before{content:'\e006'}.oi-aperture:before{content:'\e007'}.oi-arrow-bottom:before{content:'\e008'}.oi-arrow-circle-bottom:before{content:'\e009'}.oi-arrow-circle-left:before{content:'\e00a'}.oi-arrow-circle-right:before{content:'\e00b'}.oi-arrow-circle-top:before{content:'\e00c'}.oi-arrow-left:before{content:'\e00d'}.oi-arrow-right:before{content:'\e00e'}.oi-arrow-thick-bottom:before{content:'\e00f'}.oi-arrow-thick-left:before{content:'\e010'}.oi-arrow-thick-right:before{content:'\e011'}.oi-arrow-thick-top:before{content:'\e012'}.oi-arrow-top:before{content:'\e013'}.oi-audio-spectrum:before{content:'\e014'}.oi-audio:before{content:'\e015'}.oi-badge:before{content:'\e016'}.oi-ban:before{content:'\e017'}.oi-bar-chart:before{content:'\e018'}.oi-basket:before{content:'\e019'}.oi-battery-empty:before{content:'\e01a'}.oi-battery-full:before{content:'\e01b'}.oi-beaker:before{content:'\e01c'}.oi-bell:before{content:'\e01d'}.oi-bluetooth:before{content:'\e01e'}.oi-bold:before{content:'\e01f'}.oi-bolt:before{content:'\e020'}.oi-book:before{content:'\e021'}.oi-bookmark:before{content:'\e022'}.oi-box:before{content:'\e023'}.oi-briefcase:before{content:'\e024'}.oi-british-pound:before{content:'\e025'}.oi-browser:before{content:'\e026'}.oi-brush:before{content:'\e027'}.oi-bug:before{content:'\e028'}.oi-bullhorn:before{content:'\e029'}.oi-calculator:before{content:'\e02a'}.oi-calendar:before{content:'\e02b'}.oi-camera-slr:before{content:'\e02c'}.oi-caret-bottom:before{content:'\e02d'}.oi-caret-left:before{content:'\e02e'}.oi-caret-right:before{content:'\e02f'}.oi-caret-top:before{content:'\e030'}.oi-cart:before{content:'\e031'}.oi-chat:before{content:'\e032'}.oi-check:before{content:'\e033'}.oi-chevron-bottom:before{content:'\e034'}.oi-chevron-left:before{content:'\e035'}.oi-chevron-right:before{content:'\e036'}.oi-chevron-top:before{content:'\e037'}.oi-circle-check:before{content:'\e038'}.oi-circle-x:before{content:'\e039'}.oi-clipboard:before{content:'\e03a'}.oi-clock:before{content:'\e03b'}.oi-cloud-download:before{content:'\e03c'}.oi-cloud-upload:before{content:'\e03d'}.oi-cloud:before{content:'\e03e'}.oi-cloudy:before{content:'\e03f'}.oi-code:before{content:'\e040'}.oi-cog:before{content:'\e041'}.oi-collapse-down:before{content:'\e042'}.oi-collapse-left:before{content:'\e043'}.oi-collapse-right:before{content:'\e044'}.oi-collapse-up:before{content:'\e045'}.oi-command:before{content:'\e046'}.oi-comment-square:before{content:'\e047'}.oi-compass:before{content:'\e048'}.oi-contrast:before{content:'\e049'}.oi-copywriting:before{content:'\e04a'}.oi-credit-card:before{content:'\e04b'}.oi-crop:before{content:'\e04c'}.oi-dashboard:before{content:'\e04d'}.oi-data-transfer-download:before{content:'\e04e'}.oi-data-transfer-upload:before{content:'\e04f'}.oi-delete:before{content:'\e050'}.oi-dial:before{content:'\e051'}.oi-document:before{content:'\e052'}.oi-dollar:before{content:'\e053'}.oi-double-quote-sans-left:before{content:'\e054'}.oi-double-quote-sans-right:before{content:'\e055'}.oi-double-quote-serif-left:before{content:'\e056'}.oi-double-quote-serif-right:before{content:'\e057'}.oi-droplet:before{content:'\e058'}.oi-eject:before{content:'\e059'}.oi-elevator:before{content:'\e05a'}.oi-ellipses:before{content:'\e05b'}.oi-envelope-closed:before{content:'\e05c'}.oi-envelope-open:before{content:'\e05d'}.oi-euro:before{content:'\e05e'}.oi-excerpt:before{content:'\e05f'}.oi-expand-down:before{content:'\e060'}.oi-expand-left:before{content:'\e061'}.oi-expand-right:before{content:'\e062'}.oi-expand-up:before{content:'\e063'}.oi-external-link:before{content:'\e064'}.oi-eye:before{content:'\e065'}.oi-eyedropper:before{content:'\e066'}.oi-file:before{content:'\e067'}.oi-fire:before{content:'\e068'}.oi-flag:before{content:'\e069'}.oi-flash:before{content:'\e06a'}.oi-folder:before{content:'\e06b'}.oi-fork:before{content:'\e06c'}.oi-fullscreen-enter:before{content:'\e06d'}.oi-fullscreen-exit:before{content:'\e06e'}.oi-globe:before{content:'\e06f'}.oi-graph:before{content:'\e070'}.oi-grid-four-up:before{content:'\e071'}.oi-grid-three-up:before{content:'\e072'}.oi-grid-two-up:before{content:'\e073'}.oi-hard-drive:before{content:'\e074'}.oi-header:before{content:'\e075'}.oi-headphones:before{content:'\e076'}.oi-heart:before{content:'\e077'}.oi-home:before{content:'\e078'}.oi-image:before{content:'\e079'}.oi-inbox:before{content:'\e07a'}.oi-infinity:before{content:'\e07b'}.oi-info:before{content:'\e07c'}.oi-italic:before{content:'\e07d'}.oi-justify-center:before{content:'\e07e'}.oi-justify-left:before{content:'\e07f'}.oi-justify-right:before{content:'\e080'}.oi-key:before{content:'\e081'}.oi-laptop:before{content:'\e082'}.oi-layers:before{content:'\e083'}.oi-lightbulb:before{content:'\e084'}.oi-link-broken:before{content:'\e085'}.oi-link-intact:before{content:'\e086'}.oi-list-rich:before{content:'\e087'}.oi-list:before{content:'\e088'}.oi-location:before{content:'\e089'}.oi-lock-locked:before{content:'\e08a'}.oi-lock-unlocked:before{content:'\e08b'}.oi-loop-circular:before{content:'\e08c'}.oi-loop-square:before{content:'\e08d'}.oi-loop:before{content:'\e08e'}.oi-magnifying-glass:before{content:'\e08f'}.oi-map-marker:before{content:'\e090'}.oi-map:before{content:'\e091'}.oi-media-pause:before{content:'\e092'}.oi-media-play:before{content:'\e093'}.oi-media-record:before{content:'\e094'}.oi-media-skip-backward:before{content:'\e095'}.oi-media-skip-forward:before{content:'\e096'}.oi-media-step-backward:before{content:'\e097'}.oi-media-step-forward:before{content:'\e098'}.oi-media-stop:before{content:'\e099'}.oi-medical-cross:before{content:'\e09a'}.oi-menu:before{content:'\e09b'}.oi-microphone:before{content:'\e09c'}.oi-minus:before{content:'\e09d'}.oi-monitor:before{content:'\e09e'}.oi-moon:before{content:'\e09f'}.oi-move:before{content:'\e0a0'}.oi-musical-note:before{content:'\e0a1'}.oi-paperclip:before{content:'\e0a2'}.oi-pencil:before{content:'\e0a3'}.oi-people:before{content:'\e0a4'}.oi-person:before{content:'\e0a5'}.oi-phone:before{content:'\e0a6'}.oi-pie-chart:before{content:'\e0a7'}.oi-pin:before{content:'\e0a8'}.oi-play-circle:before{content:'\e0a9'}.oi-plus:before{content:'\e0aa'}.oi-power-standby:before{content:'\e0ab'}.oi-print:before{content:'\e0ac'}.oi-project:before{content:'\e0ad'}.oi-pulse:before{content:'\e0ae'}.oi-puzzle-piece:before{content:'\e0af'}.oi-question-mark:before{content:'\e0b0'}.oi-rain:before{content:'\e0b1'}.oi-random:before{content:'\e0b2'}.oi-reload:before{content:'\e0b3'}.oi-resize-both:before{content:'\e0b4'}.oi-resize-height:before{content:'\e0b5'}.oi-resize-width:before{content:'\e0b6'}.oi-rss-alt:before{content:'\e0b7'}.oi-rss:before{content:'\e0b8'}.oi-script:before{content:'\e0b9'}.oi-share-boxed:before{content:'\e0ba'}.oi-share:before{content:'\e0bb'}.oi-shield:before{content:'\e0bc'}.oi-signal:before{content:'\e0bd'}.oi-signpost:before{content:'\e0be'}.oi-sort-ascending:before{content:'\e0bf'}.oi-sort-descending:before{content:'\e0c0'}.oi-spreadsheet:before{content:'\e0c1'}.oi-star:before{content:'\e0c2'}.oi-sun:before{content:'\e0c3'}.oi-tablet:before{content:'\e0c4'}.oi-tag:before{content:'\e0c5'}.oi-tags:before{content:'\e0c6'}.oi-target:before{content:'\e0c7'}.oi-task:before{content:'\e0c8'}.oi-terminal:before{content:'\e0c9'}.oi-text:before{content:'\e0ca'}.oi-thumb-down:before{content:'\e0cb'}.oi-thumb-up:before{content:'\e0cc'}.oi-timer:before{content:'\e0cd'}.oi-transfer:before{content:'\e0ce'}.oi-trash:before{content:'\e0cf'}.oi-underline:before{content:'\e0d0'}.oi-vertical-align-bottom:before{content:'\e0d1'}.oi-vertical-align-center:before{content:'\e0d2'}.oi-vertical-align-top:before{content:'\e0d3'}.oi-video:before{content:'\e0d4'}.oi-volume-high:before{content:'\e0d5'}.oi-volume-low:before{content:'\e0d6'}.oi-volume-off:before{content:'\e0d7'}.oi-warning:before{content:'\e0d8'}.oi-wifi:before{content:'\e0d9'}.oi-wrench:before{content:'\e0da'}.oi-x:before{content:'\e0db'}.oi-yen:before{content:'\e0dc'}.oi-zoom-in:before{content:'\e0dd'}.oi-zoom-out:before{content:'\e0de'}
--------------------------------------------------------------------------------
/server/Controllers/PreviewController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Drawing;
4 | using System.Collections.Generic;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Mvc;
7 | //File Manager's base functions are available in the below namespace
8 | using DocumentExplorer.Models.FileManager;
9 | //File Manager's operations are available in the below namespace
10 | using DocumentExplorer.Data;
11 | using DocIO = Syncfusion.DocIO.DLS;
12 | using Syncfusion.DocIORenderer;
13 | using Syncfusion.Pdf;
14 | using Syncfusion.Blazor.SfPdfViewer;
15 | using Syncfusion.Presentation;
16 | using Syncfusion.PresentationRenderer;
17 | using DocumentExplorer.Models;
18 | using SkiaSharp;
19 | using Microsoft.AspNetCore.Http;
20 |
21 | namespace DocumentExplorer.Controllers
22 | {
23 | [Route("api/[controller]")]
24 | [ApiController]
25 | public class PreviewController : ControllerBase
26 | {
27 | private PhysicalFileProvider operation;
28 | private string basePath;
29 | public PreviewController(IWebHostEnvironment hostingEnvironment)
30 | {
31 | basePath = hostingEnvironment.ContentRootPath;
32 | operation = new PhysicalFileProvider();
33 | operation.RootFolder(this.basePath + "\\wwwroot\\VirtualConnections\\"); // Data\\Files denotes in which files and folders are available.
34 | }
35 |
36 | [Route("GetPreview")]
37 | public string GetPreview([FromBody] FileManagerDirectoryContent args)
38 | {
39 | string connectionId = HttpContext.Session.GetString("ConnectionId");
40 |
41 | if (string.IsNullOrEmpty(connectionId))
42 | {
43 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
44 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
45 | }
46 | string baseFolder = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId + "\\Files";
47 | this.operation.RootFolder(baseFolder);
48 | try
49 | {
50 | String fullPath = baseFolder + args.Path;
51 | string extension = Path.GetExtension(fullPath);
52 | Stream imageStream = null;
53 | if (extension == Constants.Pdf)
54 | {
55 | try
56 | {
57 | // FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
58 | // SfPdfViewer2 pdfExportImage = new SfPdfViewer2();
59 | // //Loads the PDF document
60 | // pdfExportImage.LoadAsync(fileStream);
61 | // //Exports the PDF document pages into images
62 | // SkiaSharp.SKBitmap[] skBitmaps = pdfExportImage.ExportAsImage(0, 0);
63 | //System.Drawing.Bitmap[] bitmapImages = new System.Drawing.Bitmap[skBitmaps.Length];
64 |
65 | //for (int i = 0; i < skBitmaps.Length; i++)
66 | //{
67 | // using (SKImage skImage = SKImage.FromBitmap(skBitmaps[i]))
68 | // using (SKData skData = skImage.Encode(SKEncodedImageFormat.Png, 100))
69 | // using (System.IO.MemoryStream stream = new System.IO.MemoryStream(skData.ToArray()))
70 | // {
71 | // bitmapImages[i] = new System.Drawing.Bitmap(stream);
72 | // }
73 | //}
74 | //imageStream = new MemoryStream();
75 | //bitmapImages[0].Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
76 | // imageStream.Position = 0;
77 | // pdfExportImage.Dispose();
78 | // fileStream.Close();
79 | }
80 | catch
81 | {
82 | imageStream = null;
83 | }
84 | }
85 | else if (extension == Constants.Docx || extension == Constants.Rtf || extension == Constants.Doc || extension == Constants.Txt)
86 | {
87 | try
88 | {
89 | //FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
90 | ////Loads file stream into Word document
91 | //DocIO.WordDocument document = new DocIO.WordDocument(fileStream, GetDocIOFormatType(extension));
92 | //fileStream.Dispose();
93 | ////Instantiation of DocIORenderer for Word to PDF conversion
94 | //DocIORenderer render = new DocIORenderer();
95 | ////Converts Word document into PDF document
96 | //PdfDocument pdfDocument = render.ConvertToPDF(document);
97 | ////Releases all resources used by the Word document and DocIO Renderer objects
98 | //render.Dispose();
99 | //document.Dispose();
100 | ////Saves the PDF file
101 | //MemoryStream outputStream = new MemoryStream();
102 | //pdfDocument.Save(outputStream);
103 | //outputStream.Position = 0;
104 | ////Closes the instance of PDF document object
105 | //pdfDocument.Close();
106 |
107 | //SfPdfViewer2 pdfExportImage = new SfPdfViewer2();
108 | ////Loads the PDF document
109 | //pdfExportImage.LoadAsync(outputStream);
110 | ////Exports the PDF document pages into images
111 | //SKBitmap[] bitmapimage = pdfExportImage.ExportAsImage(0, 0);
112 | //Bitmap[] bitmapImages = new Bitmap[bitmapimage.Length];
113 |
114 | //for (int i = 0; i < bitmapimage.Length; i++)
115 | //{
116 | // using (SKImage skImage = SKImage.FromBitmap(bitmapimage[i]))
117 | // using (SKData skData = skImage.Encode(SKEncodedImageFormat.Png, 100))
118 | // using (System.IO.MemoryStream stream = new System.IO.MemoryStream(skData.ToArray()))
119 | // {
120 | // bitmapImages[i] = new Bitmap(stream);
121 | // }
122 | //}
123 |
124 | //imageStream = new MemoryStream();
125 | //bitmapImages[0].Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
126 | //imageStream.Position = 0;
127 |
128 | //fileStream.Close();
129 | }
130 | catch
131 | {
132 | imageStream = null;
133 | }
134 | }
135 | else if (extension == Constants.Pptx)
136 | {
137 | try
138 | {
139 | IPresentation presentation = Presentation.Open(fullPath);
140 | //Initialize PresentationRenderer for image conversion
141 | presentation.PresentationRenderer = new PresentationRenderer();
142 | //Convert the first slide to image
143 | imageStream = presentation.Slides[0].ConvertToImage(ExportImageFormat.Png);
144 | presentation.Dispose();
145 | }
146 | catch
147 | {
148 | imageStream = null;
149 | }
150 | }
151 | if (imageStream != null)
152 | {
153 | byte[] bytes = new byte[imageStream.Length];
154 | imageStream.Read(bytes);
155 | string base64 = Convert.ToBase64String(bytes);
156 | return "data:image/png;base64, " + base64;
157 | }
158 | else
159 | {
160 | return "Error";
161 | }
162 | }
163 | catch
164 | {
165 | return "Error";
166 | }
167 | }
168 |
169 | private Syncfusion.DocIO.FormatType GetDocIOFormatType(string format)
170 | {
171 | if (string.IsNullOrEmpty(format))
172 | throw new NotSupportedException("DocumentEditor does not support this file format.");
173 | switch (format.ToLower())
174 | {
175 | case Constants.Dotx:
176 | case Constants.Docx:
177 | case Constants.Docm:
178 | case Constants.Dotm:
179 | return Syncfusion.DocIO.FormatType.Docx;
180 | case Constants.Dot:
181 | case Constants.Doc:
182 | return Syncfusion.DocIO.FormatType.Doc;
183 | case Constants.Rtf:
184 | return Syncfusion.DocIO.FormatType.Rtf;
185 | case Constants.Txt:
186 | return Syncfusion.DocIO.FormatType.Txt;
187 | case Constants.Xml:
188 | return Syncfusion.DocIO.FormatType.WordML;
189 | case Constants.Html:
190 | return Syncfusion.DocIO.FormatType.Html;
191 | default:
192 | throw new NotSupportedException("DocumentEditor does not support this file format.");
193 | }
194 | }
195 | }
196 | }
197 |
--------------------------------------------------------------------------------
/server/Controllers/SharedFilesController.cs:
--------------------------------------------------------------------------------
1 | using DocumentExplorer.Shared;
2 | using Microsoft.AspNetCore.Mvc;
3 | using System;
4 | using System.Collections.Generic;
5 | using Microsoft.AspNetCore.Hosting;
6 | using Microsoft.AspNetCore.Http;
7 | using Microsoft.AspNetCore.Http.Features;
8 | //File Manager's base functions are available in the below namespace
9 | using DocumentExplorer.Models.FileManager;
10 | //File Manager's operations are available in the below namespace
11 | using DocumentExplorer.Data;
12 | using Newtonsoft.Json;
13 | using System.Linq;
14 | using System.Threading.Tasks;
15 | using System.IO;
16 | using Syncfusion.DocIO.DLS;
17 | using Syncfusion.DocIORenderer;
18 | using Syncfusion.Blazor.SfPdfViewer;
19 | using Syncfusion.Pdf;
20 | using Syncfusion.Presentation;
21 | using Syncfusion.PresentationRenderer;
22 | using System.Drawing;
23 | using Microsoft.AspNetCore.Cors;
24 | using DocumentExplorer.Models;
25 | using SkiaSharp;
26 |
27 | namespace DocumentExplorer.Controllers
28 | {
29 | [Route("api/[controller]")]
30 | [EnableCors("AllowAllOrigins")]
31 | public class SharedFilesController : ControllerBase
32 | {
33 | private PhysicalFileProvider operation;
34 | private string basePath;
35 | public SharedFilesController(IWebHostEnvironment hostingEnvironment)
36 | {
37 | this.basePath = hostingEnvironment.ContentRootPath;
38 | this.operation = new PhysicalFileProvider();
39 | this.operation.RootFolder(this.basePath + "\\wwwroot\\SharedFiles"); // Data\\Files denotes in which files and folders are available.
40 | }
41 |
42 | // Processing the File Manager operations
43 | [Route("FileOperations")]
44 | public object FileOperations([FromBody] FileManagerFilterContent args)
45 | {
46 | if (args.Path == "/Files/")
47 | {
48 | args.Path = "/";
49 | }
50 | switch (args.Action)
51 | {
52 | // Add your custom action here
53 | case "read":
54 | // Path - Current path; ShowHiddenItems - Boolean value to show/hide hidden items
55 | return this.operation.ToCamelCase(this.operation.GetFiles(args.Path, args.ShowHiddenItems));
56 | case "details":
57 | // Path - Current path where details of file/folder is requested; Name - Names of the requested folders
58 | return this.operation.ToCamelCase(this.operation.Details(args.Path, args.Names));
59 | case "create":
60 | FileManagerResponse createresponse = new FileManagerResponse();
61 | createresponse.Error = new ErrorDetails() { Code = "401", Message = "Restricted to perform this action" };
62 | return this.operation.ToCamelCase(createresponse);
63 | case "search":
64 | // 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
65 | return this.operation.ToCamelCase(this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive));
66 | case "delete":
67 | case "copy":
68 | case "move":
69 | case "rename":
70 | FileManagerResponse renameresponse = new FileManagerResponse();
71 | renameresponse.Error = new ErrorDetails() { Code = "401", Message = "Restricted to perform this action" };
72 | return this.operation.ToCamelCase(renameresponse);
73 | }
74 | return null;
75 | }
76 |
77 | [Route("Download")]
78 | public IActionResult Download(string downloadInput)
79 | {
80 |
81 | FileManagerFilterContent args = JsonConvert.DeserializeObject(downloadInput);
82 | FileManagerDirectoryContent[] items = args.Data;
83 | string[] names = args.Names;
84 | for (var i = 0; i < items.Length; i++)
85 | {
86 | names[i] = ((items[i].FilterPath + items[i].Name).Substring(1));
87 | }
88 | return operation.Download("/", names);
89 | }
90 |
91 |
92 | [Route("GetImage")]
93 | public IActionResult GetImage(FileManagerFilterContent args)
94 | {
95 | return this.operation.GetImage(args.Path, args.Id, false, null, null);
96 | }
97 | [Route("GetPreviewImage")]
98 | public IActionResult GetPreviewImage(FileManagerFilterContent args)
99 | {
100 | string baseFolder = this.basePath + "\\wwwroot\\SharedFiles";
101 |
102 | try
103 | {
104 | String fullPath = baseFolder + args.Path;
105 | string extension = Path.GetExtension(fullPath);
106 | Stream imageStream = null;
107 |
108 | if (extension == Constants.Pdf)
109 | {
110 | //FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
111 | //SfPdfViewer2 pdfExportImage = new SfPdfViewer2();
112 |
113 | //// Load the PDF document
114 | //pdfExportImage.LoadAsync(fileStream);
115 |
116 | //// Export the PDF document pages as SkiaSharp bitmaps
117 | //SkiaSharp.SKBitmap[] skBitmaps = pdfExportImage.ExportAsImage(0, 0);
118 |
119 | //if (skBitmaps.Length > 0)
120 | //{
121 | // // Encode the first page as PNG using SkiaSharp
122 | // using (SKImage skImage = SKImage.FromBitmap(skBitmaps[0]))
123 | // using (SKData skData = skImage.Encode(SKEncodedImageFormat.Png, 100))
124 | // {
125 | // imageStream = new MemoryStream(skData.ToArray());
126 | // imageStream.Position = 0;
127 | // }
128 | //}
129 |
130 | //// Clean up resources
131 | //pdfExportImage.Dispose();
132 | //fileStream.Close();
133 | }
134 | else if (extension == Constants.Docx || extension == Constants.Rtf || extension == Constants.Doc)
135 | {
136 | //FileStream fileStream = new FileStream(fullPath, FileMode.Open, FileAccess.Read);
137 | ////Loads file stream into Word document
138 | //WordDocument document = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Automatic);
139 | //fileStream.Dispose();
140 | ////Instantiation of DocIORenderer for Word to PDF conversion
141 | //DocIORenderer render = new DocIORenderer();
142 | ////Converts Word document into PDF document
143 | //PdfDocument pdfDocument = render.ConvertToPDF(document);
144 | ////Releases all resources used by the Word document and DocIO Renderer objects
145 | //render.Dispose();
146 | //document.Dispose();
147 | ////Saves the PDF file
148 | //MemoryStream outputStream = new MemoryStream();
149 | //pdfDocument.Save(outputStream);
150 | //outputStream.Position = 0;
151 | ////Closes the instance of PDF document object
152 | //pdfDocument.Close();
153 |
154 | //SfPdfViewer2 pdfExportImage = new SfPdfViewer2();
155 | ////Loads the PDF document
156 | //pdfExportImage.LoadAsync(outputStream);
157 | ////Exports the PDF document pages into images
158 | //SkiaSharp.SKBitmap[] skBitmaps = pdfExportImage.ExportAsImage(0, 0);
159 | //System.Drawing.Bitmap[] bitmapImages = new System.Drawing.Bitmap[skBitmaps.Length];
160 |
161 | //for (int i = 0; i < skBitmaps.Length; i++)
162 | //{
163 | // using (SKImage skImage = SKImage.FromBitmap(skBitmaps[i]))
164 | // using (SKData skData = skImage.Encode(SKEncodedImageFormat.Png, 100))
165 | // using (System.IO.MemoryStream stream = new System.IO.MemoryStream(skData.ToArray()))
166 | // {
167 | // bitmapImages[i] = new System.Drawing.Bitmap(stream);
168 | // }
169 | //}
170 | //imageStream = new MemoryStream();
171 | //bitmapImages[0].Save(imageStream, System.Drawing.Imaging.ImageFormat.Png);
172 | //imageStream.Position = 0;
173 |
174 | //fileStream.Close();
175 | }
176 | else if (extension == Constants.Pptx)
177 | {
178 | IPresentation presentation = Presentation.Open(fullPath);
179 | //Initialize PresentationRenderer for image conversion
180 | presentation.PresentationRenderer = new PresentationRenderer();
181 | //Convert the first slide to image
182 | imageStream = presentation.Slides[0].ConvertToImage(ExportImageFormat.Png);
183 | presentation.Dispose();
184 | }
185 | FileStreamResult fileStreamResult = new FileStreamResult(imageStream, "APPLICATION/octet-stream");
186 | return fileStreamResult;
187 | }
188 | catch
189 | {
190 | return null;
191 | }
192 | }
193 |
194 |
195 | public class FileManagerFilterContent : FileManagerDirectoryContent
196 | {
197 | public string RootType { get; set; }
198 | }
199 |
200 | }
201 | }
--------------------------------------------------------------------------------
/server/Controllers/TrashController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 | using Microsoft.AspNetCore.Hosting;
7 | using Microsoft.AspNetCore.Http;
8 | using Microsoft.AspNetCore.Mvc;
9 | using Newtonsoft.Json;
10 | using DocumentExplorer.Models.FileManager;
11 | using DocumentExplorer.Data;
12 | using System.Text.RegularExpressions;
13 | using Microsoft.AspNetCore.Cors;
14 |
15 | namespace DocumentExplorer.Controllers
16 | {
17 | [Route("api/[controller]")]
18 | [EnableCors("AllowAllOrigins")]
19 | public class TrashController : ControllerBase
20 | {
21 | private PhysicalFileProvider operation;
22 | private string basePath;
23 | private string baseLocation;
24 |
25 | public TrashController(IWebHostEnvironment hostingEnvironment)
26 | {
27 | this.basePath = hostingEnvironment.ContentRootPath;
28 | this.baseLocation = this.basePath + "\\wwwroot\\VirtualConnections\\";
29 | this.operation = new PhysicalFileProvider();
30 | }
31 |
32 | // Processing the File Manager operations
33 | [Route("FileOperations")]
34 | public object FileOperations([FromBody] ReadArgs args)
35 | {
36 | if (args.Path == "/Files/")
37 | {
38 | args.Path = "/";
39 | }
40 | try
41 | {
42 | switch (args.Action)
43 | {
44 | // Add your custom action here
45 | case "read":
46 | // Path - Current path; ShowHiddenItems - Boolean value to show/hide hidden items
47 | return this.operation.ToCamelCase(this.GetFiles());
48 | case "search":
49 | // 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
50 | //return this.operation.ToCamelCase(this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive));
51 | return this.operation.ToCamelCase(this.SearchFiles(args.SearchString,args.CaseSensitive));
52 | case "details":
53 | // Path - Current path where details of file/folder is requested; Name - Names of the requested folders
54 | return this.operation.ToCamelCase(this.GetDetails(args.Data));
55 | case "delete":
56 | // Path - Current path where of the folder to be deleted; Names - Name of the files to be deleted
57 | return this.operation.ToCamelCase(this.DeleteFiles(args.Data));
58 | case "rename":
59 | case "create":
60 | case "move":
61 | case "copy":
62 | // Path - Current path of the renamed file; Name - Old file name; NewName - New file name
63 | // return this.operation.ToCamelCase(this.operation.Rename(args.Path, args.Name, args.NewName));
64 | FileManagerResponse response = new FileManagerResponse();
65 | response.Error = new ErrorDetails() { Code = "401", Message = "Restore file to perform this action" };
66 | return this.operation.ToCamelCase(response);
67 | }
68 | return null;
69 | }
70 | catch (IOException e)
71 | {
72 | throw e;
73 | }
74 | }
75 |
76 | public FileManagerResponse GetFiles()
77 | {
78 | string connectionId = HttpContext.Session.GetString("ConnectionId");
79 |
80 | if (string.IsNullOrEmpty(connectionId))
81 | {
82 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
83 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
84 | }
85 | FileManagerResponse readResponse = new FileManagerResponse();
86 | FileManagerDirectoryContent cwd = new FileManagerDirectoryContent();
87 | String fullPath = (this.baseLocation + connectionId + "/Trash");
88 | DirectoryInfo directory = new DirectoryInfo(fullPath);
89 | cwd.Name = "Trash";
90 | cwd.Size = 0;
91 | cwd.IsFile = false;
92 | cwd.DateModified = directory.LastWriteTime;
93 | cwd.DateCreated = directory.CreationTime;
94 | cwd.HasChild = false;
95 | cwd.Type = directory.Extension;
96 | cwd.FilterPath = "/";
97 | cwd.Permission = null;
98 | readResponse.CWD = cwd;
99 | string jsonPath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId +"\\User\\trash.json";
100 | string jsonData = System.IO.File.ReadAllText(jsonPath);
101 | List DeletedFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
102 | List files = new List();
103 | foreach (TrashContents file in DeletedFiles)
104 | {
105 | files.Add(file.Data);
106 | }
107 | readResponse.Files = files;
108 | return readResponse;
109 | }
110 | public FileManagerResponse GetDetails(FileManagerDirectoryContent[] files)
111 | {
112 | string connectionId = HttpContext.Session.GetString("ConnectionId");
113 |
114 | if (string.IsNullOrEmpty(connectionId))
115 | {
116 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
117 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
118 | }
119 | this.operation.RootFolder(this.baseLocation + connectionId + "\\Trash");
120 | FileManagerResponse response;
121 | string[] names = new string[files.Length];
122 | string responseName = "";
123 | int index = 0;
124 | foreach (FileManagerDirectoryContent file in files)
125 | {
126 | names[index] = file.Id;
127 | index++;
128 | responseName = (responseName == "") ? file.Name : (responseName + ", " + file.Name);
129 | }
130 | response = this.operation.Details("/", names);
131 | response.Details.Name = responseName;
132 | response.Details.Location = "Trash";
133 | return response;
134 | }
135 | public FileManagerResponse DeleteFiles(FileManagerDirectoryContent[] files)
136 | {
137 | string connectionId = HttpContext.Session.GetString("ConnectionId");
138 |
139 | if (string.IsNullOrEmpty(connectionId))
140 | {
141 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
142 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
143 | }
144 | this.operation.RootFolder(this.baseLocation + connectionId);
145 | string jsonPath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId + "\\User\\trash.json";
146 | string jsonData = System.IO.File.ReadAllText(jsonPath);
147 | List responseFiles =new List();
148 | List DeletedFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
149 | foreach (FileManagerDirectoryContent file in files)
150 | {
151 | TrashContents trashFile = DeletedFiles.Find(x => (x.Container.Equals(file.Id)));
152 | string trashPath = "/Trash/" + trashFile.Container;
153 | DeleteDirectory(this.baseLocation + connectionId + trashPath);
154 | responseFiles.Add(trashFile.Data);
155 | DeletedFiles.Remove(trashFile);
156 | }
157 | jsonData = JsonConvert.SerializeObject(DeletedFiles);
158 | System.IO.File.WriteAllText(jsonPath, jsonData);
159 | return new FileManagerResponse() { Files = responseFiles };
160 | }
161 | [Route("EmptyTrash")]
162 | public IActionResult EmptyTrash()
163 | {
164 | string connectionId = HttpContext.Session.GetString("ConnectionId");
165 |
166 | if (string.IsNullOrEmpty(connectionId))
167 | {
168 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
169 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
170 | }
171 | string jsonPath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId + "\\User\\trash.json";
172 | string jsonData ="";
173 | string[] dirs = Directory.GetDirectories(this.baseLocation + connectionId);
174 | foreach (string dir in dirs)
175 | {
176 | DeleteDirectory(dir);
177 | }
178 | System.IO.File.WriteAllText(jsonPath, jsonData);
179 | return Content("");
180 | }
181 |
182 | [Route("Restore")]
183 | public IActionResult Restore([FromBody] FileManagerDirectoryContent[] files)
184 | {
185 | string connectionId = HttpContext.Session.GetString("ConnectionId");
186 |
187 | if (string.IsNullOrEmpty(connectionId))
188 | {
189 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
190 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
191 | }
192 | this.operation.RootFolder(this.baseLocation + connectionId);
193 | string jsonPath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId + "\\User\\trash.json";
194 | string jsonData = System.IO.File.ReadAllText(jsonPath);
195 | string responseString = "";
196 | List DeletedFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
197 | foreach (FileManagerDirectoryContent file in files)
198 | {
199 | TrashContents trashFile = DeletedFiles.Find(x => (x.Container.Equals(file.Id)));
200 | string fileLocation = "/Files" + trashFile.Path;
201 | string trashPath = "/Trash/" + trashFile.Container;
202 | FileManagerResponse response = this.operation.Move(trashPath, fileLocation, new string[] { trashFile.Name }, new string[] { trashFile.Name }, null, null);
203 | if ((response.Error == null))
204 | {
205 | DeleteDirectory(this.baseLocation + connectionId + trashPath);
206 | DeletedFiles.Remove(trashFile);
207 | responseString = "Restored";
208 | }
209 | else
210 | {
211 | responseString = "Restore Failed";
212 | }
213 | }
214 | jsonData = JsonConvert.SerializeObject(DeletedFiles);
215 | System.IO.File.WriteAllText(jsonPath, jsonData);
216 | return Content(responseString);
217 | }
218 |
219 | public FileManagerResponse SearchFiles(string value, bool caseSensitive)
220 | {
221 | string connectionId = HttpContext.Session.GetString("ConnectionId");
222 |
223 | if (string.IsNullOrEmpty(connectionId))
224 | {
225 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
226 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
227 | }
228 | this.operation.RootFolder(this.baseLocation + connectionId);
229 | string jsonPath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId + "\\User\\trash.json";
230 | string jsonData = System.IO.File.ReadAllText(jsonPath);
231 | List DeletedFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
232 | List searchFiles = DeletedFiles.FindAll(x => new Regex(WildcardToRegex(value), (caseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase)).IsMatch(x.Name));
233 | List data = new List();
234 | foreach(TrashContents file in searchFiles) {
235 | data.Add(file.Data);
236 | }
237 | return new FileManagerResponse() { Files=data} ;
238 | }
239 | public virtual string WildcardToRegex(string value)
240 | {
241 | return "^" + Regex.Escape(value).Replace(@"\*", ".*").Replace(@"\?", ".") + "$";
242 | }
243 | public void DeleteDirectory(string path)
244 | {
245 |
246 | try
247 | {
248 | string[] files = Directory.GetFiles(path);
249 | string[] dirs = Directory.GetDirectories(path);
250 | foreach (string file in files)
251 | {
252 | System.IO.File.SetAttributes(file, FileAttributes.Normal);
253 | System.IO.File.Delete(file);
254 | }
255 | foreach (string dir in dirs)
256 | {
257 | DeleteDirectory(dir);
258 | }
259 | Directory.Delete(path, true);
260 | }
261 | catch (IOException e)
262 | {
263 | throw e;
264 | }
265 | }
266 | }
267 | public class TrashContents
268 | {
269 | public string Container { get; set; }
270 | public DateTime DateDeleted { get; set; }
271 | public string Path { get; set; }
272 | public string Name { get; set; }
273 | public FileManagerDirectoryContent Data { get; set; }
274 | }
275 |
276 | }
--------------------------------------------------------------------------------
/server/Controllers/FileManagerController.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Mvc;
2 | using System;
3 | using System.Collections.Generic;
4 | using Microsoft.AspNetCore.Hosting;
5 | using Microsoft.AspNetCore.Http;
6 | using Microsoft.AspNetCore.Http.Features;
7 | //File Manager's base functions are available in the below namespace
8 | using DocumentExplorer.Models.FileManager;
9 | //File Manager's operations are available in the below namespace
10 | using DocumentExplorer.Data;
11 | using Newtonsoft.Json;
12 | using System.Linq;
13 | using System.IO;
14 | using Newtonsoft.Json.Serialization;
15 | using Microsoft.AspNetCore.Cors;
16 |
17 | namespace DocumentExplorer.Controllers
18 | {
19 | [Route("api/[controller]")]
20 | [EnableCors("AllowAllOrigins")]
21 | public class FileManagerController : ControllerBase
22 | {
23 | private PhysicalFileProvider operation;
24 | private string basePath;
25 | string root = "wwwroot\\Files";
26 | string rootPath;
27 | string virtualConnection;
28 | public FileManagerController(IWebHostEnvironment hostingEnvironment)
29 | {
30 | this.basePath = hostingEnvironment.ContentRootPath;
31 | this.operation = new PhysicalFileProvider();
32 | if (basePath.EndsWith("\\"))
33 | this.rootPath = this.basePath + this.root;
34 | else
35 | this.rootPath = this.basePath + "\\" + this.root;
36 | this.operation.RootFolder(rootPath);
37 | }
38 | // Processing the File Manager operations
39 | [Route("FileOperations")]
40 | public object FileOperations([FromBody] FileManagerCustomContent args)
41 | {
42 |
43 | args.RootType = HttpContext.Request.Headers["RootType"];
44 | string connectionId = HttpContext.Session.GetString("ConnectionId");
45 | if (args.Path == "/Files/")
46 | {
47 | args.Path = "/";
48 | }
49 | if (string.IsNullOrEmpty(connectionId))
50 | {
51 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
52 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
53 | }
54 |
55 | if (basePath.EndsWith("\\"))
56 | {
57 | virtualConnection = this.basePath + "wwwroot\\VirtualConnections";
58 | }
59 | else
60 | {
61 | virtualConnection = this.basePath + "\\wwwroot\\VirtualConnections";
62 | }
63 | DateTime currentTime = DateTime.Now;
64 | DateTime deletionThreshold = currentTime.AddHours(-24);
65 | DirectoryInfo virtualDirectoryInfo = new DirectoryInfo(virtualConnection);
66 |
67 | if (Directory.Exists(virtualConnection) && virtualDirectoryInfo.LastWriteTime <= deletionThreshold)
68 | {
69 | Directory.Delete(virtualConnection, true);
70 | }
71 | if (!Directory.Exists(virtualConnection))
72 | {
73 | //Create virtual root directory
74 | Directory.CreateDirectory(virtualConnection);
75 | }
76 | string userID = virtualConnection + "\\" + connectionId + "\\Files";
77 | string virtualUser = virtualConnection + "\\" + connectionId + "\\User";
78 | string virtualTrash = virtualConnection + "\\" + connectionId + "\\Trash";
79 | if (!Directory.Exists(userID))
80 | {
81 | Directory.CreateDirectory(userID);
82 | Directory.CreateDirectory(virtualUser);
83 | Directory.CreateDirectory(virtualTrash);
84 | CopyFolder(rootPath, userID);
85 | CopyFolder(this.basePath + "\\wwwroot\\User", virtualUser);
86 | CopyFolder(this.basePath + "\\wwwroot\\Trash", virtualTrash);
87 | }
88 |
89 | //Set user directory as root
90 | this.operation.RootFolder(userID);
91 |
92 | if (args.Action == "delete" || args.Action == "rename")
93 | {
94 | if ((args.TargetPath == null) && (args.Path == ""))
95 | {
96 | FileManagerResponse response = new FileManagerResponse();
97 | response.Error = new ErrorDetails { Code = "401", Message = "Restricted to modify the root folder." };
98 | return this.operation.ToCamelCase(response);
99 | }
100 | }
101 |
102 | switch (args.Action)
103 | {
104 | // Add your custom action here
105 | case "read":
106 | if ((args.RootType != null) && ((args.RootType == "Recent")))
107 | {
108 | FileManagerResponse result1 = this.operation.Search(args.Path, "*", args.ShowHiddenItems, false);
109 | return FilterRecentFiles(result1);
110 | }
111 | else
112 | {
113 | return this.operation.ToCamelCase(this.operation.GetFiles(args.Path, args.ShowHiddenItems));
114 | }
115 | case "delete":
116 |
117 | #if Publish
118 | FileManagerResponse deleteResponse = new FileManagerResponse();
119 | deleteResponse.Error = new ErrorDetails() { Code = "401", Message = "Restricted to perform this action" };
120 | return this.operation.ToCamelCase(deleteResponse);
121 | #else
122 | FileManagerDirectoryContent[] items1 = args.Data;
123 | string[] names1 = args.Names;
124 | return this.operation.ToCamelCase(MoveToTrash(args.Data, connectionId, virtualConnection, virtualUser));
125 | #endif
126 | case "copy":
127 | case "move":
128 | FileManagerResponse response = new FileManagerResponse();
129 | response.Error = new ErrorDetails() { Code = "401", Message = "Restricted to perform this action" };
130 | return this.operation.ToCamelCase(response);
131 | case "details":
132 | if ((args.RootType != null) && ((args.RootType == "Recent")))
133 | {
134 | FileManagerDirectoryContent[] items = args.Data;
135 | string[] names = args.Names;
136 | for (var i = 0; i < items.Length; i++)
137 | {
138 | names[i] = ((items[i].FilterPath + items[i].Name).Substring(1));
139 | }
140 | return this.operation.ToCamelCase(this.operation.Details("/", names, args.Data));
141 | }
142 | else
143 | {
144 | return this.operation.ToCamelCase(this.operation.Details(args.Path, args.Names, args.Data));
145 | }
146 | case "create":
147 | // Path - Current path where the folder is to be created; Name - Name of the new folder
148 | return this.operation.ToCamelCase(this.operation.Create(args.Path, args.Name));
149 | case "search":
150 | // 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
151 | if ((args.RootType != null) && ((args.RootType == "Recent")))
152 | {
153 | FileManagerResponse result1 = this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive);
154 | return FilterRecentFiles(result1);
155 | }
156 | else
157 | {
158 | return this.operation.ToCamelCase(this.operation.Search(args.Path, args.SearchString, args.ShowHiddenItems, args.CaseSensitive));
159 | }
160 | case "rename":
161 | // Path - Current path of the renamed file; Name - Old file name; NewName - New file name
162 | if ((args.RootType != null) && (args.RootType == "Recent"))
163 | {
164 | var items = args.Data;
165 | var name = ((items[0].FilterPath + items[0].Name).Substring(1));
166 | var newName = ((items[0].FilterPath + args.NewName).Substring(1));
167 | return this.operation.ToCamelCase(this.operation.Rename("/", name, newName));
168 | }
169 | else
170 | {
171 | return this.operation.ToCamelCase(this.operation.Rename(args.Path, args.Name, args.NewName));
172 | }
173 | }
174 | return null;
175 | }
176 | public FileManagerResponse FilterRecentFiles(FileManagerResponse result)
177 | {
178 | IEnumerable allFiles = (result.Files);
179 | allFiles = allFiles?.Where(item => item.DateModified.AddDays(5).CompareTo(DateTime.Now) != -1 && item.IsFile == true);
180 | result.Files = allFiles;
181 | return result;
182 | }
183 | public FileManagerResponse MoveToTrash(FileManagerDirectoryContent[] dataArray, string userId, String virtualConnection, string virtualUser)
184 | {
185 | string jsonPath = virtualUser + "\\trash.json";
186 | string jsonData = System.IO.File.ReadAllText(jsonPath);
187 | List DeletedFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
188 | PhysicalFileProvider trashOperation = new PhysicalFileProvider();
189 | string root = virtualConnection + "\\" + userId;
190 | trashOperation.RootFolder(root);
191 | List deletedFiles = new List();
192 | foreach (FileManagerDirectoryContent data in dataArray)
193 | {
194 | string fileLocation = "/Files" + data.FilterPath;
195 | DateTime deleteTime = DateTime.Now;
196 | string container = deleteTime.ToFileTimeUtc().ToString();
197 | string trashPath = "/Trash/" + container;
198 | Directory.CreateDirectory(root + trashPath);
199 | FileManagerResponse response = trashOperation.Move(fileLocation, trashPath, new string[] { data.Name }, null, null, null);
200 | if ((response.Error == null))
201 | {
202 | TrashContents deletedFile = new TrashContents()
203 | {
204 | Container = container,
205 | Data = data,
206 | DateDeleted = deleteTime,
207 | Name = data.Name,
208 | Path = data.FilterPath
209 | };
210 | deletedFile.Data.DateModified = deletedFile.DateDeleted;
211 | deletedFile.Data.Id = deletedFile.Container;
212 | DeletedFiles.Add(deletedFile);
213 | deletedFiles.Add(response.Files.First());
214 | }
215 | }
216 | jsonData = JsonConvert.SerializeObject(DeletedFiles);
217 | System.IO.File.WriteAllText(jsonPath, jsonData);
218 | return new FileManagerResponse() { Files = deletedFiles };
219 | }
220 | [Route("Upload")]
221 | public IActionResult Upload(string path, IList uploadFiles, string action)
222 | {
223 | #if Publish
224 | //Restrict the upload functionality for publish settings
225 | Response.Clear();
226 | Response.ContentType = "application/json; charset=utf-8";
227 | Response.StatusCode = 403;
228 | Response.HttpContext.Features.Get().ReasonPhrase = "The upload functionality is restricted in this online demo. To test this demo application with upload functionality, please download the source code from the GitHub location (https://github.com/syncfusion/blazor-showcase-document-explorer) and run it.";
229 | return Content("The upload functionality is restricted in this online demo. To test this demo application with upload functionality, please download the source code from the GitHub location (https://github.com/syncfusion/blazor-showcase-document-explorer) and run it.");
230 | #else
231 | string connectionId = HttpContext.Session.GetString("ConnectionId");
232 |
233 | if (string.IsNullOrEmpty(connectionId))
234 | {
235 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
236 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
237 | }
238 | FileManagerResponse uploadResponse;
239 | PhysicalFileProvider uploadOperation = new PhysicalFileProvider();
240 | string basePath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId;
241 | string userID = this.basePath + "wwwroot\\VirtualConnections\\" + connectionId + "\\Files";
242 | uploadOperation.RootFolder(userID);
243 | uploadResponse = operation.Upload(path, uploadFiles, action, basePath, null);
244 | if (uploadResponse.Error != null)
245 | {
246 | Response.Clear();
247 | Response.ContentType = "application/json; charset=utf-8";
248 | Response.StatusCode = Convert.ToInt32(uploadResponse.Error.Code);
249 | Response.HttpContext.Features.Get().ReasonPhrase = uploadResponse.Error.Message;
250 | }
251 | return Content("");
252 | #endif
253 | }
254 |
255 | [Route("Download")]
256 | public IActionResult Download(string downloadInput)
257 | {
258 | FileManagerDirectoryContent args = JsonConvert.DeserializeObject(downloadInput);
259 | FileManagerDirectoryContent[] items = args.Data;
260 | string[] names = args.Names;
261 | for (var i = 0; i < items.Length; i++)
262 | {
263 | names[i] = ((items[i].FilterPath + items[i].Name).Substring(1));
264 | }
265 | return operation.Download("/", names);
266 | }
267 |
268 | [Route("ToggleStarred")]
269 | public IActionResult ToggleStarred([FromBody] FileManagerCustomContent args)
270 | {
271 | string connectionId = HttpContext.Session.GetString("ConnectionId");
272 |
273 | if (string.IsNullOrEmpty(connectionId))
274 | {
275 | connectionId = Guid.NewGuid().ToString(); // Generate a new unique identifier
276 | HttpContext.Session.SetString("ConnectionId", connectionId); // Store it in session
277 | }
278 | string basePath = this.basePath + "\\wwwroot\\VirtualConnections\\" + connectionId +"\\User";
279 | string jsonPath = basePath + "\\star.json";
280 | StreamReader reader = new StreamReader(jsonPath);
281 | string jsonData = reader.ReadToEnd();
282 | reader.Dispose();
283 | List starredFiles = JsonConvert.DeserializeObject>(jsonData) ?? new List();
284 | string path = args.Path.Replace(Path.DirectorySeparatorChar, '/');
285 | if (args.Starred && !starredFiles.Contains(path))
286 | {
287 | starredFiles.Add(path);
288 | }
289 | else if (!args.Starred && starredFiles.Contains(path))
290 | {
291 | starredFiles.Remove(path);
292 | }
293 | jsonData = JsonConvert.SerializeObject(starredFiles);
294 | System.IO.File.WriteAllText(jsonPath, jsonData);
295 | return Content("");
296 | }
297 |
298 | [Route("GetImage")]
299 | public IActionResult GetImage(FileManagerDirectoryContent args)
300 | {
301 | return this.operation.GetImage(args.Path, args.Id, false, null, null);
302 | }
303 |
304 | private void CopyFolder(string source, string destination)
305 | {
306 | if (!Directory.Exists(destination))
307 | {
308 | Directory.CreateDirectory(destination);
309 | }
310 |
311 | foreach (var file in Directory.EnumerateFiles(source))
312 | {
313 | var dest = Path.Combine(destination, Path.GetFileName(file));
314 | System.IO.File.Copy(file, dest);
315 | }
316 |
317 | foreach (var folder in Directory.EnumerateDirectories(source))
318 | {
319 | var dest = Path.Combine(destination, Path.GetFileName(folder));
320 | CopyFolder(folder, dest);
321 | }
322 | }
323 |
324 | public class FileManagerCustomContent : FileManagerDirectoryContent
325 | {
326 | public string RootType { get; set; }
327 |
328 | //Custom parameter inidicating starred files
329 | public bool Starred { get; set; }
330 | }
331 | public class FileResponse
332 | {
333 | public FileManagerDirectoryContent CWD { get; set; }
334 |
335 | public IEnumerable Files { get; set; }
336 |
337 | public ErrorDetails Error { get; set; }
338 |
339 | public FileDetails Details { get; set; }
340 |
341 | }
342 | public class TrashContents
343 | {
344 | public string Container { get; set; }
345 | public DateTime DateDeleted { get; set; }
346 | public string Path { get; set; }
347 | public string Name { get; set; }
348 | public FileManagerDirectoryContent Data { get; set; }
349 | }
350 | }
351 | }
--------------------------------------------------------------------------------
/server/wwwroot/Script/JsInteropHelper.js:
--------------------------------------------------------------------------------
1 | window.setPreview = (val, url) => {
2 |
3 | var ele = document.querySelector("[data-uid='" + val + "']");
4 | if (ele === null) { return; }
5 | var image = ele.getElementsByClassName('e-list-img')[0];
6 | image.setAttribute('src', url);
7 | };
8 | window.setLocalCacheImage = (key, img) => {
9 | var storage = window.localStorage;
10 | localStorage.setItem(key, img);
11 | };
12 | window.getLocalCacheImage = (key) => {
13 | var img = localStorage.getItem('key');
14 | return img;
15 | };
16 | window.setSpinnerPreview = (val) => {
17 | var ele = document.querySelector("[data-uid='" + val + "']");
18 | if (ele === null) { return; }
19 | var rowDiv = document.createElement('img');
20 | rowDiv.classList.add('e-list-img');
21 | rowDiv.setAttribute('src', 'data:image/svg+xml;base64,PCEtLSBCeSBTYW0gSGVyYmVydCAoQHNoZXJiKSwgZm9yIGV2ZXJ5b25lLiBNb3JlIEAgaHR0cDovL2dvby5nbC83QUp6YkwgLS0+Cjxzdmcgd2lkdGg9IjU4IiBoZWlnaHQ9IjU4IiB2aWV3Qm94PSIwIDAgNTggNTgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIgMSkiIHN0cm9rZT0iI0ZGRiIgc3Ryb2tlLXdpZHRoPSIxLjUiPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSI0Mi42MDEiIGN5PSIxMS40NjIiIHI9IjUiIGZpbGwtb3BhY2l0eT0iMSIgZmlsbD0iIzI4N0JENCI+CiAgICAgICAgICAgICAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJmaWxsLW9wYWNpdHkiCiAgICAgICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIxLjNzIgogICAgICAgICAgICAgICAgICAgICB2YWx1ZXM9IjE7MDswOzA7MDswOzA7MCIgY2FsY01vZGU9ImxpbmVhciIKICAgICAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CiAgICAgICAgICAgIDwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSI0OS4wNjMiIGN5PSIyNy4wNjMiIHI9IjUiIGZpbGwtb3BhY2l0eT0iMCIgZmlsbD0iIzI4N0JENCI+CiAgICAgICAgICAgICAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJmaWxsLW9wYWNpdHkiCiAgICAgICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIxLjNzIgogICAgICAgICAgICAgICAgICAgICB2YWx1ZXM9IjA7MTswOzA7MDswOzA7MCIgY2FsY01vZGU9ImxpbmVhciIKICAgICAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CiAgICAgICAgICAgIDwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSI0Mi42MDEiIGN5PSI0Mi42NjMiIHI9IjUiIGZpbGwtb3BhY2l0eT0iMCIgZmlsbD0iIzI4N0JENCI+CiAgICAgICAgICAgICAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJmaWxsLW9wYWNpdHkiCiAgICAgICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIxLjNzIgogICAgICAgICAgICAgICAgICAgICB2YWx1ZXM9IjA7MDsxOzA7MDswOzA7MCIgY2FsY01vZGU9ImxpbmVhciIKICAgICAgICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CiAgICAgICAgICAgIDwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGN4PSIyNyIgY3k9IjQ5LjEyNSIgcj0iNSIgZmlsbC1vcGFjaXR5PSIwIiBmaWxsPSIjMjg3QkQ0Ij4KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImZpbGwtb3BhY2l0eSIKICAgICAgICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjEuM3MiCiAgICAgICAgICAgICAgICAgICAgIHZhbHVlcz0iMDswOzA7MTswOzA7MDswIiBjYWxjTW9kZT0ibGluZWFyIgogICAgICAgICAgICAgICAgICAgICByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4KICAgICAgICAgICAgPC9jaXJjbGU+CiAgICAgICAgICAgIDxjaXJjbGUgY3g9IjExLjM5OSIgY3k9IjQyLjY2MyIgcj0iNSIgZmlsbC1vcGFjaXR5PSIwIiBmaWxsPSIjMjg3QkQ0Ij4KICAgICAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9ImZpbGwtb3BhY2l0eSIKICAgICAgICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjEuM3MiCiAgICAgICAgICAgICAgICAgICAgIHZhbHVlcz0iMDswOzA7MDsxOzA7MDswIiBjYWxjTW9kZT0ibGluZWFyIgogICAgICAgICAgICAgICAgICAgICByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSIgLz4KICAgICAgICAgICAgPC9jaXJjbGU+CiAgICAgICAgICAgIDxjaXJjbGUgY3g9IjQuOTM4IiBjeT0iMjcuMDYzIiByPSI1IiBmaWxsLW9wYWNpdHk9IjAiIGZpbGw9IiMyODdCRDQiPgogICAgICAgICAgICAgICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iZmlsbC1vcGFjaXR5IgogICAgICAgICAgICAgICAgICAgICBiZWdpbj0iMHMiIGR1cj0iMS4zcyIKICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSIwOzA7MDswOzA7MTswOzAiIGNhbGNNb2RlPSJsaW5lYXIiCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPgogICAgICAgICAgICA8L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBjeD0iMTEuMzk5IiBjeT0iMTEuNDYyIiByPSI1IiBmaWxsLW9wYWNpdHk9IjAiIGZpbGw9IiMyODdCRDQiPgogICAgICAgICAgICAgICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iZmlsbC1vcGFjaXR5IgogICAgICAgICAgICAgICAgICAgICBiZWdpbj0iMHMiIGR1cj0iMS4zcyIKICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSIwOzA7MDswOzA7MDsxOzAiIGNhbGNNb2RlPSJsaW5lYXIiCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPgogICAgICAgICAgICA8L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBjeD0iMjciIGN5PSI1IiByPSI1IiBmaWxsLW9wYWNpdHk9IjAiIGZpbGw9IiMyODdCRDQiPgogICAgICAgICAgICAgICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iZmlsbC1vcGFjaXR5IgogICAgICAgICAgICAgICAgICAgICBiZWdpbj0iMHMiIGR1cj0iMS4zcyIKICAgICAgICAgICAgICAgICAgICAgdmFsdWVzPSIwOzA7MDswOzA7MDswOzEiIGNhbGNNb2RlPSJsaW5lYXIiCiAgICAgICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPgogICAgICAgICAgICA8L2NpcmNsZT4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==');
22 | var icon = ele.querySelector('.e-list-icon');
23 | //Insert the image tag in the place of default image
24 | icon.parentElement.insertBefore(rowDiv, icon);
25 | icon.remove();
26 | };
27 | window.revertToIconPreview = (val, iconClass) => {
28 | var ele = document.querySelector("[data-uid='" + val + "']");
29 | if (ele === null) { return; }
30 | var image = ele.getElementsByClassName('e-list-img')[0];
31 | var iconDiv = document.createElement('div');
32 | iconDiv.classList.add('e-list-icon');
33 | iconDiv.classList.add(iconClass);
34 | //Insert the icon div tag for the spinner image
35 | image.parentElement.insertBefore(iconDiv, image);
36 | image.remove();
37 | };
38 | window.toggleZipFileManagerVisibility = (id, val) => {
39 | var element = document.getElementById(id);
40 | if (val) {
41 | element.style.display = 'block';
42 | } else {
43 | element.style.display = 'none';
44 | }
45 | };
46 | window.renderThumbnail = (id, images) => {
47 | var ele = document.getElementById(id);
48 |
49 | for (i = 0; i < 5; i++) {
50 | var anchor = document.createElement('a');
51 | anchor.setAttribute('role', 'link');
52 | anchor.setAttribute('id', 'Page_0');
53 | var thumbnailDiv = document.createElement('div');
54 | thumbnailDiv.className = 'e-pv-thumbnail e-pv-thumbnail-column';
55 | thumbnailDiv.style.marginBottom = '20px';
56 | var imageDiv = document.createElement('div');
57 | imageDiv.innerHTML = ' ';
58 | imageDiv.addEventListener('focus', function () {
59 | imageDiv.className = 'e-pv-thumbnail-focus';
60 | });
61 | imageDiv.addEventListener('hover', function () {
62 | imageDiv.className = 'e-pv-thumbnail-hover';
63 | });
64 | imageDiv.addEventListener('click', function () {
65 | imageDiv.className = 'e-pv-thumbnail-selection';
66 | });
67 | thumbnailDiv.appendChild(imageDiv);
68 | anchor.appendChild(thumbnailDiv);
69 | ele.appendChild(anchor);
70 | this.wireEvents(imageDiv);
71 | }
72 | };
73 | var prevSelectedIndex;
74 | window.gotoThumbnailImage = (ele, index) => {
75 | if (prevSelectedIndex !== undefined) {
76 | var simageDiv = ele.getElementsByClassName('Ring_' + prevSelectedIndex)[0];
77 | simageDiv.classList.remove("e-pv-thumbnail-selection");
78 | simageDiv.classList.add("e-pv-thumbnail-selection-ring");
79 | }
80 | var imageDiv = ele.getElementsByClassName('Ring_' + index)[0];
81 | imageDiv.classList.add("e-pv-thumbnail-selection");
82 | imageDiv.scrollIntoView();
83 | prevSelectedIndex = index;
84 | }
85 | window.selectThumbnail = (ele, item) => {
86 | var imageDiv = ele.getElementsByClassName('Ring_' + item.pageNumber)[0];
87 | imageDiv.classList.remove("e-pv-thumbnail-selection-ring");
88 | imageDiv.classList.add("e-pv-thumbnail-selection");
89 | imageDiv.scrollIntoView();
90 | }
91 | window.removeThumbnailSelection = (ele, prevIndex) => {
92 | var imageDiv = ele.getElementsByClassName('Ring_' + prevIndex)[0];
93 | imageDiv.classList.remove("e-pv-thumbnail-selection");
94 | imageDiv.classList.add("e-pv-thumbnail-selection-ring");
95 | }
96 | window.thumbnailMouseIn = (ele, item) => {
97 | var imageDiv = ele.getElementsByClassName('Ring_' + item.pageNumber)[0];
98 | imageDiv.classList.add("e-pv-thumbnail-hover");
99 | }
100 | window.thumbnailMouseOut = (ele, item) => {
101 | var imageDiv = ele.getElementsByClassName('Ring_' + item.pageNumber)[0];
102 | imageDiv.classList.remove("e-pv-thumbnail-hover");
103 | }
104 | var timer;
105 | window.toggleBottomToolbarVisibility = (widthRef, isThumbnailVisible) => {
106 | var refEle = document.getElementById(widthRef);
107 | var marginLeft;
108 | if (refEle) {
109 | marginLeft = (refEle.clientWidth - 393) / 2;
110 | if ((widthRef == "PptView" || widthRef == "PdfView") && isThumbnailVisible) {
111 | var sidbarDivElement = document.getElementById(widthRef + "_sideBarContent");
112 | if (sidbarDivElement) {
113 | marginLeft = (refEle.clientWidth - 393 + sidbarDivElement.clientWidth) / 2;
114 | }
115 | }
116 | } else {
117 | marginLeft = (window.innerWidth - 393) / 2;
118 | }
119 | var bottomCntr = document.getElementById("bottom_toolbar_container");
120 | clearTimeout(timer);
121 | if (bottomCntr) {
122 | bottomCntr.style.marginLeft = marginLeft + "px";
123 | bottomCntr.style.display = "block";
124 | }
125 | timer = setTimeout(function () {
126 | if (bottomCntr) {
127 | bottomCntr.style.display = "none";
128 | }
129 | }, 5000);
130 | }
131 | window.getDocumentEditorHeight = () => {
132 | return (window.innerHeight - 52) + "px";
133 | }
134 | window.fullScreen = (componentId) => {
135 | var element = document.getElementById(componentId);
136 | var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen;
137 | if (requestMethod) {
138 | requestMethod.call(element);
139 | } else if (typeof window.ActiveXObject !== "undefined") { // Older IE.
140 | var wscript = new ActiveXObject("WScript.Shell");
141 | if (wscript !== null) {
142 | wscript.SendKeys("{F11}");
143 | }
144 | }
145 | }
146 | window.onresize = () => {
147 | var documentEditor = document.getElementById("DocEdit");
148 | if (documentEditor) {
149 | documentEditor.ej2_instances[0].resize();
150 | }
151 | }
--------------------------------------------------------------------------------