Merge pull request #389 from Flow-Launcher/optimizeStartup

Optimize startup
This commit is contained in:
Jeremy Wu 2021-03-22 05:08:49 +11:00 committed by GitHub
commit b5e54a76b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 21 deletions

View file

@ -20,7 +20,7 @@ namespace Flow.Launcher.Core.Plugin
public static List<PluginMetadata> Parse(string[] pluginDirectories)
{
var allPluginMetadata = new List<PluginMetadata>();
var directories = pluginDirectories.SelectMany(Directory.GetDirectories);
var directories = pluginDirectories.SelectMany(Directory.EnumerateDirectories);
// todo use linq when diable plugin is implmented since parallel.foreach + list is not thread saft
foreach (var directory in directories)

View file

@ -18,20 +18,17 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
private List<Bookmark> cachedBookmarks = new List<Bookmark>();
private readonly Settings _settings;
private readonly PluginJsonStorage<Settings> _storage;
public Main()
{
_storage = new PluginJsonStorage<Settings>();
_settings = _storage.Load();
cachedBookmarks = Bookmarks.LoadAllBookmarks();
}
private Settings _settings { get; set;}
private PluginJsonStorage<Settings> _storage { get; set;}
public void Init(PluginInitContext context)
{
this.context = context;
_storage = new PluginJsonStorage<Settings>();
_settings = _storage.Load();
cachedBookmarks = Bookmarks.LoadAllBookmarks();
}
public List<Result> Query(Query query)

View file

@ -4,7 +4,7 @@
"Name": "Browser Bookmarks",
"Description": "Search your browser bookmarks",
"Author": "qianlifeng, Ioannis G.",
"Version": "1.4.0",
"Version": "1.4.1",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.BrowserBookmark.dll",

View file

@ -24,7 +24,7 @@ namespace Flow.Launcher.Plugin.Caculator
@"[ei]|[0-9]|[\+\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
@")+$", RegexOptions.Compiled);
private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
private static readonly Engine MagesEngine;
private static Engine MagesEngine;
private PluginInitContext Context { get; set; }
private static Settings _settings;
@ -32,13 +32,7 @@ namespace Flow.Launcher.Plugin.Caculator
static Main()
{
MagesEngine = new Engine(new Configuration
{
Scope = new Dictionary<string, object>
{
{ "e", Math.E }, // e is not contained in the default mages engine
}
});
}
public void Init(PluginInitContext context)
@ -47,6 +41,14 @@ namespace Flow.Launcher.Plugin.Caculator
_viewModel = new SettingsViewModel();
_settings = _viewModel.Settings;
MagesEngine = new Engine(new Configuration
{
Scope = new Dictionary<string, object>
{
{ "e", Math.E }, // e is not contained in the default mages engine
}
});
}
public List<Result> Query(Query query)

View file

@ -4,7 +4,7 @@
"Name": "Calculator",
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
"Author": "cxfksword",
"Version": "1.1.5",
"Version": "1.1.6",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll",