Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Commit 508cdae

Browse files
authored
Merge pull request #6 from Flow-Launcher/install_everything_service
Install everything service automatically
2 parents f0ce723 + cd23177 commit 508cdae

File tree

7 files changed

+91
-12
lines changed

7 files changed

+91
-12
lines changed

EverythingSettings.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<Grid.RowDefinitions>
1111
<RowDefinition/>
1212
<RowDefinition/>
13-
<RowDefinition Height="30"/>
13+
<RowDefinition Height="35"/>
1414
</Grid.RowDefinitions>
1515
<Grid.ColumnDefinitions>
1616
<ColumnDefinition />
@@ -27,12 +27,12 @@
2727
HorizontalAlignment="Left" Click="EditorPath_Clicked"/>
2828
<TextBlock Grid.Row="3" Text="{DynamicResource flowlauncher_plugin_everything_customized_title}" Margin="10,0,0,0" VerticalAlignment="Center"
2929
ToolTip="{DynamicResource flowlauncher_plugin_everything_customized_tooltip}"/>
30-
<TextBox Grid.Row="3" Grid.Column="1" TextWrapping="NoWrap" VerticalAlignment="Center" Width="150" Height="30"
30+
<TextBox Grid.Row="3" Grid.Column="1" TextWrapping="NoWrap" VerticalAlignment="Center" Width="150" Height="35"
3131
TextChanged="CustomizeExplorer" x:Name="CustomizeExplorerBox"/>
3232
<TextBlock Grid.Row="3" Grid.Column="2" Text="{DynamicResource flowlauncher_plugin_everything_customized_args}" VerticalAlignment="Center" Margin="5"
3333
ToolTip="{DynamicResource flowlauncher_plugin_everything_customized_args_tooltip}"></TextBlock>
3434
<TextBox Grid.Row="3" Grid.Column="2" HorizontalAlignment="Right"
3535
ToolTip="{DynamicResource flowlauncher_plugin_everything_customized_args_textbox}"
36-
Margin="0,0,5,0" Width="50" Height="30" x:Name="CustomizeArgsBox" TextChanged="CustomizeExplorerArgs"></TextBox>
36+
Margin="0,0,5,0" Width="80" Height="35" x:Name="CustomizeArgsBox" TextChanged="CustomizeExplorerArgs"></TextBox>
3737
</Grid>
3838
</UserControl>

Flow.Launcher.Plugin.Everything.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
</ItemGroup>
119119

120120
<ItemGroup>
121-
<PackageReference Include="Flow.Launcher.Plugin" Version="1.1.0" />
121+
<PackageReference Include="Droplex" Version="1.0.4" />
122+
<PackageReference Include="Flow.Launcher.Plugin" Version="1.3.1" />
122123
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
123124
<PackageReference Include="System.Runtime" Version="4.3.1" />
124125
</ItemGroup>

Languages/en.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@
2424
<system:String x:Key="flowlauncher_plugin_everything_customized_args">Args</system:String>
2525
<system:String x:Key="flowlauncher_plugin_everything_customized_args_tooltip">Enter the customized args you want to add for customized explorer. %s represent directory path (parent directory for file or directory itself). %f represent file path (only work for file).</system:String>
2626
<system:String x:Key="flowlauncher_plugin_everything_customized_args_textbox">%s represent directory path (parent directory for file or directory itself). %f represent file path (only work for file).</system:String>
27+
28+
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
29+
<system:String x:Key="flowlauncher_plugin_everything_installing_subtitle">Installing Everything service. Please wait...</system:String>
30+
<system:String x:Key="flowlauncher_plugin_everything_installationsuccess_subtitle">Successfully installed Everything service</system:String>
31+
<system:String x:Key="flowlauncher_plugin_everything_installationfailed_subtitle">Failed to automatically install Everything service. Please manually install it from https://www.voidtools.com/Everything-1.3.4.686.x64-Setup.exe</system:String>
32+
<system:String x:Key="flowlauncher_plugin_everything_run_service">Click here to start it</system:String>
2733
</ResourceDictionary>

Main.cs

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Flow.Launcher.Infrastructure;
1+
using Droplex;
2+
using Flow.Launcher.Infrastructure;
23
using Flow.Launcher.Infrastructure.Logger;
34
using Flow.Launcher.Infrastructure.Storage;
45
using Flow.Launcher.Plugin.Everything.Everything;
@@ -8,6 +9,7 @@
89
using System.Diagnostics;
910
using System.IO;
1011
using System.Threading;
12+
using System.Threading.Tasks;
1113
using System.Windows;
1214
using System.Windows.Controls;
1315

