void listAccounts_Drop(object sender, DragEventArgs e)
        {
            EVEAccount droppedData = e.Data.GetData(typeof(EVEAccount)) as EVEAccount;
            EVEAccount target      = ((ListBoxItem)(sender)).DataContext as EVEAccount;

            int removedIdx = listAccounts.Items.IndexOf(droppedData);
            int targetIdx  = listAccounts.Items.IndexOf(target);

            if (removedIdx == targetIdx)
            {
                return;
            }

            if (removedIdx < targetIdx)
            {
                Accounts.Insert(targetIdx + 1, droppedData);
                Accounts.RemoveAt(removedIdx);
            }
            else
            {
                int remIdx = removedIdx + 1;
                if (Accounts.Count + 1 > remIdx)
                {
                    Accounts.Insert(targetIdx, droppedData);
                    Accounts.RemoveAt(remIdx);
                }
            }
            App.Settings.Store();
        }
 public static string GetCookies(EVEAccount eveAccount)
 {
     try
     {
         string filePath = GetCookiesFilename(eveAccount);
         return(System.IO.File.ReadAllText(filePath, Encoding.ASCII));
     }
     catch
     {
         return(string.Empty);
     }
 }
Beispiel #3
0
        public EVELogin(EVEAccount account, bool readOnly)
        {
            Account          = account;
            this.DataContext = account;
            InitializeComponent();

            textAccountName.IsReadOnly = readOnly;
            if (readOnly)
            {
                this.textPassword.Focus();
            }
            else
            {
                this.textAccountName.Focus();
            }
        }
Beispiel #4
0
 public CharacterChallengeWindow(EVEAccount account)
 {
     Account = account;
     InitializeComponent();
 }
        private void buttonAddAccount_Click(object sender, RoutedEventArgs e)
        {
            EVEAccount newAccount = new EVEAccount();
            EVELogin   el         = new EVELogin(newAccount, false);

            el.ShowDialog();

            if (el.DialogResult.HasValue && el.DialogResult.Value)
            {
                // user clicked Go

                // check password...
                //                string refreshToken;
                //                switch (newAccount.GetRefreshToken(false, out refreshToken))
                EVEAccount.Token token;
                LoginResult      lr = newAccount.GetAccessToken(false, out token);
                switch (lr)
                {
                case LoginResult.Success:
                    break;

                case LoginResult.InvalidUsernameOrPassword:
                {
                    MessageBox.Show("Invalid Username or Password. Account NOT added.");
                    return;
                }

                case LoginResult.Timeout:
                {
                    MessageBox.Show("Timed out attempting to log in. Account NOT added.");
                    return;
                }

                case LoginResult.InvalidCharacterChallenge:
                {
                    MessageBox.Show("Invalid Character Name entered, or Invalid Username or Password. Account NOT added.");
                    return;
                }

                case LoginResult.EmailVerificationRequired:
                    // message already provided
                    return;

                default:
                {
                    MessageBox.Show("Failed to log in: " + lr.ToString() + ". Account NOT added.");
                    return;
                }
                break;
                }



                EVEAccount existingAccount = App.Settings.Accounts.FirstOrDefault(q => q.Username.Equals(newAccount.Username, StringComparison.InvariantCultureIgnoreCase));

                if (existingAccount != null)
                {
                    // update existing account?
                    existingAccount.Username       = newAccount.Username;
                    existingAccount.SecurePassword = newAccount.SecurePassword.Copy();
                    existingAccount.EncryptPassword();

                    if (newAccount.SecureCharacterName != null && newAccount.SecureCharacterName.Length > 0)
                    {
                        existingAccount.SecureCharacterName = newAccount.SecureCharacterName.Copy();
                        existingAccount.EncryptCharacterName();
                    }

                    newAccount.Dispose();
                    newAccount = existingAccount;
                }
                else
                {
                    // new account
                    App.Settings.Accounts.Add(newAccount);
                }

                App.Settings.Store();
            }
        }
        public static void DeleteCookies(EVEAccount eveAccount)
        {
            string filePath = GetCookiesFilename(eveAccount);

            System.IO.File.Delete(filePath);
        }
        public static void SetCookies(EVEAccount eveAccount, string cookies)
        {
            string filePath = GetCookiesFilename(eveAccount);

            WriteAllTextSafe(filePath, cookies, Encoding.ASCII);
        }
        public static string GetCookiesFilename(EVEAccount eveAccount)
        {
            string filename = eveAccount.Username.ToLowerInvariant().SHA256();

            return(System.IO.Path.Combine(GetCookieStoragePath(), filename));
        }
