Пример #1
0
 void FavsTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         FavsTree.SelectedNode = e.Node;
     }
     if (FavsTree.SelectedNode != null)
     {
         FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);
         if (e.Button == MouseButtons.Right)
         {
             FavsTree.SelectedNode = e.Node;
         }
         pingToolStripMenuItem.Visible       = true;
         dNSToolStripMenuItem.Visible        = true;
         traceRouteToolStripMenuItem.Visible = true;
         tSAdminToolStripMenuItem.Visible    = true;
         propertiesToolStripMenuItem.Visible = true;
         rebootToolStripMenuItem.Visible     = true;
         shutdownToolStripMenuItem.Visible   = true;
         enableRDPToolStripMenuItem.Visible  = true;
         if (fav == null)
         {
             pingToolStripMenuItem.Visible       = false;
             dNSToolStripMenuItem.Visible        = false;
             traceRouteToolStripMenuItem.Visible = false;
             tSAdminToolStripMenuItem.Visible    = false;
             propertiesToolStripMenuItem.Visible = false;
             rebootToolStripMenuItem.Visible     = false;
             shutdownToolStripMenuItem.Visible   = false;
             enableRDPToolStripMenuItem.Visible  = false;
         }
     }
 }
        private void AddAllButton_Click(object sender, EventArgs e)
        {
            int count = 0;

            foreach (ListViewItem lvi in this.ScanResultsListView.Items)
            {
                Terminals.Scanner.NetworkScanItem item = (Terminals.Scanner.NetworkScanItem)lvi.Tag;
                FavoriteConfigurationElement      fav  = new FavoriteConfigurationElement();
                fav.ServerName = item.IPAddress;
                fav.Port       = item.Port;
                fav.Protocol   = Connections.ConnectionManager.GetPortName(fav.Port, item.IsVMRC);
                string tags = TagsTextbox.Text;
                tags = tags.Replace("Tags...", "").Trim();
                if (tags != string.Empty)
                {
                    fav.Tags = tags;
                }
                if (fav.Protocol == "SSH")
                {
                    fav.Protocol = "Telnet";
                    fav.Telnet   = false;
                    fav.Name     = string.Format("{0}_{1}", item.HostName, "SSH");
                }
                else
                {
                    fav.Name = string.Format("{0}_{1}", item.HostName, fav.Protocol);
                }
                fav.DomainName = System.Environment.UserDomainName;
                fav.UserName   = System.Environment.UserName;
                Settings.AddFavorite(fav, false);
                count++;
            }
            MessageBox.Show(string.Format("{0} items were added to your favorites.", count));
        }
Пример #3
0
        private void enableRDPToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                Microsoft.Win32.RegistryKey reg = Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, fav.ServerName);
                Microsoft.Win32.RegistryKey ts  = reg.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\Terminal Server", true);
                object deny = ts.GetValue("fDenyTSConnections");
                if (deny != null)
                {
                    int d = Convert.ToInt32(deny);
                    if (d == 1)
                    {
                        ts.SetValue("fDenyTSConnections", 0);
                        if (System.Windows.Forms.MessageBox.Show("Terminals was able to enable the RDP on the remote machine, would you like to reboot that machine for the change to take effect?", "Reboot Required", MessageBoxButtons.YesNo) == DialogResult.OK)
                        {
                            rebootToolStripMenuItem_Click(null, null);
                        }
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show("Terminals did not need to enable RDP because it was already set.");
                    }
                    return;
                }
            }
            System.Windows.Forms.MessageBox.Show("Terminals was not able to enable RDP remotely.");
        }
        private void LoadConnections()
        {
            lvConnections.BeginUpdate();
            try
            {
                lvConnections.Items.Clear();
                //FavoriteConfigurationElementCollection favorites = Settings.GetFavorites();
                SortedDictionary <string, FavoriteConfigurationElement> favorites = Settings.GetSortedFavorites(Settings.DefaultSortProperty);
                foreach (string key in favorites.Keys)
                {
                    FavoriteConfigurationElement favorite = favorites[key];
                    lvConnections.ShowItemToolTips = true;
                    ListViewItem item = lvConnections.Items.Add(favorite.Name);
                    item.ToolTipText = favorite.Notes;

                    item.Name = favorite.Name;
                    item.SubItems.Add(favorite.Protocol);
                    item.SubItems.Add(favorite.ServerName);
                    item.SubItems.Add(favorite.DomainName);
                    item.SubItems.Add(favorite.UserName);
                    item.SubItems.Add(favorite.Tags);
                    item.SubItems.Add(favorite.Notes);
                    item.Tag = favorite;
                }
            }
            finally
            {
                lvConnections.EndUpdate();
            }
            lvConnections.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }
 public void Remove(FavoriteConfigurationElement item)
 {
     if (BaseIndexOf(item) >= 0)
     {
         BaseRemove(item.Name);
     }
 }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement favorite = GetSelectedFavorite();

            if (favorite != null)
            {
                EditFavorite(favorite);
            }
        }
Пример #7
0
 public NewTerminalForm(FavoriteConfigurationElement favorite)
 {
     InitializeComponent();
     LoadMRUs();
     SetOkTitle(false);
     this.Text = "Edit Connection";
     FillControls(favorite);
     SetOkButtonState();
 }
 public NewTerminalForm(FavoriteConfigurationElement favorite)
 {
     InitializeComponent();
     LoadMRUs();
     SetOkTitle(false);
     this.Text = "Edit Connection";
     FillControls(favorite);
     SetOkButtonState();
 }
Пример #9
0
        private void propertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                MainForm.ShowManageTerminalForm(fav);
            }
        }
Пример #10
0
        private void FavsTree_DoubleClick(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                MainForm.Connect(fav.Name, false, false);
            }
        }
Пример #11
0
        private void computerManagementMMCToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                System.Diagnostics.Process.Start("mmc.exe", "compmgmt.msc /a /computer=" + fav.ServerName);
            }
        }
Пример #12
0
        private void connectConsoleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                MainForm.Connect(fav.Name, true, false);
            }
        }
Пример #13
0
        private void tSAdminToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                MainForm.OpenNetworkingTools("TSAdmin", fav.ServerName);
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in lvConnections.SelectedItems)
     {
         FavoriteConfigurationElement favorite = (item.Tag as FavoriteConfigurationElement);
         if (favorite != null)
         {
             Settings.DeleteFavorite(favorite.Name);
             Settings.DeleteFavoriteButton(favorite.Name);
         }
     }
     LoadConnections();
 }
        private void btnCopy_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement favorite = GetSelectedFavorite();

            if (favorite != null)
            {
                string oldName = favorite.Name;
                favorite.Name = GetUniqeName(favorite.Name);
                Settings.DeleteFavorite(favorite.Name);
                Settings.AddFavorite(favorite, Settings.HasToolbarButton(oldName));
                LoadConnections();
            }
        }
