Skip to content

Commit 69b1031

Browse files
committed
Using AssocQueryString and Translations
Resolves #13 Resolves #16 Icon changes
1 parent c0232b0 commit 69b1031

25 files changed

+1770
-136
lines changed

Diff for: Community.PowerToys.Run.Plugin.Everything.csproj

+56-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<DefineConstants>DEBUG;TRACE</DefineConstants>
2828
<DebugType>full</DebugType>
2929
<PlatformTarget>x64</PlatformTarget>
30-
<LangVersion>7.3</LangVersion>
30+
<LangVersion>8.0</LangVersion>
3131
<ErrorReport>prompt</ErrorReport>
3232
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
3333
<WarningLevel>4</WarningLevel>
@@ -41,7 +41,7 @@
4141
<Optimize>true</Optimize>
4242
<DebugType>none</DebugType>
4343
<PlatformTarget>x64</PlatformTarget>
44-
<LangVersion>7.3</LangVersion>
44+
<LangVersion>8.0</LangVersion>
4545
<ErrorReport>prompt</ErrorReport>
4646
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4747
<WarningLevel>4</WarningLevel>
@@ -80,10 +80,52 @@
8080
</ItemGroup>
8181

8282
<ItemGroup>
83+
<EmbeddedResource Update="Properties\Resources.ar.resx">
84+
<LastGenOutput>Resources.ar.Designer.cs</LastGenOutput>
85+
<Generator>PublicResXFileCodeGenerator</Generator>
86+
</EmbeddedResource>
87+
<EmbeddedResource Update="Properties\Resources.ko.resx">
88+
<LastGenOutput>Resources.ko.Designer.cs</LastGenOutput>
89+
<Generator>PublicResXFileCodeGenerator</Generator>
90+
</EmbeddedResource>
91+
<EmbeddedResource Update="Properties\Resources.sv.resx">
92+
<LastGenOutput>Resources.sv.Designer.cs</LastGenOutput>
93+
<Generator>PublicResXFileCodeGenerator</Generator>
94+
</EmbeddedResource>
95+
<EmbeddedResource Update="Properties\Resources.it.resx">
96+
<LastGenOutput>Resources.it.Designer.cs</LastGenOutput>
97+
<Generator>PublicResXFileCodeGenerator</Generator>
98+
</EmbeddedResource>
99+
<EmbeddedResource Update="Properties\Resources.ro.resx">
100+
<LastGenOutput>Resources.ro.Designer.cs</LastGenOutput>
101+
<Generator>PublicResXFileCodeGenerator</Generator>
102+
</EmbeddedResource>
103+
<EmbeddedResource Update="Properties\Resources.hi.resx">
104+
<LastGenOutput>Resources.hi.Designer.cs</LastGenOutput>
105+
<Generator>PublicResXFileCodeGenerator</Generator>
106+
</EmbeddedResource>
107+
<EmbeddedResource Update="Properties\Resources.ja.resx">
108+
<LastGenOutput>Resources.ja.Designer.cs</LastGenOutput>
109+
<Generator>PublicResXFileCodeGenerator</Generator>
110+
</EmbeddedResource>
111+
<EmbeddedResource Update="Properties\Resources.de.resx">
112+
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
113+
<Generator>PublicResXFileCodeGenerator</Generator>
114+
</EmbeddedResource>
115+
<EmbeddedResource Update="Properties\Resources.zh-cn.resx">
116+
<CustomToolNamespace>Community.PowerToys.Run.Plugin.Everything.Language</CustomToolNamespace>
117+
<LastGenOutput>Resources - Copy.zh.Designer.cs</LastGenOutput>
118+
<Generator>PublicResXFileCodeGenerator</Generator>
119+
</EmbeddedResource>
83120
<EmbeddedResource Update="Properties\Resources.resx">
84121
<Generator>PublicResXFileCodeGenerator</Generator>
85122
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
86123
</EmbeddedResource>
124+
<EmbeddedResource Update="Properties\Resources.zh.resx">
125+
<CustomToolNamespace>Community.PowerToys.Run.Plugin.Everything.Language</CustomToolNamespace>
126+
<LastGenOutput>Resources.zh.Designer.cs</LastGenOutput>
127+
<Generator>PublicResXFileCodeGenerator</Generator>
128+
</EmbeddedResource>
87129
</ItemGroup>
88130

89131
<ItemGroup>
@@ -101,6 +143,15 @@
101143
<Pack>True</Pack>
102144
<PackagePath>\</PackagePath>
103145
</None>
146+
<None Update="Images\file.png">
147+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
148+
</None>
149+
<None Update="Images\find.png">
150+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
151+
</None>
152+
<None Update="Images\folder.png">
153+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
154+
</None>
104155
<None Update="Images\NoIcon.png">
105156
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
106157
</None>
@@ -110,6 +161,9 @@
110161
<None Update="Images\Warning.light.png">
111162
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
112163
</None>
164+
<None Update="Images\warning.png">
165+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
166+
</None>
113167
<None Update="README.md">
114168
<Pack>True</Pack>
115169
<PackagePath>\</PackagePath>

Diff for: GlobalSuppressions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File should have header", Justification = "don't care")]
1515
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1516:Elements should be separated by blank line", Justification = "don't care")]
1616
[assembly: SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "don't care")]
17+
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "don't care")]

Diff for: Images/Everything.dark.png

560 Bytes
Loading

Diff for: Images/Everything.light.png

237 Bytes
Loading

Diff for: Images/NoIcon.png

-3.5 KB
Binary file not shown.

Diff for: Images/Warning.dark.png

