Io abstraction (#7293)

Co-authored-by: p-storm <paul.de.man@gmail.com>
This commit is contained in:
P-Storm
2020-11-02 18:33:43 +01:00
committed by GitHub
parent 5c3eef0112
commit 0d4017fe1a
109 changed files with 700 additions and 678 deletions

View File

@@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Globalization;
using System.IO;
using System.IO.Abstractions;
using Wox.Infrastructure;
using Wox.Plugin;
@@ -13,15 +13,27 @@ namespace Microsoft.Plugin.Folder.Sources.Result
{
private static readonly IShellAction ShellAction = new ShellAction();
private readonly IPath _path;
public FileItemResult()
: this(new FileSystem().Path)
{
}
private FileItemResult(IPath path)
{
_path = path;
}
public string FilePath { get; set; }
public string Title => Path.GetFileName(FilePath);
public string Title => _path.GetFileName(FilePath);
public string Search { get; set; }
public Wox.Plugin.Result Create(IPublicAPI contextApi)
{
var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData)
var result = new Wox.Plugin.Result(StringMatcher.FuzzySearch(Search, _path.GetFileName(FilePath)).MatchData)
{
Title = Title,