Пример #16
0
        public static void EditFavorite(string oldName, FavoriteConfigurationElement favorite)
        {
            Configuration configuration                  = GetConfiguration();
            TerminalsConfigurationSection section        = GetSection(configuration);
            FavoriteConfigurationElement  editedFavorite = section.Favorites[oldName];

            editedFavorite.VMRCAdministratorMode = favorite.VMRCAdministratorMode;
            editedFavorite.VMRCReducedColorsMode = favorite.VMRCReducedColorsMode;
            editedFavorite.Telnet            = favorite.Telnet;
            editedFavorite.TelnetRows        = favorite.TelnetRows;
            editedFavorite.TelnetCols        = favorite.TelnetCols;
            editedFavorite.TelnetFont        = favorite.TelnetFont;
            editedFavorite.TelnetCursorColor = favorite.TelnetCursorColor;
            editedFavorite.TelnetTextColor   = favorite.TelnetTextColor;
            editedFavorite.TelnetBackColor   = favorite.TelnetBackColor;
            editedFavorite.Protocol          = favorite.Protocol;
            editedFavorite.Colors            = favorite.Colors;
            editedFavorite.ConnectToConsole  = favorite.ConnectToConsole;
            editedFavorite.DesktopSize       = favorite.DesktopSize;
            editedFavorite.DomainName        = favorite.DomainName;
            editedFavorite.EncryptedPassword = favorite.EncryptedPassword;
            editedFavorite.Name                                 = favorite.Name;
            editedFavorite.ServerName                           = favorite.ServerName;
            editedFavorite.UserName                             = favorite.UserName;
            editedFavorite.RedirectDrives                       = favorite.RedirectDrives;
            editedFavorite.RedirectPorts                        = favorite.RedirectPorts;
            editedFavorite.RedirectPrinters                     = favorite.RedirectPrinters;
            editedFavorite.RedirectDevices                      = favorite.RedirectDevices;
            editedFavorite.RedirectClipboard                    = favorite.RedirectClipboard;
            editedFavorite.RedirectSmartCards                   = favorite.RedirectSmartCards;
            editedFavorite.Sounds                               = favorite.Sounds;
            editedFavorite.Port                                 = favorite.Port;
            editedFavorite.DesktopShare                         = favorite.DesktopShare;
            editedFavorite.ExecuteBeforeConnect                 = favorite.ExecuteBeforeConnect;
            editedFavorite.ExecuteBeforeConnectCommand          = favorite.ExecuteBeforeConnectCommand;
            editedFavorite.ExecuteBeforeConnectArgs             = favorite.ExecuteBeforeConnectArgs;
            editedFavorite.ExecuteBeforeConnectInitialDirectory = favorite.ExecuteBeforeConnectInitialDirectory;
            editedFavorite.ExecuteBeforeConnectWaitForExit      = favorite.ExecuteBeforeConnectWaitForExit;
            editedFavorite.DisableWallPaper                     = favorite.DisableWallPaper;

            editedFavorite.DisableCursorBlinking = favorite.DisableCursorBlinking;
            editedFavorite.DisableCursorShadow   = favorite.DisableCursorShadow;
            editedFavorite.DisableFullWindowDrag = favorite.DisableFullWindowDrag;
            editedFavorite.DisableMenuAnimations = favorite.DisableMenuAnimations;
            editedFavorite.DisableTheming        = favorite.DisableTheming;


            editedFavorite.Tags = favorite.Tags;
            configuration.Save();
        }
        private void EditFavorite(FavoriteConfigurationElement favorite)
        {
            NewTerminalForm frmNewTerminal = new NewTerminalForm(favorite);
            string          oldName        = favorite.Name;

            if (frmNewTerminal.ShowDialog() == DialogResult.OK)
            {
                if (oldName != frmNewTerminal.favorite.Name)
                {
                    Settings.DeleteFavorite(oldName);
                }
                LoadConnections();
            }
        }
Пример #18
0
        private void systemInformationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                string programFiles = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
                //if(programFiles.Contains("(x86)")) programFiles = programFiles.Replace(" (x86)","");
                string path = string.Format(@"{0}\common files\Microsoft Shared\MSInfo\msinfo32.exe", programFiles);
                if (System.IO.File.Exists(path))
                {
                    System.Diagnostics.Process.Start(string.Format("\"{0}\"", path), string.Format("/computer={0}", fav.ServerName));
                }
            }
        }
Пример #19
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            SaveMRUs();
            string name = txtName.Text;

            if (name == String.Empty)
            {
                name = cmbServers.Text;
            }
            favorite      = new FavoriteConfigurationElement();
            favorite.Name = name;
            if (FillFavorite())
            {
                DialogResult = DialogResult.OK;
            }
        }
Пример #20
0
        private void shutdownToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);

            if (fav != null)
            {
                if (MessageBox.Show("Are you sure you want to shutdown this machine: " + fav.ServerName, "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (NetTools.MagicPacket.ForceReboot(fav.ServerName, NetTools.MagicPacket.ShutdownStyles.ForcedShutdown) == 0)
                    {
                        MessageBox.Show("Terminals successfully sent the shutdown command.");
                        return;
                    }
                }
            }
            System.Windows.Forms.MessageBox.Show("Terminals was not able to shutdown the machine remotely.");
        }
Пример #21
0
        public void LoadFavs()
        {
            FavsTree.Nodes.Clear();

            SortedDictionary <string, FavoriteConfigurationElement> favorites = Settings.GetSortedFavorites(Settings.DefaultSortProperty);
            SortedDictionary <string, TreeNode> SortedTags = new SortedDictionary <string, TreeNode>();

            SortedTags.Add(UntaggedKey, new TreeNode(UntaggedKey));
            FavsTree.Nodes.Add(SortedTags[UntaggedKey]);
            if (favorites != null)
            {
                foreach (string key in favorites.Keys)
                {
                    FavoriteConfigurationElement fav = favorites[key];
                    if (fav.TagList.Count > 0)
                    {
                        foreach (string tag in fav.TagList)
                        {
                            TreeNode FavNode = new TreeNode(fav.Name);
                            FavNode.Tag = fav;
                            if (!SortedTags.ContainsKey(tag))
                            {
                                TreeNode tagNode = new TreeNode(tag);
                                FavsTree.Nodes.Add(tagNode);
                                SortedTags.Add(tag, tagNode);
                            }
                            if (!SortedTags[tag].Nodes.Contains(FavNode))
                            {
                                SortedTags[tag].Nodes.Add(FavNode);
                            }
                        }
                    }
                    else
                    {
                        TreeNode FavNode = new TreeNode(fav.Name);
                        FavNode.Tag = fav;

                        if (!SortedTags[UntaggedKey].Nodes.Contains(FavNode))
                        {
                            SortedTags[UntaggedKey].Nodes.Add(FavNode);
                        }
                    }
                }
            }
        }