Beispiel #9
0
 public VerificationCodeChallengeWindow(EVEAccount account)
 {
     Account = account;
     InitializeComponent();
 }
 public AuthenticatorChallengeWindow(EVEAccount account)
 {
     Account = account;
     InitializeComponent();
 }
        void Timer_Tick(object sender, EventArgs e)
        {
            if (Accounts.Count == 0)
            {
                Stop();
                return;
            }


            // determine if we're waiting on master key transfer...
            if (App.Settings.UseMasterKey && !App.Settings.HasPasswordMasterKey)
            {
                TimeSpan sinceKeyRequested = DateTime.Now - App.Settings.MasterKeyRequested;
                if (sinceKeyRequested.TotalSeconds < 2)
                {
                    // waiting ...
                    DelaySeconds = (float)Math.Truncate((2 - (float)sinceKeyRequested.TotalSeconds) * 100.0f) / 100.0f;
                    return;
                }
            }

            TimeSpan SinceLastLaunch = DateTime.Now - LastLaunch;

            if (SinceLastLaunch.TotalSeconds < App.Settings.LaunchDelay)
            {
                // waiting ...
                DelaySeconds = (float)Math.Truncate((App.Settings.LaunchDelay - (float)SinceLastLaunch.TotalSeconds) * 100.0f) / 100.0f;
                return;
            }
            else
            {
                DelaySeconds = 0;
            }


            EVEAccount a = Accounts[0];

            EVEAccount.LoginResult lr = EVEAccount.LoginResult.Error;
            try
            {
                lr = Launcher.LaunchAccount(a);
            }
            catch (ArgumentNullException ane)
            {
                switch (ane.ParamName)
                {
                case "sharedCachePath":
                {
                    AddDetailsLine("Missing EVE SharedCachePath. Aborting!");
                }
                break;

                case "ssoToken":
                {
                    AddDetailsLine("Failed to retrieve SSO Token from EVE servers. Aborting!");
                }
                break;

                case "gameName":
                {
                    AddDetailsLine("Missing appropriate Game Profile. Aborting!");
                }
                break;

                case "gameProfileName":
                {
                    AddDetailsLine("Missing appropriate Game Profile. Aborting!");
                }
                break;

                default:
                    AddDetailsLine(ane.ToString());
                    break;
                }
            }
            catch (Exception ex)
            {
                AddDetailsLine(ex.ToString());
            }
            switch (lr)
            {
            case EVEAccount.LoginResult.Success:
                AccountsLaunched.Add(a);
                Accounts.Remove(a);
                LastLaunch = DateTime.Now;
                AddDetailsLine("Account '" + a.Username + "' launched");
                break;

            default:
                AddDetailsLine("Account '" + a.Username + "' failed to launch: " + lr.ToString() + ". Aborting!");
                NumErrors++;
                Stop();
                break;
            }
        }
 public EVEAccount.LoginResult LaunchAccount(EVEAccount account)
 {
     return(account.Launch(SharedCachePath, App.Settings.UseSingularity, UseDirectXVersion));
 }
        public EVEAccount.LoginResult LaunchAccount(EVEAccount account)
        {
            return(account.Launch(GameProfile.Game, GameProfile.GameProfile, App.Settings.UseSingularity, UseDirectXVersion));

            throw new NotImplementedException();
        }