RonnyJJ / superputty

Automatically exported from code.google.com/p/superputty
MIT License
0 stars 0 forks source link

Support for "-wt" (window title) argument for GNS3 #456

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
GNS3 sends the -wt argument to PuTTY to name the console windows with the 
device hostname instead of the full executed command line.  The change can be 
made to ctlPuttyPanel.cs as shown below.

public override string Text
        {
            get
            {
                return base.Text;
            }
            set
            {
+                //127.0.0.1 -P 2101 -wt R1 -gns3 5 -skin 4
+                int iLoc = value.IndexOf("-wt ", 
StringComparison.CurrentCultureIgnoreCase);
+                if (iLoc >= 0)
+                {
+                    iLoc = iLoc + 4;
+                    int iLocEnd = value.IndexOf(" ", iLoc, 
StringComparison.CurrentCultureIgnoreCase);
+                    if (iLocEnd < 0)
+                        iLocEnd = value.Length;
+                    string sNewTitle = value.Substring(iLoc, iLocEnd - iLoc);
+                    this.TabText = sNewTitle;
+                    base.Text = sNewTitle;
+                }
+                else
+                {
                    this.TabText = value != null ? value.Replace("&", "&&") : value;
                    base.Text = value;
+                }

Thanks,
Helder.

Original issue reported on code.google.com by hld...@gmail.com on 25 Aug 2014 at 6:20