Пример #22
0
        public static void EditFavorite(string oldName, FavoriteConfigurationElement favorite, bool showOnToolbar)
        {
            EditFavorite(oldName, favorite);
            bool shownOnToolbar = HasToolbarButton(oldName);

            if (shownOnToolbar && !showOnToolbar)
            {
                DeleteFavoriteButton(oldName);
            }
            else if (shownOnToolbar && (oldName != favorite.Name))
            {
                EditFavoriteButton(oldName, favorite.Name);
            }
            else if (!shownOnToolbar && showOnToolbar)
            {
                AddFavoriteButton(favorite.Name);
            }
        }
        private void lvConnections_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            ListViewItem item = lvConnections.Items[e.Item];

            if (!String.IsNullOrEmpty(e.Label) && e.Label != item.Text)
            {
                if (lvConnections.Items.ContainsKey(e.Label))
                {
                    e.CancelEdit = true;
                    MessageBox.Show(this, "A connection named " + e.Label + " already exists", "Terminals", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                FavoriteConfigurationElement favorite = (FavoriteConfigurationElement)item.Tag;
                string oldName = favorite.Name;
                favorite.Name = e.Label;
                item.Name     = e.Label;
                //Settings.DeleteFavorite(favorite.Name);
                //Settings.AddFavorite(favorite);
                Settings.EditFavorite(oldName, favorite);
            }
        }
Пример #24
0
 private void Connect(TreeNode SelectedNode, bool AllChildren, bool Console, bool NewWindow)
 {
     if (AllChildren)
     {
         foreach (TreeNode node in SelectedNode.Nodes)
         {
             FavoriteConfigurationElement fav = (node.Tag as FavoriteConfigurationElement);
             if (fav != null)
             {
                 MainForm.Connect(fav.Name, Console, NewWindow);
             }
         }
     }
     else
     {
         FavoriteConfigurationElement fav = (FavsTree.SelectedNode.Tag as FavoriteConfigurationElement);
         if (fav != null)
         {
             MainForm.Connect(fav.Name, Console, NewWindow);
         }
     }
 }
        void Client_OnServerConnection(System.IO.MemoryStream Response)
        {
            if (Response.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("The server has nothing to share with you.");
            }
            else
            {
                int count = 0;
                System.Collections.ArrayList favs = (System.Collections.ArrayList)Unified.Serialize.DeSerializeBinary(Response);
                foreach (object fav in favs)
                {
                    FavoriteConfigurationElement newfav = Network.SharedFavorite.ConvertFromFavorite((Network.SharedFavorite)fav);
                    newfav.Name       = newfav.Name + "_new";
                    newfav.UserName   = System.Environment.UserName;
                    newfav.DomainName = System.Environment.UserDomainName;
                    Settings.AddFavorite(newfav, false);
                    count++;
                }

                System.Windows.Forms.MessageBox.Show(string.Format("Successfully imported {0} connections.", count));
            }
        }
Пример #26
0
        public static void AddFavorite(FavoriteConfigurationElement favorite, bool showOnToolbar)
        {
            Configuration configuration = GetConfiguration();

            GetSection(configuration).Favorites.Add(favorite);
            configuration.Save();
            if (showOnToolbar)
            {
                AddFavoriteButton(favorite.Name);
            }
            else
            {
                DeleteFavoriteButton(favorite.Name);
            }

            if (favorite.Tags != null && favorite.Tags.Trim() != "")
            {
                foreach (string tag in favorite.TagList)
                {
                    AddTag(tag);
                }
            }
        }
Пример #27
0
        private void CreateTerminalTab(FavoriteConfigurationElement favorite)
        {
            if(Settings.ExecuteBeforeConnect)
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo(Settings.ExecuteBeforeConnectCommand,
                    Settings.ExecuteBeforeConnectArgs);
                processStartInfo.WorkingDirectory = Settings.ExecuteBeforeConnectInitialDirectory;
                Process process = Process.Start(processStartInfo);
                if(Settings.ExecuteBeforeConnectWaitForExit)
                {
                    process.WaitForExit();
                }
            }

            if(favorite.ExecuteBeforeConnect)
            {
                ProcessStartInfo processStartInfo = new ProcessStartInfo(favorite.ExecuteBeforeConnectCommand,
                    favorite.ExecuteBeforeConnectArgs);
                processStartInfo.WorkingDirectory = favorite.ExecuteBeforeConnectInitialDirectory;
                Process process = Process.Start(processStartInfo);
                if(favorite.ExecuteBeforeConnectWaitForExit)
                {
                    process.WaitForExit();
                }
            }

            string terminalTabTitle = favorite.Name;
            if(Settings.ShowUserNameInTitle)
            {
                terminalTabTitle += " (" + Functions.UserDisplayName(favorite.DomainName, favorite.UserName) + ")";
            }
            TerminalTabControlItem terminalTabPage = new TerminalTabControlItem(terminalTabTitle);
            try
            {
                terminalTabPage.AllowDrop = true;
                terminalTabPage.DragOver += terminalTabPage_DragOver;
                terminalTabPage.DragEnter += new DragEventHandler(terminalTabPage_DragEnter);
                this.Resize += new EventHandler(MainForm_Resize);
                terminalTabPage.ToolTipText = GetToolTipText(favorite);
                terminalTabPage.Favorite = favorite;
                terminalTabPage.DoubleClick += new EventHandler(terminalTabPage_DoubleClick);
                tcTerminals.Items.Add(terminalTabPage);
                tcTerminals.SelectedItem = terminalTabPage;
                tcTerminals_SelectedIndexChanged(this, EventArgs.Empty);
                Connections.IConnection conn = Connections.ConnectionManager.CreateConnection(favorite, terminalTabPage, this);
                if(conn.Connect())
                {
                    (conn as Control).BringToFront();
                    (conn as Control).Update();
                    UpdateControls();
                    if(favorite.DesktopSize == DesktopSize.FullScreen)
                        FullScreen = true;

                    Terminals.Connections.Connection b = (conn as Terminals.Connections.Connection);
                    b.OnTerminalServerStateDiscovery += new Terminals.Connections.Connection.TerminalServerStateDiscovery(b_OnTerminalServerStateDiscovery);
                    b.CheckForTerminalServer(favorite);

                }
                else
                {
                    string msg = "Sorry, Terminals was unable to connect to the remote machine.  Try again, or check the log for more information.";
                    System.Windows.Forms.MessageBox.Show(msg);
                    tcTerminals.Items.Remove(terminalTabPage);
                    tcTerminals.SelectedItem = null;
                }

                if(conn.Connected) {
                    if(favorite.NewWindow) {
                        OpenConnectionInNewWindow(conn);
                    }
                }
            }
            catch(Exception exc)
            {
                Terminals.Logging.Log.Info("", exc);
                tcTerminals.SelectedItem = null;
                //tcTerminals = null;
                System.Windows.Forms.MessageBox.Show(exc.Message);
            }
        }
