private void btnSaveProfile_Click(object sender, EventArgs e) { try { if (CheckFields()) { if (diaSaveKey.ShowDialog(this) == DialogResult.OK) { DPAPI.CreateKeyFile(diaSaveKey.FileName, txtUsername.Text, txtPassword.Text, (string)cmbSettings.SelectedItem); } } } catch (Exception ex) { if (this.InvokeRequired) { this.Invoke(action, ex); } else { action(ex); } } finally { txtUsername.Text = string.Empty; txtPassword.Text = string.Empty; } }
static void Main(string[] args) { Application.EnableVisualStyles(); try { log = new Log(); EveLauncher launcher = new EveLauncher(); Settings.Init(); if (!Settings.CheckIfECLPOpenHandlerExists()) Settings.SetECLPFileOpenHandler(); string username = string.Empty; string password = string.Empty; string settingsProfile = string.Empty; if (args.Length > 0) { if (args[0].ToLower().Trim().StartsWith("/profile:")) { string eclpFileName = args[0].Substring(9); log.WriteLine("Using profile {0}", eclpFileName); DPAPI dpapi = new DPAPI(eclpFileName); username = dpapi.GetUserName(); settingsProfile = dpapi.GetSettingsProfile(); password = dpapi.GetPassword(); log.WriteLine("Username={0}, settingsProfile={1}, password length={2}", username, settingsProfile, password.Length.ToString()); string ssoToken = launcher.GetSSO(username, password); log.WriteLine("\nEverything is OK, starting EVE client..."); launcher.RunEVE(ssoToken, settingsProfile); } } else { frmMain form = new frmMain(launcher); form.Text = ((AssemblyTitleAttribute)(Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)))).Title; Application.Run(form); } } catch (Exception ex) { log.WriteLine("Exception:"); log.WriteLine(false, ex.Message); log.WriteLine(false, ex.StackTrace); new ErrorForm(ex).ShowDialog(); } }