-566 Bytes
Binary file not shown.

Diff for: Images/Warning.light.png

-580 Bytes
Binary file not shown.

Diff for: Images/file.png

290 Bytes
Loading

Diff for: Images/folder.png

468 Bytes
Loading

Diff for: Images/warning.png

738 Bytes
Loading

Diff for: Main.cs

+16-46
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ namespace Community.PowerToys.Run.Plugin.Everything
2424
{
2525
public class Main : IPlugin, IDisposable, IDelayedExecutionPlugin, IContextMenu, ISettingProvider, IPluginI18n
2626
{
27-
private const string Wait = nameof(Wait);
27+
private const string Legacy = nameof(Legacy);
2828
private const string Top = nameof(Top);
2929
private const string NoPreview = nameof(NoPreview);
3030
private readonly string reservedStringPattern = @"^[\/\\\$\%]+$|^.*[<>].*$";
3131
private bool top;
3232
private bool preview;
33+
private bool legacy;
3334

34-
public string Name => Resources.plugin_name + "-WIP";
35+
public string Name => Resources.plugin_name;
3536

3637
public string Description => Resources.plugin_description;
3738

@@ -49,27 +50,22 @@ public class Main : IPlugin, IDisposable, IDelayedExecutionPlugin, IContextMenu,
4950
DisplayLabel = Resources.Preview,
5051
Value = false,
5152
},
53+
new PluginAdditionalOption()
54+
{
55+
Key = Legacy,
56+
DisplayLabel = "Legacy Icon Logic",
57+
Value = false,
58+
},
5259
};
5360

5461
private IContextMenu contextMenuLoader;
5562
private PluginInitContext context;
5663
private bool disposed;
57-
private static string warningIconPath;
58-
59-
internal static string WarningIcon
60-
{
61-
get
62-
{
63-
return warningIconPath;
64-
}
65-
}
6664

6765
public void Init(PluginInitContext context)
6866
{
6967
this.context = context;
7068
this.contextMenuLoader = new ContextMenuLoader(context);
71-
this.context.API.ThemeChanged += this.OnThemeChanged;
72-
UpdateIconPath(this.context.API.GetCurrentTheme());
7369
EverythingSetup();
7470
}
7571

@@ -79,8 +75,6 @@ public List<Result> Query(Query query)
7975
return results;
8076
}
8177

82-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "We want to keep the process alive but will log the exception")]
83-
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1062:Validate arguments of public methods", Justification = "Already validated")]
8478
public List<Result> Query(Query query, bool delayedExecution)
8579
{
8680
List<Result> results = new List<Result>();
@@ -94,25 +88,15 @@ public List<Result> Query(Query query, bool delayedExecution)
9488
{
9589
try
9690
{
97-
results.AddRange(EverythingSearch(searchQuery, this.top, this.preview));
98-
}
99-
catch (OperationCanceledException)
100-
{
101-
results.Add(new Result()
102-
{
103-
Title = Resources.timeout,
104-
SubTitle = Resources.enable_wait,
105-
IcoPath = warningIconPath,
106-
Score = int.MaxValue,
107-
});
91+
results.AddRange(EverythingSearch(searchQuery, this.top, this.preview, this.legacy));
10892
}
10993
catch (System.ComponentModel.Win32Exception)
11094
{
11195
results.Add(new Result()
11296
{
11397
Title = Resources.Everything_not_running,
11498
SubTitle = Resources.Everything_ini,
115-
IcoPath = warningIconPath,
99+
IcoPath = "Images/warning.png",
116100
QueryTextDisplay = '.' + Resources.plugin_name,
117101
Score = int.MaxValue,
118102
});
@@ -127,23 +111,6 @@ public List<Result> Query(Query query, bool delayedExecution)
127111
return results;
128112
}
129113

130-
private void OnThemeChanged(Theme oldtheme, Theme newTheme)
131-
{
132-
UpdateIconPath(newTheme);
133-
}
134-
135-
private static void UpdateIconPath(Theme theme)
136-
{
137-
if (theme == Theme.Light || theme == Theme.HighContrastWhite)
138-
{
139-
warningIconPath = "Images/Warning.light.png";
140-
}
141-
else
142-
{
143-
warningIconPath = "Images/Warning.dark.png";
144-
}
145-
}
146-
147114
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
148115
{
149116
return this.contextMenuLoader.LoadContextMenus(selectedResult);
@@ -158,14 +125,17 @@ public void UpdateSettings(PowerLauncherPluginSettings settings)
158125
{
159126
var top = false;
160127
var nopreview = false;
128+
var leg = false;
161129
if (settings != null && settings.AdditionalOptions != null)
162130
{
163131
top = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Top)?.Value ?? false;
164132
nopreview = settings.AdditionalOptions.FirstOrDefault(x => x.Key == NoPreview)?.Value ?? false;
133+
leg = settings.AdditionalOptions.FirstOrDefault(x => x.Key == Legacy)?.Value ?? false;
165134
}
166135

167136
this.top = top;
168137
this.preview = nopreview;
138+
this.legacy = leg;
169139
}
170140

171141
protected virtual void Dispose(bool disposing)
@@ -189,12 +159,12 @@ public void Dispose()
189159

190160
public string GetTranslatedPluginTitle()
191161
{
192-
throw new NotImplementedException();
162+
return Resources.plugin_name;
193163
}
194164

195165
public string GetTranslatedPluginDescription()
196166
{
197-
throw new NotImplementedException();
167+
return Resources.plugin_description;
198168
}
199169
}
200170
}

0 commit comments

Comments
 (0)