Пример #28
0
        private TerminalTabControlItem AssignEventsToConnectionTab(FavoriteConfigurationElement favorite)
        {
        	Log.InsideMethod();
        	
            TerminalTabControlItem terminalTabPage = ConnectionManager.CreateTerminalTabPageByFavoriteName(favorite);

            // This might happen if the user is not allowed to
            // use all available connections e.g. 
            // if the user has a freeware version.
            if (terminalTabPage == null)
            {
                return null;
            }

            terminalTabPage.AllowDrop = true;
            terminalTabPage.DragOver += this.terminalTabPage_DragOver;
            terminalTabPage.DragEnter += this.terminalTabPage_DragEnter;
            //terminalTabPage.ToolTipText = favorite.GetToolTipText();
            terminalTabPage.Favorite = favorite;
            terminalTabPage.DoubleClick += this.TerminalTabPage_DoubleClick;
            this.terminalsControler.AddAndSelect(terminalTabPage);
            this.UpdateControls();

            return terminalTabPage;
        }
 public void Add(FavoriteConfigurationElement item)
 {
     BaseAdd(item);
 }
 public void Ssh_SaveDefaultFavorite_IsSaved()
 {
     var favorite = new FavoriteConfigurationElement();
     favorite.Protocol = ConnectionManager.SSH; // avoid all default values
     settings.SaveDefaultFavorite(favorite);
     settings.ForceReload();
     var loaded = settings.GetDefaultFavorite();
     const string MESSAGE = "Newly saved default favorite has return last saved value.";
     Assert.AreEqual(ConnectionManager.SSH, loaded.Protocol, MESSAGE);
 }
 public object Clone()
 {
     FavoriteConfigurationElement fav = new FavoriteConfigurationElement
                                            {
                                                AcceleratorPassthrough = this.AcceleratorPassthrough,
                                                AllowBackgroundInput = this.AllowBackgroundInput,
                                                AuthMethod = this.AuthMethod,
                                                BitmapPeristence = this.BitmapPeristence,
                                                Colors = this.Colors,
                                                ConnectionTimeout = this.ConnectionTimeout,
                                                ConnectToConsole = this.ConnectToConsole,
                                                ConsoleBackColor = this.ConsoleBackColor,
                                                ConsoleCols = this.ConsoleCols,
                                                ConsoleCursorColor = this.ConsoleCursorColor,
                                                ConsoleFont = this.ConsoleFont,
                                                ConsoleRows = this.ConsoleRows,
                                                ConsoleTextColor = this.ConsoleTextColor,
                                                Credential = this.Credential,
                                                DesktopShare = this.DesktopShare,
                                                DesktopSize = this.DesktopSize,
                                                DesktopSizeHeight = this.DesktopSizeHeight,
                                                DesktopSizeWidth = this.DesktopSizeWidth,
                                                DisableControlAltDelete = this.DisableControlAltDelete,
                                                DisableCursorBlinking = this.DisableCursorBlinking,
                                                DisableCursorShadow = this.DisableCursorShadow,
                                                DisableFullWindowDrag = this.DisableFullWindowDrag,
                                                DisableMenuAnimations = this.DisableMenuAnimations,
                                                DisableTheming = this.DisableTheming,
                                                DisableWallPaper = this.DisableWallPaper,
                                                DisableWindowsKey = this.DisableWindowsKey,
                                                DisplayConnectionBar = this.DisplayConnectionBar,
                                                DomainName = this.DomainName,
                                                DoubleClickDetect = this.DoubleClickDetect,
                                                EnableCompression = this.EnableCompression,
                                                EnableDesktopComposition = this.EnableDesktopComposition,
                                                EnableEncryption = this.EnableCompression,
                                                EnableFontSmoothing = this.EnableFontSmoothing,
                                                EnableSecuritySettings = this.EnableSecuritySettings,
                                                EnableTLSAuthentication = this.EnableTLSAuthentication,
                                                EnableNLAAuthentication = this.EnableNLAAuthentication,
                                                EncryptedPassword = this.EncryptedPassword,
                                                ExecuteBeforeConnect = this.ExecuteBeforeConnect,
                                                ExecuteBeforeConnectArgs = this.ExecuteBeforeConnectArgs,
                                                ExecuteBeforeConnectCommand = this.ExecuteBeforeConnectCommand,
                                                ExecuteBeforeConnectInitialDirectory = this.ExecuteBeforeConnectInitialDirectory,
                                                ExecuteBeforeConnectWaitForExit = this.ExecuteBeforeConnectWaitForExit,
                                                GrabFocusOnConnect = this.GrabFocusOnConnect,
                                                ICAApplicationName = this.ICAApplicationName,
                                                ICAApplicationWorkingFolder = this.ICAApplicationWorkingFolder,
                                                ICAApplicationPath = this.ICAApplicationPath,
                                                IcaClientINI = this.IcaClientINI,
                                                IcaEnableEncryption = this.IcaEnableEncryption,
                                                IcaEncryptionLevel = this.IcaEncryptionLevel,
                                                IcaServerINI = this.IcaServerINI,
                                                IdleTimeout = this.IdleTimeout,
                                                KeyTag = this.KeyTag,
                                                Name = this.Name,
                                                NewWindow = this.NewWindow,
                                                Notes = this.Notes,
                                                OverallTimeout = this.OverallTimeout,
                                                Port = this.Port,
                                                Protocol = this.Protocol,
                                                RedirectClipboard = this.RedirectClipboard,
                                                RedirectDevices = this.RedirectDevices,
                                                RedirectedDrives = this.RedirectedDrives,
                                                RedirectPorts = this.RedirectPorts,
                                                RedirectPrinters = this.RedirectPrinters,
                                                RedirectSmartCards = this.RedirectSmartCards,
                                                SecurityFullScreen = this.SecurityFullScreen,
                                                SecurityStartProgram = this.SecurityStartProgram,
                                                SecurityWorkingFolder = this.SecurityWorkingFolder,
                                                ServerName = this.ServerName,
                                                ShutdownTimeout = this.ShutdownTimeout,
                                                Sounds = this.Sounds,
                                                SSH1 = this.SSH1,
                                                Tags = this.Tags,
                                                Telnet = this.Telnet,
                                                TelnetBackColor = this.TelnetBackColor,
                                                TelnetCols = this.TelnetCols,
                                                TelnetCursorColor = this.TelnetCursorColor,
                                                TelnetFont = this.TelnetFont,
                                                TelnetRows = this.TelnetRows,
                                                TelnetTextColor = this.TelnetTextColor,
                                                ToolBarIcon = this.ToolBarIcon,
                                                TsgwCredsSource = this.TsgwCredsSource,
                                                TsgwDomain = this.TsgwDomain,
                                                TsgwEncryptedPassword = this.TsgwEncryptedPassword,
                                                TsgwHostname = this.TsgwHostname,
                                                TsgwSeparateLogin = this.TsgwSeparateLogin,
                                                TsgwUsageMethod = this.TsgwUsageMethod,
                                                TsgwUsername = this.TsgwUsername,
                                                Url = this.Url,
                                                UserName = this.UserName,
                                                VMRCAdministratorMode = this.VMRCAdministratorMode,
                                                VMRCReducedColorsMode = this.VMRCReducedColorsMode,
                                                VncAutoScale = this.VncAutoScale,
                                                VncDisplayNumber = this.VncDisplayNumber,
                                                VncViewOnly = this.VncViewOnly,
                                                SSHKeyFile = this.SSHKeyFile
                                            };
     return fav;
 }
        private void FillControls(FavoriteConfigurationElement favorite)
        {
            BackColorTextBox.Text = favorite.TelnetBackColor;
            TelnetFontTextbox.Text = favorite.TelnetFont;
            TelnetCursorColorTextBox.Text = favorite.TelnetCursorColor;
            TelnetTextColorTextBox.Text = favorite.TelnetTextColor;

            this.NewWindowCheckbox.Checked = favorite.NewWindow;

            ProtocolComboBox.SelectedItem = favorite.Protocol;
            VMRCAdminModeCheckbox.Checked = favorite.VMRCAdministratorMode;
            TelnetRadioButton.Checked = favorite.Telnet;
            SSHRadioButton.Checked = !favorite.Telnet;
            ColumnsTextBox.Text = favorite.TelnetCols.ToString();
            RowsTextBox.Text = favorite.TelnetRows.ToString();
            VMRCReducedColorsCheckbox.Checked = favorite.VMRCReducedColorsMode;
            txtName.Text = favorite.Name;
            cmbServers.Text = favorite.ServerName;
            cmbDomains.Text = favorite.DomainName;
            cmbUsers.Text = favorite.UserName;
            txtPassword.Text = favorite.Password;
            chkSavePassword.Checked = favorite.Password != "";
            cmbResolution.SelectedIndex = (int)favorite.DesktopSize;
            cmbColors.SelectedIndex = (int)favorite.Colors;
            chkConnectToConsole.Checked = favorite.ConnectToConsole;

            chkAddtoToolbar.Checked = Settings.HasToolbarButton(favorite.Name);
            chkDrives.Checked = favorite.RedirectDrives;
            chkSerialPorts.Checked = favorite.RedirectPorts;
            chkPrinters.Checked = favorite.RedirectPrinters;
            chkRedirectClipboard.Checked = favorite.RedirectClipboard;
            chkRedirectDevices.Checked = favorite.RedirectDevices;
            chkRedirectSmartcards.Checked = favorite.RedirectSmartCards;
            cmbSounds.SelectedIndex = (int)favorite.Sounds;
            txtPort.Text = favorite.Port.ToString();
            txtDesktopShare.Text = favorite.DesktopShare;
            chkExecuteBeforeConnect.Checked = favorite.ExecuteBeforeConnect;
            txtCommand.Text = favorite.ExecuteBeforeConnectCommand;
            txtArguments.Text = favorite.ExecuteBeforeConnectArgs;
            txtInitialDirectory.Text = favorite.ExecuteBeforeConnectInitialDirectory;
            chkWaitForExit.Checked = favorite.ExecuteBeforeConnectWaitForExit;

            string[] tagsArray = favorite.Tags.Split(',');
            if(!((tagsArray.Length == 1) && (String.IsNullOrEmpty(tagsArray[0]))))
            {
                foreach(string tag in tagsArray)
                {
                    lvConnectionTags.Items.Add(tag, tag, -1);
                }
            }

            if(favorite.ToolBarIcon != null && System.IO.File.Exists(favorite.ToolBarIcon))
            {
                this.pictureBox2.Load(favorite.ToolBarIcon);
                this.currentToolBarFileName = favorite.ToolBarIcon;
            }

            //extended settings
            this.ShutdownTimeoutTextBox.Text = favorite.ShutdownTimeout.ToString();
            this.OverallTimeoutTextbox.Text = favorite.OverallTimeout.ToString();
            this.SingleTimeOutTextbox.Text = favorite.ConnectionTimeout.ToString();
            this.IdleTimeoutMinutesTextBox.Text = favorite.IdleTimeout.ToString();
            this.SecurityWorkingFolderTextBox.Text = favorite.SecurityWorkingFolder;
            this.SecuriytStartProgramTextbox.Text = favorite.SecurityStartProgram;
            this.SecurityStartFullScreenCheckbox.Checked = favorite.SecurityFullScreen;
            this.SecuritySettingsEnabledCheckbox.Checked = favorite.EnableSecuritySettings;
            this.GrabFocusOnConnectCheckbox.Checked = favorite.GrabFocusOnConnect;
            this.EnableEncryptionCheckbox.Checked = favorite.EnableEncryption;
            this.DisableWindowsKeyCheckbox.Checked = favorite.DisableWindowsKey;
            this.DetectDoubleClicksCheckbox.Checked = favorite.DoubleClickDetect;
            this.DisplayConnectionBarCheckbox.Checked = favorite.DisplayConnectionBar;
            this.DisableControlAltDeleteCheckbox.Checked= favorite.DisableControlAltDelete;
            this.AcceleratorPassthroughCheckBox.Checked = favorite.AcceleratorPassthrough;
            this.EnableCompressionCheckbox.Checked = favorite.EnableCompression;
            this.EnableBitmapPersistanceCheckbox.Checked = favorite.BitmapPeristence;
            this.AllowBackgroundInputCheckBox.Checked = favorite.AllowBackgroundInput;

            chkDisableCursorShadow.Checked = false;
            chkDisableCursorBlinking.Checked = false;
            chkDisableFullWindowDrag.Checked = false;
            chkDisableMenuAnimations.Checked = false;
            chkDisableThemes.Checked = false;
            chkDisableWallpaper.Checked = false;

            if(favorite.PerformanceFlags > 0)
            {
                chkDisableCursorShadow.Checked = favorite.DisableCursorShadow;
                chkDisableCursorBlinking.Checked = favorite.DisableCursorBlinking;
                chkDisableFullWindowDrag.Checked = favorite.DisableFullWindowDrag;
                chkDisableMenuAnimations.Checked = favorite.DisableMenuAnimations;
                chkDisableThemes.Checked = favorite.DisableTheming;
                chkDisableWallpaper.Checked = favorite.DisableWallPaper;
            }
            this.widthUpDown.Value = (decimal)favorite.DesktopSizeWidth;
            this.heightUpDown.Value = (decimal)favorite.DesktopSizeHeight;

            httpUrlTextBox.Text = favorite.Url;

            ICAClientINI.Text = favorite.IcaClientINI;
            ICAServerINI.Text = favorite.IcaServerINI;
            ICAEncryptionLevelCombobox.Text = favorite.IcaEncryptionLevel;
            ICAEnableEncryptionCheckbox.Checked = favorite.IcaEnableEncryption;
            ICAEncryptionLevelCombobox.Enabled = ICAEnableEncryptionCheckbox.Checked;

            NotesTextbox.Text = favorite.Notes;
        }
