mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +01:00
Add search to plugin installer
Partial match for plugin names Full match for plugin author name
This commit is contained in:
parent
86c4b14d9d
commit
1e1166b607
1 changed files with 11 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ namespace Dalamud.Plugin
|
|||
private int updatePluginCount = 0;
|
||||
private List<PluginRepository.PluginUpdateStatus> updatedPlugins;
|
||||
|
||||
private string searchText = "";
|
||||
|
||||
private enum PluginInstallStatus {
|
||||
None,
|
||||
InProgress,
|
||||
|
|
@ -55,6 +57,8 @@ namespace Dalamud.Plugin
|
|||
ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoScrollbar);
|
||||
|
||||
ImGui.Text(Loc.Localize("InstallerHint", "This window allows you install and remove in-game plugins.\nThey are made by third-party developers."));
|
||||
ImGui.SameLine();
|
||||
ImGui.InputText("###XPlPluginInstaller_Search", ref this.searchText, 100);
|
||||
ImGui.Separator();
|
||||
|
||||
ImGui.BeginChild("scrolling", new Vector2(0, 400), true, ImGuiWindowFlags.HorizontalScrollbar);
|
||||
|
|
@ -68,6 +72,7 @@ namespace Dalamud.Plugin
|
|||
}
|
||||
else {
|
||||
var didAny = false;
|
||||
var hasSearchString = !string.IsNullOrWhiteSpace(this.searchText);
|
||||
|
||||
foreach (var pluginDefinition in this.dalamud.PluginRepository.PluginMaster) {
|
||||
if (pluginDefinition.ApplicableVersion != this.gameVersion &&
|
||||
|
|
@ -80,6 +85,12 @@ namespace Dalamud.Plugin
|
|||
if (pluginDefinition.DalamudApiLevel != PluginManager.DALAMUD_API_LEVEL)
|
||||
continue;
|
||||
|
||||
if (hasSearchString &&
|
||||
!(pluginDefinition.Name.ToLowerInvariant().Contains(this.searchText.ToLowerInvariant()) ||
|
||||
string.Equals(pluginDefinition.Author, this.searchText, StringComparison.InvariantCultureIgnoreCase))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
didAny = true;
|
||||
|
||||
ImGui.PushID(pluginDefinition.InternalName + pluginDefinition.AssemblyVersion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue