private static void ExporRdpLocalResources(XmlTextWriter w, FavoriteConfigurationElement favorite) { w.WriteElementString("sounds", favorite.Sounds.ToString()); if (!String.IsNullOrEmpty(favorite.redirectedDrives)) { w.WriteElementString("redirectedDrives", favorite.redirectedDrives); } if (favorite.RedirectPorts) { w.WriteElementString("redirectPorts", favorite.RedirectPorts.ToString()); } if (favorite.RedirectPrinters) { w.WriteElementString("redirectPrinters", favorite.RedirectPrinters.ToString()); } if (favorite.RedirectSmartCards) { w.WriteElementString("redirectSmartCards", favorite.RedirectSmartCards.ToString()); } if (favorite.RedirectClipboard) { w.WriteElementString("redirectClipboard", favorite.RedirectClipboard.ToString()); } if (favorite.RedirectDevices) { w.WriteElementString("redirectDevices", favorite.RedirectDevices.ToString()); } if (!String.IsNullOrEmpty(favorite.DesktopShare)) { w.WriteElementString("desktopShare", favorite.DesktopShare); } }
/// <summary> /// Doesn't convert Tags to groups, it has to be handled manually, /// when adding Favorite into Persistence /// </summary> internal static IFavorite ConvertToFavorite(FavoriteConfigurationElement sourceFavorite, IPersistence persistence, ConnectionManager connectionManager) { var converter = new ModelConverterV1ToV2(persistence, connectionManager); return(converter.Convert(sourceFavorite)); }
public static IConnection CreateConnection(FavoriteConfigurationElement Favorite, TerminalTabControlItem TerminalTabPage, MainForm parentForm) { IConnection conn = null; ; switch (Favorite.Protocol) { case "VNC": conn = new VNCConnection(); break; case "VMRC": conn = new VMRCConnection(); break; case "RAS": conn = new RASConnection(); break; case "Telnet": conn = new TerminalConnection(); break; case "ICA Citrix": conn = new ICAConnection(); break; case "HTTP": conn = new HTTPConnection(); break; case "HTTPS": conn = new HTTPConnection(); break; default: conn = new RDPConnection(); break; } conn.Favorite = Favorite; TerminalTabPage.Connection = conn; conn.TerminalTabPage = TerminalTabPage; conn.ParentForm = parentForm; return conn; }
public override void FillControls(FavoriteConfigurationElement favorite) { this.cmbDomains.Text = favorite.Credential.DomainName; this.cmbUsers.Text = favorite.Credential.UserName; if (!favorite.Credential.IsSetPassword && favorite.Credential.IsSetEncryptedPassword) { MessageBox.Show("There was an issue decrypting your password.\n\nPlease provide a new password and save the favorite.", AssemblyInfo.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtPassword.Text = ""; this.FavoritePassword = ""; this.txtPassword.Focus(); favorite.Password = ""; } if (favorite.Credential.IsSetPassword) { this.txtPassword.Text = HIDDEN_PASSWORD; this.chkSavePassword.Checked = true; } else { this.txtPassword.Text = String.Empty; this.chkSavePassword.Checked = false; } this.FavoritePassword = favorite.Credential.Password; }
public override void FillFavorite(FavoriteConfigurationElement favorite) { favorite.PuttyConnectionType = (PuttyConnectionType) Enum.Parse(typeof (PuttyConnectionType), this.cmbPuttyProtocol.Text, true); favorite.PuttySession = this.cmbPuttySession.Text; favorite.PuttyCloseWindowOnExit = (PuttyCloseWindowOnExit) Enum.Parse(typeof (PuttyCloseWindowOnExit), this.cmbPuttyCloseWindowOnExit.Text, true); favorite.PuttyCompression = this.chkPuttyCompress.Checked; favorite.PuttyVerbose = this.chkPuttyVerbose.Checked; favorite.PuttyShowOptions = this.chkPuttyShowOptions.Checked; favorite.PuttyPasswordTimeout = (int) this.nudPuttyPasswordTimeout.Value; favorite.PuttyProxyType = (PuttyProxyType) Enum.Parse(typeof (PuttyProxyType), this.cmbProxyType.Text, true); favorite.PuttyProxyHost = txtProxyHost.Text; favorite.PuttyProxyPort = (int)nudProxyPort.Value; favorite.PuttyEnableX11 = this.chkPuttyEnableX11.Checked; favorite.PuttyDontAddDomainToUserName = this.chkPuttyDontAddDomainToUserName.Checked; }
private static XElement ExportFavorite(FavoriteConfigurationElement favorite) { int audioMode = ExportRdp.ConvertFromSounds(favorite.Sounds); int colorBits = ExportRdp.ConvertToColorBits(favorite.Colors); return(new XElement("server", new XAttribute("full-address", favorite.ServerName), new XAttribute("server-port", favorite.Port), new XAttribute("username", favorite.Credential.UserName), new XAttribute("domain", favorite.Credential.DomainName), new XAttribute("desktopwidth", favorite.DesktopSizeWidth), new XAttribute("desktopheight", favorite.DesktopSizeHeight), new XAttribute("session-bpp", colorBits), new XAttribute("audiomode", audioMode), new XAttribute("connect-to-console", Convert.ToByte(favorite.ConnectToConsole)), new XAttribute("compression", Convert.ToByte(favorite.EnableCompression)), new XAttribute("disable-cursor-setting", Convert.ToByte(favorite.DisableCursorBlinking && favorite.DisableCursorShadow)), new XAttribute("disable-full-window-drag", Convert.ToByte(favorite.DisableFullWindowDrag)), new XAttribute("disable-menu-anims", Convert.ToByte(favorite.DisableMenuAnimations)), new XAttribute("disable-themes", Convert.ToByte(favorite.DisableTheming)), new XAttribute("disable-wallpaper", Convert.ToByte(favorite.DisableWallPaper)), new XAttribute("allow-font-smoothing", Convert.ToByte(favorite.EnableFontSmoothing)), new XAttribute("redirectdrives", "1"), new XAttribute("redirectclipboard", Convert.ToByte(favorite.RedirectClipboard)), new XAttribute("alternate-shell", ""), new XAttribute("shell-working-directory", ""), new XAttribute("gatewayusagemethod", favorite.TsgwUsageMethod), new XAttribute("gatewayhostname", favorite.TsgwHostname), new XAttribute("xtr-description", favorite.Notes), new XAttribute("xtr-security-layer", 0), new XAttribute("xtr-use-server-creds-for-gateway", Convert.ToByte(favorite.TsgwSeparateLogin)), new XAttribute("xtr-input-locale", 1033), new XAttribute("xtr-switch-mouse-buttons", 0) )); }
public override void FillControls(FavoriteConfigurationElement favorite) { this.cmbPuttyProtocol.Text = Enum.GetName(typeof (PuttyConnectionType), favorite.PuttyConnectionType); if (!string.IsNullOrEmpty(favorite.PuttySession)) { if (this.cmbPuttySession.Items.Contains(favorite.PuttySession)) { this.cmbPuttySession.SelectedText = favorite.PuttySession; } } this.cmbPuttyCloseWindowOnExit.Text = Enum.GetName(typeof (PuttyCloseWindowOnExit), favorite.PuttyCloseWindowOnExit); this.chkPuttyCompress.Checked = favorite.PuttyCompression; this.chkPuttyVerbose.Checked = favorite.PuttyVerbose; this.chkPuttyShowOptions.Checked = favorite.PuttyShowOptions; this.nudPuttyPasswordTimeout.Value = favorite.PuttyPasswordTimeout; this.cmbProxyType.Text = Enum.GetName(typeof (PuttyProxyType), favorite.PuttyProxyType); this.txtProxyHost.Text = favorite.PuttyProxyHost; this.nudProxyPort.Value = favorite.PuttyProxyPort; this.chkPuttyEnableX11.Checked = favorite.PuttyEnableX11; this.chkPuttyDontAddDomainToUserName.Checked = favorite.PuttyDontAddDomainToUserName; }
public static FavoriteConfigurationElementCollection GetFavorites(bool isDatabaseFavorite) { if (!isDatabaseFavorite) { TerminalsConfigurationSection section = GetSection(); if (section != null) { return(section.Favorites); } } else { FavoriteConfigurationElementCollection collection = new FavoriteConfigurationElementCollection(); using (TerminalsObjectContext dc = TerminalsObjectContext.Create()) { if (dc == null) { return(null); } foreach (var connection in dc.Connections) { FavoriteConfigurationElement favorite = connection.ToFavorite(); collection.Add(favorite); } } return(collection); } return(null); }
private static void ExportRdpTimeoutOptions(XmlTextWriter w, FavoriteConfigurationElement favorite) { w.WriteElementString("idleTimeout", favorite.IdleTimeout.ToString()); w.WriteElementString("overallTimeout", favorite.OverallTimeout.ToString()); w.WriteElementString("connectionTimeout", favorite.ConnectionTimeout.ToString()); w.WriteElementString("shutdownTimeout", favorite.ShutdownTimeout.ToString()); }
public override void FillFavorite(FavoriteConfigurationElement favorite) { favorite.PuttyConnectionType = (PuttyConnectionType)Enum.Parse(typeof(PuttyConnectionType), this.cmbPuttyProtocol.Text, true); favorite.PuttySession = this.cmbPuttySession.Text; favorite.PuttyCloseWindowOnExit = (PuttyCloseWindowOnExit) Enum.Parse(typeof(PuttyCloseWindowOnExit), this.cmbPuttyCloseWindowOnExit.Text, true); favorite.PuttyCompression = this.chkPuttyCompress.Checked; favorite.PuttyVerbose = this.chkPuttyVerbose.Checked; favorite.PuttyShowOptions = this.chkPuttyShowOptions.Checked; favorite.PuttyPasswordTimeout = (int)this.nudPuttyPasswordTimeout.Value; favorite.PuttyProxyType = (PuttyProxyType) Enum.Parse(typeof(PuttyProxyType), this.cmbProxyType.Text, true); favorite.PuttyProxyHost = txtProxyHost.Text; favorite.PuttyProxyPort = (int)nudProxyPort.Value; favorite.PuttyEnableX11 = this.chkPuttyEnableX11.Checked; favorite.PuttyDontAddDomainToUserName = this.chkPuttyDontAddDomainToUserName.Checked; }
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) { this.GetMainForm().Connect(fav.Name, Console, NewWindow, SaveInDB, waitForEnd: true); } } } else { FavoriteConfigurationElement fav = this.TreeView.SelectedFavorite; if (fav != null) { this.GetMainForm().Connect(fav.Name, Console, NewWindow, SaveInDB, waitForEnd: false); } } this.contextMenuStrip1.Close(); this.contextMenuStrip2.Close(); }
public override void FillControls(FavoriteConfigurationElement favorite) { this.cmbPuttyProtocol.Text = Enum.GetName(typeof(PuttyConnectionType), favorite.PuttyConnectionType); if (!string.IsNullOrEmpty(favorite.PuttySession)) { if (this.cmbPuttySession.Items.Contains(favorite.PuttySession)) { this.cmbPuttySession.SelectedText = favorite.PuttySession; } } this.cmbPuttyCloseWindowOnExit.Text = Enum.GetName(typeof(PuttyCloseWindowOnExit), favorite.PuttyCloseWindowOnExit); this.chkPuttyCompress.Checked = favorite.PuttyCompression; this.chkPuttyVerbose.Checked = favorite.PuttyVerbose; this.chkPuttyShowOptions.Checked = favorite.PuttyShowOptions; this.nudPuttyPasswordTimeout.Value = favorite.PuttyPasswordTimeout; this.cmbProxyType.Text = Enum.GetName(typeof(PuttyProxyType), favorite.PuttyProxyType); this.txtProxyHost.Text = favorite.PuttyProxyHost; this.nudProxyPort.Value = favorite.PuttyProxyPort; this.chkPuttyEnableX11.Checked = favorite.PuttyEnableX11; this.chkPuttyDontAddDomainToUserName.Checked = favorite.PuttyDontAddDomainToUserName; }
private void ToTimeOuts(FavoriteConfigurationElement favorite, RdpTimeOutOptions timeOuts) { timeOuts.IdleTimeout = favorite.IdleTimeout; timeOuts.ConnectionTimeout = favorite.ConnectionTimeout; timeOuts.OverallTimeout = favorite.OverallTimeout; timeOuts.ShutdownTimeout = favorite.ShutdownTimeout; }
/// <summary> /// Gets the active connection's icon. A connection might have more than one Icon defined. /// </summary> private static ConnectionImage GetProtocolImage(FavoriteConfigurationElement favorite) { Connection connection = GetCachedConnection(favorite.Protocol); // This might happen if the user is not allowed to // use all available connections e.g. // if the user has a freeware version. if (connection == null) { return(UnknownConnectionIcon); } ConnectionImage image = favorite.CustomImage; // If a custom icon has been set use it, otherwise ... if (image != null) { // Add the image to the image list if it hasn't been loaded. if (!imageList.Images.ContainsKey(image.Name)) { imageList.Images.Add(image.Name, image.Image); } return(image); } connection.Favorite = favorite; // ... return either the connection specific image or the image for unknown types. return(connection.Image ?? UnknownConnectionIcon); }
public static FavoriteConfigurationElement ConvertFromFavorite(SharedFavorite Favorite) { var fav = new FavoriteConfigurationElement(); fav.Colors = Favorite.Colors; fav.ConnectToConsole = Favorite.ConnectToConsole; fav.DesktopShare = Favorite.DesktopShare; fav.DesktopSize = Favorite.DesktopSize; fav.DomainName = Favorite.DomainName; fav.Name = Favorite.Name; fav.Port = Favorite.Port; fav.Protocol = Favorite.Protocol; fav.RedirectClipboard = Favorite.RedirectClipboard; fav.RedirectDevices = Favorite.RedirectDevices; fav.RedirectedDrives = Favorite.RedirectedDrives; fav.RedirectPorts = Favorite.RedirectPorts; fav.RedirectPrinters = Favorite.RedirectPrinters; fav.RedirectSmartCards = Favorite.RedirectSmartCards; fav.ServerName = Favorite.ServerName; fav.DisableWallPaper = Favorite.DisableWallPaper; fav.Sounds = Favorite.Sounds; fav.Tags = Favorite.Tags; fav.ConsoleBackColor = Favorite.ConsoleBackColor; fav.ConsoleCols = Favorite.ConsoleCols; fav.ConsoleCursorColor = Favorite.ConsoleCursorColor; fav.ConsoleFont = Favorite.ConsoleFont; fav.ConsoleRows = Favorite.ConsoleRows; fav.ConsoleTextColor = Favorite.ConsoleTextColor; fav.VMRCAdministratorMode = Favorite.VMRCAdministratorMode; fav.VMRCReducedColorsMode = Favorite.VMRCReducedColorsMode; return(fav); }
public void ReportFavoriteAdded(FavoriteConfigurationElement addedFavorite) { FavoritesChangedEventArgs args = new FavoritesChangedEventArgs(); args.Added.Add(addedFavorite); this.FireFavoriteChanges(args); }
public override void FillControls(FavoriteConfigurationElement favorite) { tinyMce.Text = favorite.TinyMceText(); chkShowTinyMceInConnectionMode.Checked = favorite.ShowTinyMceInConnectionMode(); tinyMce.IsTextEditable = chkShowTinyMceInEditMode.Checked = favorite.ShowTinyMceInEditMode(); tinyMce.Render(); }
internal override void ToConfigFavorite(IFavorite source, FavoriteConfigurationElement destination) { destination.SSH1 = this.SSH1; destination.AuthMethod = this.AuthMethod; destination.KeyTag = this.CertificateKey; destination.SSHKeyFile = this.SSHKeyFile; }
private void AddFavoriteToDiscovered(FavoriteConfigurationElement newFavorite) { lock (this.DiscoveredConnections) { this.DiscoveredConnections.Add(newFavorite); } }
internal static SharedFavorite ConvertFromFavorite(IPersistence persistence, FavoriteConfigurationElement Favorite) { var favoriteSecurity = new FavoriteConfigurationSecurity(persistence, Favorite); SharedFavorite fav = new SharedFavorite(); fav.Colors = Favorite.Colors; fav.ConnectToConsole = Favorite.ConnectToConsole; fav.DesktopShare = Favorite.DesktopShare; fav.DesktopSize = Favorite.DesktopSize; fav.DomainName = favoriteSecurity.ResolveDomainName(); fav.Name = Favorite.Name; fav.Port = Favorite.Port; fav.Protocol = Favorite.Protocol; fav.RedirectClipboard = Favorite.RedirectClipboard; fav.RedirectDevices = Favorite.RedirectDevices; fav.RedirectedDrives = Favorite.RedirectedDrives; fav.RedirectPorts = Favorite.RedirectPorts; fav.RedirectPrinters = Favorite.RedirectPrinters; fav.RedirectSmartCards = Favorite.RedirectSmartCards; fav.ServerName = Favorite.ServerName; fav.DisableWallPaper = Favorite.DisableWallPaper; fav.Sounds = Favorite.Sounds; var tagsConverter = new TagsConverter(); fav.Tags = tagsConverter.ResolveTags(Favorite); fav.ConsoleBackColor = Favorite.ConsoleBackColor; fav.ConsoleCols = Favorite.ConsoleCols; fav.ConsoleCursorColor = Favorite.ConsoleCursorColor; fav.ConsoleFont = Favorite.ConsoleFont; fav.ConsoleRows = Favorite.ConsoleRows; fav.ConsoleTextColor = Favorite.ConsoleTextColor; fav.VMRCAdministratorMode = Favorite.VMRCAdministratorMode; fav.VMRCReducedColorsMode = Favorite.VMRCReducedColorsMode; return(fav); }
public void CheckForTerminalServer(FavoriteConfigurationElement Fav) { if(Fav.Protocol == "RDP") { System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(CheckForTS), (object)Fav); } isTerminalServer = false; }
/// <summary> /// Rename favorite directly in a cell has to be confirmed into the Settings /// </summary> private void dataGridFavorites_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (String.IsNullOrEmpty(this.editedFavorite.Name)) // cancel or nothing changed { this.editedFavorite.Name = this.editedFavoriteName; } if (this.editedFavorite.Name.Equals(this.editedFavoriteName, StringComparison.CurrentCultureIgnoreCase)) { return; } FavoriteConfigurationElement copy = this.editedFavorite.Clone() as FavoriteConfigurationElement; this.editedFavorite.Name = this.editedFavoriteName; FavoriteConfigurationElement oldFavorite = Settings.GetOneFavorite(copy.Name, SaveInDB); if (oldFavorite != null) { string message = String.Format("A connection named \"{0}\" already exists\r\nDo you want to overwrite it?", copy.Name); if ( MessageBox.Show(this, message, AssemblyInfo.Title, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.ReplaceFavoriteInBindingSource(copy); } } else { this.ReplaceFavoriteInBindingSource(copy); } }
public static FavoriteConfigurationElement GetOrCreateQuickConnectFavorite(String server, Boolean ConnectToConsole, Int32 port, string protocol, string url, bool isDatabaseFavorite) { FavoriteConfigurationElementCollection favorites = Settings.GetFavorites(isDatabaseFavorite); FavoriteConfigurationElement favorite = favorites[server]; if (favorite != null) { favorite.ConnectToConsole = ConnectToConsole; } else //create a temporaty favorite and connect to it { favorite = new FavoriteConfigurationElement(); favorite.ConnectToConsole = ConnectToConsole; favorite.ServerName = server; favorite.Name = server; favorite.Protocol = protocol; if (!string.IsNullOrEmpty(url)) favorite.Url = url; if (port != 0) favorite.Port = port; } return favorite; }
public override void FillControls(FavoriteConfigurationElement favorite) { tinyMce.Text = favorite.TinyMceText(); chkShowTinyMceInConnectionMode.Checked = favorite.ShowTinyMceInConnectionMode(); tinyMce.IsTextEditable = chkShowTinyMceInEditMode.Checked = favorite.ShowTinyMceInEditMode(); tinyMce.Render(); }
private void AddImportSuffixToFavorite(FavoriteConfigurationElement favoriteToRename, FavoriteConfigurationElementCollection savedFavorites) { favoriteToRename.Name += importSuffix; if (savedFavorites[favoriteToRename.Name] != null) this.AddImportSuffixToFavorite(favoriteToRename, savedFavorites); }
internal override void FromCofigFavorite(IFavorite destination, FavoriteConfigurationElement source) { this.SSH1 = source.SSH1; this.AuthMethod = source.AuthMethod; this.CertificateKey = source.KeyTag; this.SSHKeyFile = source.SSHKeyFile; }
private ToolStripMenuItem CreateToolStripItemByFavorite(FavoriteConfigurationElement favorite) { ToolStripMenuItem item = CreateFavoriteMenuItem(favorite); item.Click += this.serverToolStripMenuItem_Click; return(item); }
public OptionsConversionContext(IGuardedCredentialFactory credentialsFactory, IFavorite favorite, FavoriteConfigurationElement configFavorite) { this.CredentialsFactory = credentialsFactory; this.Favorite = favorite; this.ConfigFavorite = configFavorite; }
private static void ExportRdpDesktopOptions(XmlTextWriter w, FavoriteConfigurationElement favorite) { w.WriteElementString("desktopSize", favorite.DesktopSize.ToString()); w.WriteElementString("desktopSizeHeight", favorite.DesktopSizeHeight.ToString()); w.WriteElementString("desktopSizeWidth", favorite.DesktopSizeWidth.ToString()); w.WriteElementString("colors", favorite.Colors.ToString()); }
public void ReportFavoriteDeleted(FavoriteConfigurationElement deletedFavorite) { FavoritesChangedEventArgs args = new FavoritesChangedEventArgs(); args.Removed.Add(deletedFavorite); this.FireFavoriteChanges(args); }
public void AddFavorite(string server, string name, int Port) { try { FavoriteConfigurationElement elm = new FavoriteConfigurationElement(); try { System.Net.IPAddress address; if(System.Net.IPAddress.TryParse(server, out address)) { name = System.Net.Dns.GetHostByAddress(address).HostName; } name = string.Format("{0}_{1}", name, Terminals.Connections.ConnectionManager.GetPortName(Port, true)); } catch(Exception exc) { //lets not log dns lookups! //Terminals.Logging.Log.Info("", exc); } elm.Name = name; elm.ServerName = server; elm.UserName = System.Environment.UserName; if(System.Environment.UserDomainName != System.Environment.MachineName) { elm.DomainName = System.Environment.UserDomainName; } else { elm.DomainName = server; } elm.Tags = "Discovered Connections"; elm.Port = Port; elm.Protocol = Terminals.Connections.ConnectionManager.GetPortName(Port, true); lock(DiscoFavs) { DiscoFavs.Add(elm); } //if(this.IsHandleCreated) this.Invoke(miv); } catch(Exception e) { Terminals.Logging.Log.Info("", e); } }
public void NewValue_SetGetDomainName_ReturnsSavedValue() { FavoriteConfigurationElement favorite = this.CreateFavorite(); favorite.DomainName = EXPECTED_DOMAIN; Assert.AreEqual(EXPECTED_DOMAIN, favorite.DomainName, MESSAGE); }
public void AfterConnectPlugins() { // Get all types that implement the IAfterConnectSupport interface var types = Manager.ConnectionManager.GetIAfterConnectSupportTypes(); // Filter the current active type out. // e.g. // HTTP connection might have an AutoIt connection afterwards // AutoIt connection can't have AutoIt afterwards -> avoiding recursion types = (from type in types where this.GetType().FullName != type.FullName select type).ToList <Type>(); foreach (Type type in types) { FavoriteConfigurationElement favoriteCopy = (FavoriteConfigurationElement)Favorite.Clone(); Connection conn = Manager.ConnectionManager.GetConnection(Manager.ConnectionManager.GetProtocolName(type)); ((IAfterConnectSupport)conn).IsInAfterConnectMode = true; conn.Favorite = favoriteCopy; conn.TerminalTabPage = this.TerminalTabPage; if (((IAfterConnectSupport)conn).IsAfterConnectEnabled) { Manager.ConnectionManager.CreateConnection(Favorite, this.ParentForm, false, TerminalTabPage, conn); } } }
public static FavoriteConfigurationElement GetOrCreateQuickConnectFavorite(String server, Boolean ConnectToConsole, Int32 port, string protocol, string url, bool isDatabaseFavorite) { FavoriteConfigurationElementCollection favorites = Settings.GetFavorites(isDatabaseFavorite); FavoriteConfigurationElement favorite = favorites[server]; if (favorite != null) { favorite.ConnectToConsole = ConnectToConsole; } else //create a temporaty favorite and connect to it { favorite = new FavoriteConfigurationElement(); favorite.ConnectToConsole = ConnectToConsole; favorite.ServerName = server; favorite.Name = server; favorite.Protocol = protocol; if (!string.IsNullOrEmpty(url)) { favorite.Url = url; } if (port != 0) { favorite.Port = port; } } return(favorite); }
public static FavoriteConfigurationElement GetFavoriteUpdatedCopy(String connectionName, Boolean forceConsole, Boolean forceNewWindow, CredentialSet credential, bool isDatabaseFavorite) { FavoriteConfigurationElementCollection favorites = Settings.GetFavorites(isDatabaseFavorite); FavoriteConfigurationElement favorite = favorites[connectionName]; if (favorite == null) { return(null); } favorite = (FavoriteConfigurationElement)favorite.Clone(); if (forceConsole) { favorite.ConnectToConsole = true; } if (forceNewWindow) { favorite.NewWindow = true; } if (credential != null) { favorite.XmlCredentialSetName = credential.Name; favorite.UserName = credential.Username; favorite.DomainName = credential.Domain; favorite.EncryptedPassword = credential.Password; } return(favorite); }
internal void SaveDefaultFavorite(FavoriteConfigurationElement favorite) { FavoriteConfigurationElementCollection defaultFav = GetSection().DefaultFavorite; defaultFav.Clear(); defaultFav.Add(favorite); SaveImmediatelyIfRequested(); }
/// <summary> /// Creates a new connection by spawning a new thread. /// </summary> /// <param name="favorite"> </param> /// <param name="TerminalTabPage"> </param> /// <param name="parentForm"> </param> /// <remarks> /// This method calls the <see cref="ConnectionBase.Connect" /> method and requires it to be thread safe. /// </remarks> public static void CreateConnection(FavoriteConfigurationElement favorite, IHostingForm parentForm, bool waitforEnd, TerminalTabControlItem terminalTabPage, ConnectionBase conn = null) { // This might happen if the user is not allowed to // use all available connections e.g. // if the user has a freeware version. if (Limit.Contains(favorite.Protocol.ToUpper()) || terminalTabPage == null) { MessageBox.Show("You are not allowed to use that kind of connection!", AssemblyInfo.Title, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!waitforEnd) { Thread t = new Thread((ThreadStart) delegate { Code(terminalTabPage, parentForm, favorite, conn); }); t.SetApartmentState(ApartmentState.STA); t.Start(); } else { Code(terminalTabPage, parentForm, favorite, conn); } }
private static string ExportFileContent(FavoriteConfigurationElement favorite) { StringBuilder fileContent = new StringBuilder(); AppendPropertyLine(fileContent, ImportRDP.FULLADDRES, favorite.ServerName); AppendPropertyLine(fileContent, ImportRDP.SERVERPORT, favorite.Port.ToString()); AppendPropertyLine(fileContent, ImportRDP.USERNAME, favorite.Credential.UserName); AppendPropertyLine(fileContent, ImportRDP.DOMAIN, favorite.Credential.DomainName); AppendPropertyLine(fileContent, ImportRDP.COLORS, ConvertToColorBits(favorite.Colors).ToString()); AppendPropertyLine(fileContent, ImportRDP.SCREENMODE, ConvertDesktopSize(favorite.DesktopSize)); AppendPropertyLine(fileContent, ImportRDP.CONNECTTOCONSOLE, ConvertToString(favorite.ConnectToConsole)); AppendPropertyLine(fileContent, ImportRDP.DISABLEWALLPAPER, ConvertToString(favorite.DisableWallPaper)); AppendPropertyLine(fileContent, ImportRDP.REDIRECTSMARTCARDS, ConvertToString(favorite.RedirectSmartCards)); AppendPropertyLine(fileContent, ImportRDP.REDIRECTCOMPORTS, ConvertToString(favorite.RedirectPorts)); AppendPropertyLine(fileContent, ImportRDP.REDIRECTPRINTERS, ConvertToString(favorite.RedirectPrinters)); AppendPropertyLine(fileContent, ImportRDP.TSGHOSTNAME, favorite.TsgwHostname); AppendPropertyLine(fileContent, ImportRDP.TSGUSAGEMETHOD, favorite.TsgwUsageMethod.ToString()); AppendPropertyLine(fileContent, ImportRDP.AUDIOMODE, ConvertFromSounds(favorite.Sounds).ToString()); AppendPropertyLine(fileContent, ImportRDP.ENABLECOMPRESSION, ConvertToString(favorite.EnableCompression)); AppendPropertyLine(fileContent, ImportRDP.ENABLEFONTSMOOTHING, ConvertToString(favorite.EnableFontSmoothing)); AppendPropertyLine(fileContent, ImportRDP.REDIRECTCLIPBOARD, ConvertToString(favorite.RedirectClipboard)); AppendPropertyLine(fileContent, ImportRDP.DISABLEWINDOWSKEY, ConvertToString(favorite.DisableWindowsKey)); AppendPropertyLine(fileContent, ImportRDP.DISPLAYCONNECTIONBAR, ConvertToString(favorite.DisplayConnectionBar)); AppendPropertyLine(fileContent, ImportRDP.DISABLEMENUANIMATIONS, ConvertToString(favorite.DisableMenuAnimations)); AppendPropertyLine(fileContent, ImportRDP.DISABLETHEMING, ConvertToString(favorite.DisableTheming)); AppendPropertyLine(fileContent, ImportRDP.DISABLEFULLWINDOWDRAG, ConvertToString(favorite.DisableFullWindowDrag)); AppendPropertyLine(fileContent, ImportRDP.ENABLEDESKTOPCOMPOSITION, ConvertToString(favorite.EnableDesktopComposition)); AppendPropertyLine(fileContent, ImportRDP.DISABLECURSORSETTING, ConvertToString(favorite.DisableCursorBlinking && favorite.DisableCursorShadow)); AppendPropertyLine(fileContent, ImportRDP.BITMAPPERISTENCE, ConvertToString(favorite.BitmapPeristence)); AppendPropertyLine(fileContent, ImportRDP.REDIRECTDEVICES, ConvertToString(favorite.RedirectDevices)); AppendPropertyLine(fileContent, ImportRDP.TSGWCREDSSOURCE, favorite.TsgwCredsSource.ToString()); return(fileContent.ToString()); }
private static void FillPort(FavoriteConfigurationElement favorite, string propertyValue) { int port = 3389; int.TryParse(propertyValue, out port); favorite.Port = port; }
public void NewValue_SetGetUserName_ReturnsSavedValue() { FavoriteConfigurationElement favorite = this.CreateFavorite(); favorite.UserName = EXPECTED_USER; Assert.AreEqual(EXPECTED_USER, favorite.UserName, MESSAGE); }
public void ReportFavoriteUpdated(string oldName, FavoriteConfigurationElement changedFavorite) { FavoritesChangedEventArgs args = new FavoritesChangedEventArgs(); args.Updated.Add(oldName, changedFavorite); this.FireFavoriteChanges(args); }
public override void FillControls(FavoriteConfigurationElement favorite) { this.cmbDomains.Text = favorite.Credential.DomainName; this.cmbUsers.Text = favorite.Credential.UserName; if (!favorite.Credential.IsSetPassword && favorite.Credential.IsSetEncryptedPassword) { MessageBox.Show("There was an issue decrypting your password.\n\nPlease provide a new password and save the favorite.", AssemblyInfo.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txtPassword.Text = ""; this.FavoritePassword = ""; this.txtPassword.Focus(); favorite.Password = ""; } if (favorite.Credential.IsSetPassword) { this.txtPassword.Text = HIDDEN_PASSWORD; this.chkSavePassword.Checked = true; } else { this.txtPassword.Text = String.Empty; this.chkSavePassword.Checked = false; } this.FavoritePassword = favorite.Credential.Password; }
public override void FillControls(FavoriteConfigurationElement favorite) { this.cmbExplorerStyle.Text = favorite.ExplorerStyle.ToString(); this.cmbDirectory.Text = favorite.ExplorerDirectory; this.cmbDirectoryDual.Text = favorite.ExplorerDirectoryDual; this.cmbDirectoryTripple.Text = favorite.ExplorerDirectoryTripple; this.cmbDirectoryQuad.Text = favorite.ExplorerDirectoryQuad; }
public override void FillFavorite(FavoriteConfigurationElement favorite) { favorite.GenericArguments = this.txtGenericArguments.Text; favorite.GenericProgramPath = this.txtGenericExecutablePath.Text; favorite.GenericWorkingDirectory = this.txtGenericWorkingDirectory.Text; //SetIcon(); }
private static void ConvertDisplay(FavoriteConfigurationElement result, IFavorite sourceFavorite) { IDisplayOptions display = sourceFavorite.Display; result.Colors = display.Colors; result.DesktopSize = display.DesktopSize; result.DesktopSizeWidth = display.Width; result.DesktopSizeHeight = display.Height; }
public override void FillControls(FavoriteConfigurationElement favorite) { this.txtGenericArguments.Text = favorite.GenericArguments; this.txtGenericExecutablePath.Text = favorite.GenericProgramPath; this.txtGenericWorkingDirectory.Text = favorite.GenericWorkingDirectory; //SetIcon(); }
public override void FillFavorite(FavoriteConfigurationElement favorite) { favorite.ExplorerStyle = this.cmbExplorerStyle.Text; favorite.ExplorerDirectory = this.cmbDirectory.Text; favorite.ExplorerDirectoryDual = this.cmbDirectoryDual.Text; favorite.ExplorerDirectoryTripple =this.cmbDirectoryTripple.Text; favorite.ExplorerDirectoryQuad = this.cmbDirectoryQuad.Text; }
private static void ConvertDisplay(IFavorite result, FavoriteConfigurationElement sourceFavorite) { IDisplayOptions display = result.Display; display.Colors = sourceFavorite.Colors; display.DesktopSize = sourceFavorite.DesktopSize; display.Width = sourceFavorite.DesktopSizeWidth; display.Height = sourceFavorite.DesktopSizeHeight; }
private void EditFavorite(FavoriteConfigurationElement favorite) { FavoriteEditor frmNewTerminal = new FavoriteEditor(favorite); if (frmNewTerminal.ShowDialog() != TerminalFormDialogResult.Cancel) { this.UpdateFavoritesBindingSource(); } }
public void FillFavorite(FavoriteConfigurationElement favorite) { favorite.ConsoleBackColor = this.fontControl1.BackColor; favorite.ConsoleFont = this.fontControl1.Font; favorite.ConsoleCursorColor = this.CursorColorTextBox.Text; favorite.ConsoleTextColor = this.fontControl1.ForeColor; favorite.ConsoleCols = Convert.ToInt32(this.ColumnsTextBox.Text); favorite.ConsoleRows = Convert.ToInt32(this.RowsTextBox.Text); }
public override void FillFavorite(FavoriteConfigurationElement favorite) { tinyMce.Save(); string text = tinyMce.Text; text = ImageTools.ParseHtmlLinks(text); favorite.TinyMceText(text); favorite.ShowTinyMceInConnectionMode(chkShowTinyMceInConnectionMode.Checked); favorite.ShowTinyMceInEditMode(chkShowTinyMceInEditMode.Checked); }
private static void ConvertBeforeConnetExecute(IFavorite result, FavoriteConfigurationElement sourceFavorite) { IBeforeConnectExecuteOptions executeOptions = result.ExecuteBeforeConnect; executeOptions.Execute = sourceFavorite.ExecuteBeforeConnect; executeOptions.Command = sourceFavorite.ExecuteBeforeConnectCommand; executeOptions.CommandArguments = sourceFavorite.ExecuteBeforeConnectArgs; executeOptions.InitialDirectory = sourceFavorite.ExecuteBeforeConnectInitialDirectory; executeOptions.WaitForExit = sourceFavorite.ExecuteBeforeConnectWaitForExit; }
public void FillControls(FavoriteConfigurationElement favorite) { this.fontControl1.BackColor = favorite.ConsoleBackColor; this.fontControl1.Font = favorite.ConsoleFont; this.CursorColorTextBox.Text = favorite.ConsoleCursorColor; this.fontControl1.ForeColor = favorite.ConsoleTextColor; this.ColumnsTextBox.Text = favorite.ConsoleCols.ToString(); this.RowsTextBox.Text = favorite.ConsoleRows.ToString(); }
internal void FromConfigFavorite(FavoriteConfigurationElement favorite) { this.EnableEncryption = favorite.EnableEncryption; this.EnableNLAAuthentication = favorite.EnableNLAAuthentication; this.Enabled = favorite.EnableSecuritySettings; this.EnableTLSAuthentication = favorite.EnableTLSAuthentication; this.StartProgram = favorite.SecurityStartProgram; this.WorkingFolder = favorite.SecurityWorkingFolder; }
private static void ConvertBeforeConnetExecute(FavoriteConfigurationElement result, IFavorite sourceFavorite) { IBeforeConnectExecuteOptions executeOptions = sourceFavorite.ExecuteBeforeConnect; result.ExecuteBeforeConnect = executeOptions.Execute; result.ExecuteBeforeConnectCommand = executeOptions.Command; result.ExecuteBeforeConnectArgs = executeOptions.CommandArguments; result.ExecuteBeforeConnectInitialDirectory = executeOptions.InitialDirectory; result.ExecuteBeforeConnectWaitForExit = executeOptions.WaitForExit; }
public override void FillControls(FavoriteConfigurationElement favorite) { this.txtRAdminPhonebookPath.Text = favorite.RAdminPhonebookPath; this.rdoRAdminStandardConnectionMode.Checked = favorite.RAdminStandardConnectionMode; this.rdoRAdminTelnetMode.Checked = favorite.RAdminTelnetMode; this.rdoRAdminViewOnly.Checked = favorite.RAdminViewOnlyMode; this.rdoRAdminFileTransferMode.Checked = favorite.RAdminFileTransferMode; this.rdoRAdminShutdown.Checked = favorite.RAdminShutdown; this.rdoRAadminChatMode.Checked = favorite.RAdminChatMode; this.rdoRAdminVoiceChatMode.Checked = favorite.RAdminVoiceChatMode; this.rdoRAdminSendTextMessageMode.Checked = favorite.RAdminSendTextMessageMode; this.chkRAdminUseFullScreen.Checked = favorite.RAdminUseFullScreen; this.chkRAdminThrough.Checked = this.txtRAdminThroughServerName.Enabled = this.txtRAdminThroughPort.Enabled = favorite.RAdminThrough; this.txtRAdminThroughServerName.Text = favorite.RAdminThroughServerName; this.txtRAdminThroughPort.Text = favorite.RAdminThroughPort; this.nudRAdminUpdates.Value = favorite.RAdminUpdates; try { RAdminConnection.ColorDepth colorDepth = (RAdminConnection.ColorDepth) Enum.Parse(typeof (RAdminConnection.ColorDepth), favorite.RAdminColorMode, true); switch (colorDepth) { case RAdminConnection.ColorDepth.Bits1: this.rdoRAdminColorMode1Bit.Checked = true; break; case RAdminConnection.ColorDepth.Bits2: this.rdoRAdminColorMode2Bits.Checked = true; break; case RAdminConnection.ColorDepth.Bits4: this.rdoRAdminColorMode4Bits.Checked = true; break; case RAdminConnection.ColorDepth.Bits8: this.rdoRAdminColorMode8Bits.Checked = true; break; case RAdminConnection.ColorDepth.Bits16: this.rdoRAdminColorMode16Bits.Checked = true; break; default: this.rdoRAdminColorMode24Bits.Checked = true; break; } } catch { /* don't parse */ } }
internal override void FromCofigFavorite(IFavorite destination, FavoriteConfigurationElement source) { this.ApplicationName = source.ICAApplicationName; this.ApplicationPath = source.ICAApplicationPath; this.ApplicationWorkingFolder = source.ICAApplicationWorkingFolder; this.ClientINI = source.IcaClientINI; this.ServerINI = source.IcaServerINI; this.EnableEncryption = source.IcaEnableEncryption; this.EncryptionLevel = source.IcaEncryptionLevel; }
internal override void ToConfigFavorite(IFavorite source, FavoriteConfigurationElement destination) { destination.ICAApplicationName = this.ApplicationName; destination.ICAApplicationPath = this.ApplicationPath; destination.ICAApplicationWorkingFolder = this.ApplicationWorkingFolder; destination.IcaClientINI = this.ClientINI; destination.IcaServerINI = this.ServerINI; destination.IcaEnableEncryption = this.EnableEncryption; destination.IcaEncryptionLevel = this.EncryptionLevel; }
private static void ImportLines(FavoriteConfigurationElement favorite, string[] lines) { foreach (string line in lines) { int valueStartIndex = line.LastIndexOf(":") + 1; string propertyName = line.Substring(0, valueStartIndex); string propertyValue = line.Substring(valueStartIndex); ImportProperty(favorite, propertyName, propertyValue); } }
public static void EditFavorite(string oldName, FavoriteConfigurationElement favorite) { if (favorite == null) return; StartDelayedUpdate(); EditFavoriteInSettings(favorite, oldName); SaveAndFinishDelayedUpdate(); DataDispatcher.Instance.ReportFavoriteUpdated(oldName, favorite); }