UserFolderProcessor.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System.Collections.Generic; 6 using System.Linq; 7 8 using Microsoft.Plugin.Folder.Sources; 9 using Microsoft.Plugin.Folder.Sources.Result; 10 11 namespace Microsoft.Plugin.Folder 12 { 13 internal class UserFolderProcessor : IFolderProcessor 14 { 15 private readonly FolderHelper _folderHelper; 16 17 public UserFolderProcessor(FolderHelper folderHelper) 18 { 19 _folderHelper = folderHelper; 20 } 21 22 public IEnumerable<IItemResult> Results(string actionKeyword, string search) 23 { 24 return _folderHelper.GetUserFolderResults(search) 25 .Select(item => CreateFolderResult(item.Nickname, item.Path, item.Path, search)); 26 } 27 28 private static UserFolderResult CreateFolderResult(string title, string subtitle, string path, string search) 29 { 30 return new UserFolderResult 31 { 32 Search = search, 33 Title = title, 34 Subtitle = subtitle, 35 Path = path, 36 }; 37 } 38 } 39 }