Пример #33
0
 private void MainForm_OnReleaseIsAvailable(FavoriteConfigurationElement releaseFavorite)
 {
 	Log.InsideMethod();
     this.Invoke(this.openTerminalsReleasePageMethodInvoker);
 }
Пример #34
0
 private static List<FavoriteConfigurationElement> CreateTwoFavorites()
 {
     var favoriteA = new FavoriteConfigurationElement() {Name = "1"};
     var favoriteB = new FavoriteConfigurationElement() {Name = "2"};
     return new List<FavoriteConfigurationElement>() {favoriteA, favoriteB};
 }
 public int IndexOf(FavoriteConfigurationElement item)
 {
     return BaseIndexOf(item);
 }
 public void Add(FavoriteConfigurationElement item)
 {
     BaseAdd(item);
 }
Пример #37
0
 private void CreateTerminalTab(FavoriteConfigurationElement favorite, bool waitForEnd)
 {
 	Log.InsideMethod();
 	
     this.CallExecuteBeforeConnectedFromSettings();
     this.CallExecuteFeforeConnectedFromFavorite(favorite);
     this.TryConnectTabPage(favorite, waitForEnd);
 }
        public object Clone()
        {
            FavoriteConfigurationElement fav = new FavoriteConfigurationElement
            {
                AcceleratorPassthrough = this.AcceleratorPassthrough,
                AllowBackgroundInput   = this.AllowBackgroundInput,
                AuthMethod             = this.AuthMethod,
                BitmapPeristence       = this.BitmapPeristence,
                Colors                               = this.Colors,
                ConnectionTimeout                    = this.ConnectionTimeout,
                ConnectToConsole                     = this.ConnectToConsole,
                ConsoleBackColor                     = this.ConsoleBackColor,
                ConsoleCols                          = this.ConsoleCols,
                ConsoleCursorColor                   = this.ConsoleCursorColor,
                ConsoleFont                          = this.ConsoleFont,
                ConsoleRows                          = this.ConsoleRows,
                ConsoleTextColor                     = this.ConsoleTextColor,
                Credential                           = this.Credential,
                DesktopShare                         = this.DesktopShare,
                DesktopSize                          = this.DesktopSize,
                DesktopSizeHeight                    = this.DesktopSizeHeight,
                DesktopSizeWidth                     = this.DesktopSizeWidth,
                DisableControlAltDelete              = this.DisableControlAltDelete,
                DisableCursorBlinking                = this.DisableCursorBlinking,
                DisableCursorShadow                  = this.DisableCursorShadow,
                DisableFullWindowDrag                = this.DisableFullWindowDrag,
                DisableMenuAnimations                = this.DisableMenuAnimations,
                DisableTheming                       = this.DisableTheming,
                DisableWallPaper                     = this.DisableWallPaper,
                DisableWindowsKey                    = this.DisableWindowsKey,
                DisplayConnectionBar                 = this.DisplayConnectionBar,
                DomainName                           = this.DomainName,
                DoubleClickDetect                    = this.DoubleClickDetect,
                EnableCompression                    = this.EnableCompression,
                EnableDesktopComposition             = this.EnableDesktopComposition,
                EnableEncryption                     = this.EnableCompression,
                EnableFontSmoothing                  = this.EnableFontSmoothing,
                EnableSecuritySettings               = this.EnableSecuritySettings,
                EnableTLSAuthentication              = this.EnableTLSAuthentication,
                EnableNLAAuthentication              = this.EnableNLAAuthentication,
                EncryptedPassword                    = this.EncryptedPassword,
                ExecuteBeforeConnect                 = this.ExecuteBeforeConnect,
                ExecuteBeforeConnectArgs             = this.ExecuteBeforeConnectArgs,
                ExecuteBeforeConnectCommand          = this.ExecuteBeforeConnectCommand,
                ExecuteBeforeConnectInitialDirectory = this.ExecuteBeforeConnectInitialDirectory,
                ExecuteBeforeConnectWaitForExit      = this.ExecuteBeforeConnectWaitForExit,
                GrabFocusOnConnect                   = this.GrabFocusOnConnect,
                ICAApplicationName                   = this.ICAApplicationName,
                ICAApplicationWorkingFolder          = this.ICAApplicationWorkingFolder,
                ICAApplicationPath                   = this.ICAApplicationPath,
                IcaClientINI                         = this.IcaClientINI,
                IcaEnableEncryption                  = this.IcaEnableEncryption,
                IcaEncryptionLevel                   = this.IcaEncryptionLevel,
                IcaServerINI                         = this.IcaServerINI,
                IdleTimeout                          = this.IdleTimeout,
                KeyTag                               = this.KeyTag,
                Name           = this.Name,
                NewWindow      = this.NewWindow,
                Notes          = this.Notes,
                OverallTimeout = this.OverallTimeout,
                SshSessionName = this.SshSessionName,
                SshVerbose     = this.SshVerbose,
                SshEnablePagentAuthentication = this.SshEnablePagentAuthentication,
                SshEnablePagentForwarding     = this.SshEnablePagentForwarding,
                SshX11Forwarding     = this.SshX11Forwarding,
                SshEnableCompression = this.SshEnableCompression,
                SshVersion           = this.SshVersion,
                Port                  = this.Port,
                Protocol              = this.Protocol,
                RedirectClipboard     = this.RedirectClipboard,
                RedirectDevices       = this.RedirectDevices,
                RedirectedDrives      = this.RedirectedDrives,
                RedirectPorts         = this.RedirectPorts,
                RedirectPrinters      = this.RedirectPrinters,
                RedirectSmartCards    = this.RedirectSmartCards,
                SecurityFullScreen    = this.SecurityFullScreen,
                SecurityStartProgram  = this.SecurityStartProgram,
                SecurityWorkingFolder = this.SecurityWorkingFolder,
                ServerName            = this.ServerName,
                ShutdownTimeout       = this.ShutdownTimeout,
                Sounds                = this.Sounds,
                SSH1                  = this.SSH1,
                Tags                  = this.Tags,
                Telnet                = this.Telnet,
                TelnetBackColor       = this.TelnetBackColor,
                TelnetCols            = this.TelnetCols,
                TelnetCursorColor     = this.TelnetCursorColor,
                TelnetFont            = this.TelnetFont,
                TelnetRows            = this.TelnetRows,
                TelnetTextColor       = this.TelnetTextColor,
                ToolBarIcon           = this.ToolBarIcon,
                TsgwCredsSource       = this.TsgwCredsSource,
                TsgwDomain            = this.TsgwDomain,
                TsgwEncryptedPassword = this.TsgwEncryptedPassword,
                TsgwHostname          = this.TsgwHostname,
                TsgwSeparateLogin     = this.TsgwSeparateLogin,
                TsgwUsageMethod       = this.TsgwUsageMethod,
                TsgwUsername          = this.TsgwUsername,
                Url      = this.Url,
                UserName = this.UserName,
                VMRCAdministratorMode = this.VMRCAdministratorMode,
                VMRCReducedColorsMode = this.VMRCReducedColorsMode,
                VncAutoScale          = this.VncAutoScale,
                VncDisplayNumber      = this.VncDisplayNumber,
                VncViewOnly           = this.VncViewOnly,
                SSHKeyFile            = this.SSHKeyFile,
                TelnetSessionName     = this.TelnetSessionName,
                TelnetVerbose         = this.TelnetVerbose
            };

            return(fav);
        }
 public void Remove(FavoriteConfigurationElement item)
 {
     if (BaseIndexOf(item) >= 0)
         BaseRemove(item.Name);
 }
