From 105c08077e5a019302ec2f7403048bc9cfae6276 Mon Sep 17 00:00:00 2001 From: xWTF Date: Wed, 2 Nov 2022 21:59:23 +0800 Subject: [PATCH 1/3] Construct fake hostname for serial port session --- Flow.Launcher.Plugin.Putty/PuttySessionService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Plugin.Putty/PuttySessionService.cs b/Flow.Launcher.Plugin.Putty/PuttySessionService.cs index 4994ac2..feedff9 100644 --- a/Flow.Launcher.Plugin.Putty/PuttySessionService.cs +++ b/Flow.Launcher.Plugin.Putty/PuttySessionService.cs @@ -31,13 +31,19 @@ public IEnumerable GetAll() } try { - results.Add(new PuttySession + var session = new PuttySession { Identifier = Uri.UnescapeDataString(subKey), Protocol = puttySessionSubKey.GetValue("Protocol").ToString(), Username = puttySessionSubKey.GetValue("UserName").ToString(), Hostname = puttySessionSubKey.GetValue("HostName").ToString(), - }); + }; + if (session.Protocol == "serial") + { + session.Hostname = $"{puttySessionSubKey.GetValue("SerialLine")}?baud={puttySessionSubKey.GetValue("SerialSpeed")}"; + session.Username = string.Empty; // ensure ToString doesn't append username + } + results.Add(session); } catch (Exception) { From c20cd96bdd30b4d6aa19c0adf84f05bf7eee5262 Mon Sep 17 00:00:00 2001 From: xWTF Date: Wed, 2 Nov 2022 22:00:09 +0800 Subject: [PATCH 2/3] Use ArgumentList to add args cleanly, fix identifier check --- Flow.Launcher.Plugin.Putty/Plugin.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher.Plugin.Putty/Plugin.cs b/Flow.Launcher.Plugin.Putty/Plugin.cs index d3582ba..2544de0 100644 --- a/Flow.Launcher.Plugin.Putty/Plugin.cs +++ b/Flow.Launcher.Plugin.Putty/Plugin.cs @@ -200,13 +200,15 @@ private bool LaunchPuttySession(string session, PuttySession puttySession = null var p = new Process { StartInfo = { FileName = puttyPath } }; - if (!string.IsNullOrEmpty(puttySession?.Hostname)) + if (!string.IsNullOrEmpty(puttySession?.Identifier)) { - p.StartInfo.Arguments = "-load \"" + puttySession.Identifier + "\""; + p.StartInfo.ArgumentList.Add("-load"); + p.StartInfo.ArgumentList.Add(puttySession.Identifier); } else if (!string.IsNullOrEmpty(session)) { - p.StartInfo.Arguments = "-ssh \"" + session + "\""; + p.StartInfo.ArgumentList.Add("-ssh"); + p.StartInfo.ArgumentList.Add(session); } if (settings.AlwaysStartsSessionMaximized) From 6dbdd2a4f324242822ef3c555c50c0a306c68a32 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 3 Nov 2022 08:45:11 +1100 Subject: [PATCH 3/3] version bump --- Flow.Launcher.Plugin.Putty/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Plugin.Putty/plugin.json b/Flow.Launcher.Plugin.Putty/plugin.json index 83e77d0..e96d659 100644 --- a/Flow.Launcher.Plugin.Putty/plugin.json +++ b/Flow.Launcher.Plugin.Putty/plugin.json @@ -4,7 +4,7 @@ "Name": "Putty", "Description": "Launch Putty Sessions", "Author":"Konstantin Zaitcev, Kai Eichinger (@cH40zLord)", - "Version":"2.1.3", + "Version":"2.2.0", "Language": "csharp", "Website": "https://github.com/jjw24/Flow.Launcher.Plugin.Putty", "ExecuteFileName": "Flow.Launcher.Plugin.Putty.dll",