public IQCredentials getCredentials() { var iqc = new IQCredentials(); // pull the login and password, save login info, and autoconnect settings out of the // registry (if they are already stored) RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\DTN\\IQFeed\\Startup"); // NOTE: we don't need to check for the virtualized registry key on x64 here since these values are in the HKEY_CURRENT_USER hive. if (key != null) { iqc.LoginId = key.GetValue("Login", "").ToString(); iqc.Password = key.GetValue("Password", "").ToString(); iqc.AutoConnect = false; object sData = key.GetValue("AutoConnect", "0").ToString(); if (sData.Equals("1")) { iqc.AutoConnect = true; } iqc.SaveCredentials = false; sData = key.GetValue("SaveLoginPassword", "0").ToString(); if (sData.Equals("1")) { iqc.SaveCredentials = true; } return(iqc); } return(null); }
public string getArguments(IQCredentials iqc) { string arguments = ""; if (Product != "") { arguments += "-product " + Product + " "; } if (Version != "") { arguments += "-version " + Version + " "; } if (iqc.LoginId != "") { arguments += "-login " + iqc.LoginId + " "; } if (iqc.Password != "") { arguments += "-password " + iqc.Password + " "; } if (iqc.SaveCredentials) { arguments += "-savelogininfo "; } if (iqc.AutoConnect) { arguments += "-autoconnect"; } arguments.TrimEnd(' '); return(arguments); }
public bool launch(IQCredentials iqc = null, string arguments = null, int pauseMilliseconds = 6000) { if (iqc == null) { iqc = getCredentials(); } if (iqc == null) { iqc = new IQCredentials(); } if (arguments == null) { arguments = getArguments(iqc); } System.Diagnostics.Process.Start("IQConnect.exe", arguments); Thread.Sleep(pauseMilliseconds); return(true); }