Пример #40
0
        private string GetToolTipText(FavoriteConfigurationElement favorite)
        {
            string toolTip = "";
            if(favorite != null)
            {
                toolTip =
                    "Computer: " + favorite.ServerName + Environment.NewLine +
                    "User: "******"Port: " + favorite.Port + Environment.NewLine +
                    "Connect to Console: " + favorite.ConnectToConsole.ToString() + Environment.NewLine +
                    "Notes: " + favorite.Notes + Environment.NewLine;

                    //"Desktop size: " + favorite.DesktopSize.ToString() + Environment.NewLine +
                    //"Colors: " + favorite.Colors.ToString() + Environment.NewLine +
                    //"Redirect drives: " + favorite.RedirectDrives.ToString() + Environment.NewLine +
                    //"Redirect ports: " + favorite.RedirectPorts.ToString() + Environment.NewLine +
                    //"Redirect printers: " + favorite.RedirectPrinters.ToString() + Environment.NewLine +
                    //"Sounds: " + favorite.Sounds.ToString() + Environment.NewLine;
                }
            }
            return toolTip;
        }
Пример #41
0
 private void TryConnectTabPage(FavoriteConfigurationElement favorite, bool waitForEnd)
 {
 	Log.InsideMethod();
 	
     try
     {
         ConnectionManager.CreateConnection(favorite, this, waitForEnd, this.AssignEventsToConnectionTab(favorite));
     }
     catch (Exception exc)
     {
         Log.Error("Error creating the connection.", exc);
         this.terminalsControler.UnSelect();
     }
 }
Пример #42
0
 private static ExportOptions CreateExportOptions(string exportedFileName)
 {
     var favorite = new FavoriteConfigurationElement() {Name = FILE_NAME, ServerName = FILE_NAME, Port = CUSTOM_PORT};
     var favorites = new List<FavoriteConfigurationElement>() {favorite};
     return new ExportOptions() {Favorites = favorites, FileName = exportedFileName};
 }
Пример #43
0
        public void ShowManageTerminalForm(FavoriteConfigurationElement favorite)
        {
        	Log.InsideMethod();
        	
            using (FavoriteEditor frmNewTerminal = new FavoriteEditor(favorite))
            {
            	if (this.favsList1 != null)
                	frmNewTerminal.SaveInDB = this.favsList1.SaveInDB;

                TerminalFormDialogResult result = frmNewTerminal.ShowDialog();

                if (result != TerminalFormDialogResult.Cancel)
                {
                    if (result == TerminalFormDialogResult.SaveAndConnect)
                        this.CreateTerminalTab(frmNewTerminal.Favorite, false);
                }
            }
        }