@@ -18,7 +20,7 @@ public class Main : IPlugin, ISettingProvider, IPluginI18n, IContextMenu, ISavab
1820
public const string DLL = "Everything.dll";
1921
private readonly IEverythingApi _api = new EverythingApi();
2022

21-
23+
private string installationFilePath = "C:\\Program Files\\Everything\\Everything.exe";
2224

2325
private PluginInitContext _context;
2426

@@ -59,7 +61,15 @@ public List<Result> Query(Query query)
5961
results.Add(new Result
6062
{
6163
Title = _context.API.GetTranslation("flowlauncher_plugin_everything_is_not_running"),
62-
IcoPath = "Images\\warning.png"
64+
SubTitle = _context.API.GetTranslation("flowlauncher_plugin_everything_run_service"),
65+
IcoPath = "Images\\warning.png",
66+
Action = _ =>
67+
{
68+
if(SharedCommands.FilesFolders.FileExists(installationFilePath))
69+
SharedCommands.FilesFolders.OpenPath(installationFilePath);
70+
71+
return true;
72+
}
6373
});
6474
}
6575
catch (Exception e)
@@ -171,6 +181,34 @@ private List<ContextMenu> GetDefaultContextMenu()
171181

172182
public void Init(PluginInitContext context)
173183
{
184+
var s = Utilities.GetInstalledPath();
185+
186+
if (string.IsNullOrEmpty(s))
187+
{
188+
Task.Run(async delegate
189+
{
190+
context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
191+
context.API.GetTranslation("flowlauncher_plugin_everything_installing_subtitle"), "", useMainWindowAsOwner: false);
192+
193+
await DroplexPackage.Drop(App.Everything1_3_4_686).ConfigureAwait(false);
194+
195+
context.API.ShowMsg(context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"),
196+
context.API.GetTranslation("flowlauncher_plugin_everything_installationsuccess_subtitle"), "", useMainWindowAsOwner: false);
197+
198+
SharedCommands.FilesFolders.OpenPath(installationFilePath);
199+
200+
}).ContinueWith(t =>
201+
{
202+
Log.Exception("Main", $"Failed to install Everything service", t.Exception.InnerException, "DroplexPackage.Drop");
203+
MessageBox.Show(context.API.GetTranslation("flowlauncher_plugin_everything_installationfailed_subtitle"),
204+
context.API.GetTranslation("flowlauncher_plugin_everything_installing_title"));
205+
}, TaskContinuationOptions.OnlyOnFaulted);
206+
}
207+
else
208+
{
209+
installationFilePath = s;
210+
}
211+
174212
_context = context;
175213
_storage = new PluginJsonStorage<Settings>();
176214
_settings = _storage.Load();

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Flow.Launcher.Plugin.Everything
33

44
This is the repo for the Flow.Launcher's Everything plugin. This plugin has been extracted out of Flow Launcher as its core functionalities have been replaced by Explorer plugin.
55

6-
**Requirement:**
6+
**Dependency:**
77

8-
Currently supported version is 1.3.4.686
9-
10-
To use this plugin you need to download and install [Everything](https://www.voidtools.com/)(use x64 if your windows is x64 bit)
8+
Requires Everything service(automatically installed) and currently supported version is 1.3.4.686

Utilities.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Droplex;
2+
using Microsoft.Win32;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.IO;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
10+
namespace Flow.Launcher.Plugin.Everything
11+
{
12+
internal static class Utilities
13+
{
14+
internal static string GetInstalledPath()
15+
{
16+
string displayName;
17+
string uninstallString;
18+
19+
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
20+
if (key != null)
21+
{
22+
foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName)))
23+
{
24+
displayName = subkey.GetValue("DisplayName") as string;
25+
if (displayName != null && displayName.Contains("Everything"))
26+
{
27+
uninstallString = subkey.GetValue("UninstallString") as string;
28+
return Path.Combine(Path.GetDirectoryName(uninstallString), "Everything.exe");
29+
}
30+
}
31+
}
32+
33+
return string.Empty;
34+
}
35+
}
36+
}

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "Everything",
55
"Description": "Search Everything",
66
"Author": "qianlifeng,orzfly",
7-
"Version": "1.2.0",
7+
"Version": "1.3.0",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher.Plugin.Everything",
1010
"IcoPath": "Images\\find.png",

0 commit comments

Comments
 (0)