mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update Main to handle basic files and folder search query
This commit is contained in:
parent
be524cb6ea
commit
c295585272
1 changed files with 24 additions and 13 deletions
|
|
@ -1,14 +1,16 @@
|
|||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
using Flow.Launcher.Plugin.Explorer.Views;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer
|
||||
{
|
||||
class Main : ISettingProvider, IPlugin, ISavable, IPluginI18n, IContextMenu
|
||||
class Main : ISettingProvider, IPlugin, ISavable, IContextMenu //, IPluginI18n <=== do later
|
||||
{
|
||||
private PluginInitContext Context { get; set; }
|
||||
|
||||
|
|
@ -16,21 +18,14 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
private SettingsViewModel _viewModel;
|
||||
|
||||
// Reserved keywords in oleDB
|
||||
private string ReservedStringPattern = @"^[\/\\\$\%]+$";
|
||||
|
||||
public Control CreateSettingPanel()
|
||||
{
|
||||
return new ExplorerSettings();
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginDescription()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public string GetTranslatedPluginTitle()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Init(PluginInitContext context)
|
||||
{
|
||||
Context = context;
|
||||
|
|
@ -41,12 +36,28 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
public List<Result> LoadContextMenus(Result selectedResult)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return new List<Result>();
|
||||
}
|
||||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
return new List<Result>();
|
||||
var results = new List<Result>();
|
||||
|
||||
if (string.IsNullOrEmpty(query.Search))
|
||||
return results;
|
||||
|
||||
var regexMatch = Regex.Match(query.Search, ReservedStringPattern);
|
||||
|
||||
if (regexMatch.Success)
|
||||
return results;
|
||||
|
||||
var queryConstructor = new QueryConstructor(_settings);
|
||||
|
||||
var searcher = new Searcher(Context);
|
||||
|
||||
return searcher.WindowsIndexSearch(query.Search,
|
||||
queryConstructor.CreateQueryHelper().ConnectionString,
|
||||
queryConstructor.QueryForAllFilesAndFolders);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
|
|
|||
Loading…
Reference in a new issue