Пример #44
0
        private static Configuration ImportConfiguration(string Filename)
        {
            Configuration c = null;// = new TerminalsConfiguration();

            string templateConfigFile = global::Terminals.Properties.Resources.Terminals;

            //get a temp filename to hold the current settings which are failing
            string tempFile = System.IO.Path.GetTempFileName();

            //delete the zerobyte file which is created by default
            if (System.IO.File.Exists(tempFile))
            {
                System.IO.File.Delete(tempFile);
            }
            //move the error file to the temp file
            System.IO.File.Move(Filename, tempFile);

            //if its still hanging around, kill it
            if (System.IO.File.Exists(Filename))
            {
                System.IO.File.Delete(Filename);
            }
            //write out the template to work from
            using (System.IO.StreamWriter sr = new StreamWriter(Filename))
            {
                sr.Write(templateConfigFile);
            }
            //load up the templated config file
            ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();

            configFileMap.ExeConfigFilename = Filename;
            c = ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None);

            //get a list of the properties on the Settings object (static props)
            System.Reflection.PropertyInfo[] propList = typeof(Settings).GetProperties();

            //read all the xml from the erroring file
            string xml = System.IO.File.ReadAllText(tempFile);

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(xml);
            //get the settings root
            string settingsRoot = "/configuration/settings";

            System.Xml.XmlNode root = doc.SelectSingleNode(settingsRoot);
            try
            {
                //for each setting's attribute
                foreach (System.Xml.XmlAttribute att in root.Attributes)
                {
                    //scan for the related property if any
                    try
                    {
                        foreach (System.Reflection.PropertyInfo info in propList)
                        {
                            try
                            {
                                if (info.Name.ToLower() == att.Name.ToLower())
                                {
                                    //found a matching property, try to set it
                                    string val = att.Value;
                                    info.SetValue(null, System.Convert.ChangeType(val, info.PropertyType), null);
                                    break;
                                }
                            }
                            catch (Exception exc)
                            { //ignore the error
                                Terminals.Logging.Log.Info("", exc);
                            }
                        }
                    }
                    catch (Exception exc)
                    { //ignore the error
                        Terminals.Logging.Log.Info("", exc);
                    }
                }
            }
            catch (Exception exc)
            { //ignore the error
                Terminals.Logging.Log.Info("", exc);
            }

            string favorites = "/configuration/settings/favorites/add";

            System.Xml.XmlNodeList favs = doc.SelectNodes(favorites);

            try
            {
                foreach (System.Xml.XmlNode fav in favs)
                {
                    try
                    {
                        FavoriteConfigurationElement newFav = new FavoriteConfigurationElement();
                        foreach (System.Xml.XmlAttribute att in fav.Attributes)
                        {
                            try
                            {
                                foreach (System.Reflection.PropertyInfo info in newFav.GetType().GetProperties())
                                {
                                    try
                                    {
                                        if (info.Name.ToLower() == att.Name.ToLower())
                                        {
                                            //found a matching property, try to set it
                                            string val = att.Value;
                                            if (info.PropertyType.IsEnum)
                                            {
                                                info.SetValue(newFav, System.Enum.Parse(info.PropertyType, val), null);
                                            }
                                            else
                                            {
                                                info.SetValue(newFav, System.Convert.ChangeType(val, info.PropertyType), null);
                                            }
                                            break;
                                        }
                                    }
                                    catch (Exception exc)
                                    { //ignore the error
                                        Terminals.Logging.Log.Info("", exc);
                                    }
                                }
                            }
                            catch (Exception exc)
                            { //ignore the error
                                Terminals.Logging.Log.Info("", exc);
                            }
                        }
                        Settings.AddFavorite(newFav, false);
                    }
                    catch (Exception exc)
                    { //ignore the error
                        Terminals.Logging.Log.Info("", exc);
                    }
                }
            }
            catch (Exception exc)
            { //ignore the error
                Terminals.Logging.Log.Info("", exc);
            }


            return(c);
        }
Пример #45
0
 void MainForm_OnReleaseIsAvailable(FavoriteConfigurationElement ReleaseFavorite)
 {
     this.Invoke(releaseMIV);
 }
Пример #46
0
 private void QuickConnect(string server, int port, bool ConnectToConsole)
 {
     FavoriteConfigurationElementCollection favorites = Settings.GetFavorites();
     FavoriteConfigurationElement favorite = favorites[server];
     if(favorite != null) {
         if(favorite.ConnectToConsole != ConnectToConsole) favorite.ConnectToConsole = ConnectToConsole;
         CreateTerminalTab(favorite);
     } else {
         //create a temporaty favorite and connect to it
         favorite = new FavoriteConfigurationElement();
         favorite.ConnectToConsole = ConnectToConsole;
         favorite.ServerName = server;
         favorite.Name = server;
         if(port != 0)
             favorite.Port = port;
         CreateTerminalTab(favorite);
     }
 }
Пример #47
0
 private void RemoveTagFromFavorite(FavoriteConfigurationElement Favorite, string Tag)
 {
     List<string> tagList = new List<string>();
     string t = Tag.Trim().ToUpper();
     foreach(string tag in Favorite.TagList)
     {
         if(tag.Trim().ToUpper() != t) tagList.Add(tag);
     }
     Favorite.Tags = String.Join(",", tagList.ToArray());
 }
 private void btnOk_Click(object sender, EventArgs e)
 {
     SaveMRUs();
     string name = txtName.Text;
     if(name == String.Empty)
     {
         name = cmbServers.Text;
     }
     favorite = new FavoriteConfigurationElement();
     favorite.Name = name;
     if(FillFavorite())
     {
         DialogResult = DialogResult.OK;
     }
 }
Пример #49
0
 public void ShowManageTerminalForm(FavoriteConfigurationElement Favorite)
 {
     using(NewTerminalForm frmNewTerminal = new NewTerminalForm(Favorite)) {
         frmNewTerminal.ShowDialog();
         LoadFavorites();
     }
 }
