-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ Add custom search capability + Refactor some configuration methods
- Loading branch information
1 parent
36c5d5f
commit 258ca55
Showing
11 changed files
with
126 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
elFinder.Net.Core/Demos/elFinder.Net.AdvancedDemo/Services/ApplicationFileSystemDriver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using elFinder.Net.Core; | ||
using elFinder.Net.Core.Extensions; | ||
using elFinder.Net.Core.Models.Command; | ||
using elFinder.Net.Core.Models.Response; | ||
using elFinder.Net.Core.Services; | ||
using elFinder.Net.Core.Services.Drawing; | ||
using elFinder.Net.Drivers.FileSystem; | ||
using elFinder.Net.Drivers.FileSystem.Services; | ||
using System.IO; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace elFinder.Net.AdvancedDemo.Services | ||
{ | ||
public class ApplicationFileSystemDriver : FileSystemDriver | ||
{ | ||
public ApplicationFileSystemDriver( | ||
IPathParser pathParser, | ||
IPictureEditor pictureEditor, | ||
IVideoEditor videoEditor, | ||
IZipDownloadPathProvider zipDownloadPathProvider, | ||
IZipFileArchiver zipFileArchiver, | ||
IThumbnailBackgroundGenerator thumbnailBackgroundGenerator, | ||
ICryptographyProvider cryptographyProvider, | ||
IConnector connector, | ||
IConnectorManager connectorManager, | ||
ITempFileCleaner tempFileCleaner) | ||
: base(pathParser, pictureEditor, videoEditor, | ||
zipDownloadPathProvider, zipFileArchiver, | ||
thumbnailBackgroundGenerator, cryptographyProvider, | ||
connector, connectorManager, tempFileCleaner) | ||
{ | ||
} | ||
|
||
public async Task<SearchResponse> SearchMatchFolderOnly(SearchCommand cmd, CancellationToken cancellationToken = default) | ||
{ | ||
cancellationToken.ThrowIfCancellationRequested(); | ||
|
||
var searchResp = new SearchResponse(); | ||
var targetPath = cmd.TargetPath; | ||
var volume = targetPath.Volume; | ||
|
||
foreach (var item in await targetPath.Directory.GetDirectoriesAsync(cmd.Q, | ||
searchOption: SearchOption.AllDirectories, cancellationToken: cancellationToken)) | ||
{ | ||
var hash = item.GetHash(volume, pathParser); | ||
var parentHash = item.Parent.Equals(targetPath.Directory) ? targetPath.HashedTarget : | ||
item.GetParentHash(volume, pathParser); | ||
searchResp.files.Add(await item.ToFileInfoAsync(hash, parentHash, volume, connector.Options, cancellationToken: cancellationToken)); | ||
} | ||
|
||
return searchResp; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters