Skip to content

Commit

Permalink
Merge pull request #11 from anthony81799/results
Browse files Browse the repository at this point in the history
Optimize results.
  • Loading branch information
anthony81799 authored Jul 15, 2024
2 parents 0b4a0b5 + f9a9c48 commit e2f9045
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions RDP/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@ public List<Result> Query(Query query)
_rdpConnections.Reload(GetRdpConnectionsFromRegistry());

var connections = _rdpConnections.FindConnections(query.Search);

var results = new[] { CreateDefaultResult() }
.Concat(_predefinedConnections.FindConnections(query.Search).Select(MapToResult))
.Concat(connections.Select(MapToResult))
var predefinedConnections = _predefinedConnections.FindConnections(query.Search);
var results = Array.Empty<Result>()
.Union(predefinedConnections.Select(MapToResult))
.Union(connections.Select(MapToResult))
.ToList();

if (results.Count == 0) {
results.Add(CreateDefaultResult());
} else if (query.Search.Length == 0) {
results.Insert(0, CreateDefaultResult());
}
return results;
}

Expand Down
2 changes: 1 addition & 1 deletion RDP/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"IsGlobal": false,
"Name": "RDP",
"Author": "anthony81799",
"Version": "1.0.4",
"Version": "1.0.5",
"Language": "csharp",
"Website": "https://github.com/anthony81799/PowerToysRun-RDP",
"ExecuteFileName": "Community.PowerToys.Run.Plugin.RDP.dll",
Expand Down

0 comments on commit e2f9045

Please sign in to comment.