Пример #50
0
        private void FillControls(FavoriteConfigurationElement favorite)
        {
            BackColorTextBox.Text         = favorite.TelnetBackColor;
            TelnetFontTextbox.Text        = favorite.TelnetFont;
            TelnetCursorColorTextBox.Text = favorite.TelnetCursorColor;
            TelnetTextColorTextBox.Text   = favorite.TelnetTextColor;

            this.NewWindowCheckbox.Checked = favorite.NewWindow;

            ProtocolComboBox.SelectedItem = favorite.Protocol;
            VMRCAdminModeCheckbox.Checked = favorite.VMRCAdministratorMode;
            TelnetRadioButton.Checked     = favorite.Telnet;
            SSHRadioButton.Checked        = !favorite.Telnet;
            ColumnsTextBox.Text           = favorite.TelnetCols.ToString();
            RowsTextBox.Text = favorite.TelnetRows.ToString();
            VMRCReducedColorsCheckbox.Checked = favorite.VMRCReducedColorsMode;
            txtName.Text                = favorite.Name;
            cmbServers.Text             = favorite.ServerName;
            cmbDomains.Text             = favorite.DomainName;
            cmbUsers.Text               = favorite.UserName;
            txtPassword.Text            = favorite.Password;
            chkSavePassword.Checked     = favorite.Password != "";
            cmbResolution.SelectedIndex = (int)favorite.DesktopSize;
            cmbColors.SelectedIndex     = (int)favorite.Colors;
            chkConnectToConsole.Checked = favorite.ConnectToConsole;

            chkAddtoToolbar.Checked       = Settings.HasToolbarButton(favorite.Name);
            chkDrives.Checked             = favorite.RedirectDrives;
            chkSerialPorts.Checked        = favorite.RedirectPorts;
            chkPrinters.Checked           = favorite.RedirectPrinters;
            chkRedirectClipboard.Checked  = favorite.RedirectClipboard;
            chkRedirectDevices.Checked    = favorite.RedirectDevices;
            chkRedirectSmartcards.Checked = favorite.RedirectSmartCards;
            cmbSounds.SelectedIndex       = (int)favorite.Sounds;
            txtPort.Text                    = favorite.Port.ToString();
            txtDesktopShare.Text            = favorite.DesktopShare;
            chkExecuteBeforeConnect.Checked = favorite.ExecuteBeforeConnect;
            txtCommand.Text                 = favorite.ExecuteBeforeConnectCommand;
            txtArguments.Text               = favorite.ExecuteBeforeConnectArgs;
            txtInitialDirectory.Text        = favorite.ExecuteBeforeConnectInitialDirectory;
            chkWaitForExit.Checked          = favorite.ExecuteBeforeConnectWaitForExit;

            string[] tagsArray = favorite.Tags.Split(',');
            if (!((tagsArray.Length == 1) && (String.IsNullOrEmpty(tagsArray[0]))))
            {
                foreach (string tag in tagsArray)
                {
                    lvConnectionTags.Items.Add(tag, tag, -1);
                }
            }

            if (favorite.ToolBarIcon != null && System.IO.File.Exists(favorite.ToolBarIcon))
            {
                this.pictureBox2.Load(favorite.ToolBarIcon);
                this.currentToolBarFileName = favorite.ToolBarIcon;
            }

            //extended settings
            this.ShutdownTimeoutTextBox.Text             = favorite.ShutdownTimeout.ToString();
            this.OverallTimeoutTextbox.Text              = favorite.OverallTimeout.ToString();
            this.SingleTimeOutTextbox.Text               = favorite.ConnectionTimeout.ToString();
            this.IdleTimeoutMinutesTextBox.Text          = favorite.IdleTimeout.ToString();
            this.SecurityWorkingFolderTextBox.Text       = favorite.SecurityWorkingFolder;
            this.SecuriytStartProgramTextbox.Text        = favorite.SecurityStartProgram;
            this.SecurityStartFullScreenCheckbox.Checked = favorite.SecurityFullScreen;
            this.SecuritySettingsEnabledCheckbox.Checked = favorite.EnableSecuritySettings;
            this.GrabFocusOnConnectCheckbox.Checked      = favorite.GrabFocusOnConnect;
            this.EnableEncryptionCheckbox.Checked        = favorite.EnableEncryption;
            this.DisableWindowsKeyCheckbox.Checked       = favorite.DisableWindowsKey;
            this.DetectDoubleClicksCheckbox.Checked      = favorite.DoubleClickDetect;
            this.DisplayConnectionBarCheckbox.Checked    = favorite.DisplayConnectionBar;
            this.DisableControlAltDeleteCheckbox.Checked = favorite.DisableControlAltDelete;
            this.AcceleratorPassthroughCheckBox.Checked  = favorite.AcceleratorPassthrough;
            this.EnableCompressionCheckbox.Checked       = favorite.EnableCompression;
            this.EnableBitmapPersistanceCheckbox.Checked = favorite.BitmapPeristence;
            this.AllowBackgroundInputCheckBox.Checked    = favorite.AllowBackgroundInput;

            chkDisableCursorShadow.Checked   = false;
            chkDisableCursorBlinking.Checked = false;
            chkDisableFullWindowDrag.Checked = false;
            chkDisableMenuAnimations.Checked = false;
            chkDisableThemes.Checked         = false;
            chkDisableWallpaper.Checked      = false;


            if (favorite.PerformanceFlags > 0)
            {
                chkDisableCursorShadow.Checked   = favorite.DisableCursorShadow;
                chkDisableCursorBlinking.Checked = favorite.DisableCursorBlinking;
                chkDisableFullWindowDrag.Checked = favorite.DisableFullWindowDrag;
                chkDisableMenuAnimations.Checked = favorite.DisableMenuAnimations;
                chkDisableThemes.Checked         = favorite.DisableTheming;
                chkDisableWallpaper.Checked      = favorite.DisableWallPaper;
            }
            this.widthUpDown.Value  = (decimal)favorite.DesktopSizeWidth;
            this.heightUpDown.Value = (decimal)favorite.DesktopSizeHeight;

            httpUrlTextBox.Text = favorite.Url;

            ICAClientINI.Text = favorite.IcaClientINI;
            ICAServerINI.Text = favorite.IcaServerINI;
            ICAEncryptionLevelCombobox.Text     = favorite.IcaEncryptionLevel;
            ICAEnableEncryptionCheckbox.Checked = favorite.IcaEnableEncryption;
            ICAEncryptionLevelCombobox.Enabled  = ICAEnableEncryptionCheckbox.Checked;

            NotesTextbox.Text = favorite.Notes;
        }
Пример #51
0
 private void AddFavorite(FavoriteConfigurationElement favorite)
 {
     tscConnectTo.Items.Add(favorite.Name);
     ToolStripMenuItem serverToolStripMenuItem = new ToolStripMenuItem(favorite.Name);
     serverToolStripMenuItem.Name = favorite.Name;
     serverToolStripMenuItem.Click += serverToolStripMenuItem_Click;
     favoritesToolStripMenuItem.DropDownItems.Add(serverToolStripMenuItem);
 }
 /// <summary>
 /// Returns text compareto method values selecting property to compare
 /// depending on Settings default sort property value
 /// </summary>
 /// <param name="target">not null favorite to compare with</param>
 /// <returns>result of String CompareTo method</returns>
 internal int CompareByDefaultSorting(FavoriteConfigurationElement target)
 {
     switch (Settings.Instance.DefaultSortProperty)
     {
         case SortProperties.ServerName:
             return this.ServerName.CompareTo(target.ServerName);
         case SortProperties.Protocol:
             return this.Protocol.CompareTo(target.Protocol);
         case SortProperties.ConnectionName:
             return this.Name.CompareTo(target.Name);
         default:
             return -1;
     }
 }
Пример #53
0
 private void AddTagToFavorite(FavoriteConfigurationElement Favorite, string Tag)
 {
     List<string> tagList = new List<string>();
     foreach(string tag in Favorite.TagList)
     {
         tagList.Add(tag);
     }
     tagList.Add(Tag);
     Favorite.Tags = String.Join(",", tagList.ToArray());
 }
 public int IndexOf(FavoriteConfigurationElement item)
 {
     return(BaseIndexOf(item));
 }
Пример #55
0
 void b_OnTerminalServerStateDiscovery(FavoriteConfigurationElement Favorite, bool IsTerminalServer, TerminalServices.TerminalServer Server)
 {
 }
 private void EditFavorite(FavoriteConfigurationElement favorite)
 {
     NewTerminalForm frmNewTerminal = new NewTerminalForm(favorite);
     string oldName = favorite.Name;
     if (frmNewTerminal.ShowDialog() == DialogResult.OK)
     {
         if (oldName != frmNewTerminal.favorite.Name) Settings.DeleteFavorite(oldName);
         LoadConnections();
     }
 }
Пример #57
0
 private void CallExecuteFeforeConnectedFromFavorite(FavoriteConfigurationElement favorite)
 {
 	Log.InsideMethod();
 	
     if (favorite.ExecuteBeforeConnect && !string.IsNullOrEmpty(favorite.ExecuteBeforeConnectCommand))
     {
         ProcessStartInfo processStartInfo = new ProcessStartInfo(favorite.ExecuteBeforeConnectCommand,
                                                                  favorite.ExecuteBeforeConnectArgs)
                                                 {
                                                     WorkingDirectory = favorite.ExecuteBeforeConnectInitialDirectory
                                                 };
         Process process = Process.Start(processStartInfo);
         if (favorite.ExecuteBeforeConnectWaitForExit)
         {
             process.WaitForExit();
         }
     }
 }