private void BtnImportClick(object sender, RoutedEventArgs e)
        {
            foreach (string[] account in _accounts.Where(a => Checker.Accounts.All(aa => !string.Equals(aa.Username, a[0], StringComparison.CurrentCultureIgnoreCase))))
            {
                try
                {
                    Region region;
                    if (account.Length < 3 || !Enum.TryParse(account[2], true, out region))
                    {
                        region = Settings.Config.SelectedRegion;
                    }

                    Account loginData = new Account
                    {
                        Username = account[0],
                        Password = account[1],
                        State = Account.Result.Unchecked,
                        Region = region
                    };

                    Checker.Accounts.Add(loginData);
                }
                catch
                {
                }
            }

            Close();
        }
예제 #2
0
        public static List<Account> GetLogins(string file)
        {
            var logins = new List<Account>();

            var sr = new StreamReader(file);
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                var accountData = line.Split(new[] { ':' });

                if (accountData.Count() < 2)
                {
                    continue;
                }

                Region region;
                if (accountData.Count() < 3 || !Enum.TryParse(accountData[2], true, out region))
                {
                    region = Settings.Config.SelectedRegion;
                }

                var loginData = new Account
                {
                    Username = accountData[0],
                    Password = accountData[1],
                    State = Account.Result.Unchecked,
                    Region = region
                };

                logins.Add(loginData);
            }

            return logins;
        }
        public AccountWindow(Account account)
        {
            InitializeComponent();

            Title = string.Format("{0} - View account", account.Username);

            if (account.ChampionList != null)
            {
                ChampionsGrid.ItemsSource = account.ChampionList;
            }

            if (account.SkinList != null)
            {
                SkinsGrid.ItemsSource = account.SkinList;
            }

            if (account.Runes != null)
            {
                RunesGrid.ItemsSource = account.Runes;
            }

            if (account.Transfers != null)
            {
                TransfersGrid.ItemsSource = account.Transfers;
            }
        }
예제 #4
0
        public Client(Region region, string username, string password)
        {
            Data = new Account
            {
                Username = username,
                Password = password,
                Region = region,
                Refunds = 0
            };

            IsCompleted = new TaskCompletionSource<bool>();

            Connection = new PVPNetConnection();
            Connection.OnLogin += OnLogin;
            Connection.OnError += OnError;

            Connection.Connect(username, password, region, Settings.Config.ClientVersion);
        }
        public AccountWindow(Account account)
        {
            InitializeComponent();

            mAccount = account;

            Title = string.Format("{0} - View account", mAccount.Username);

            SortingBoxChamps.ItemsSource = new string[] { "Name", "Purchase Date", "With Skin(s)" };
            SortingBoxChamps.SelectedIndex = 0;

            var champsWithSkin = mAccount.ChampionList.Where(c => c.HasSkin == true).OrderBy(x => x.Name);

            if (champsWithSkin.Any())
            {
                mChampsWithSkins = true;
                FilterBoxSkins.ItemsSource = champsWithSkin;
                FilterBoxSkins.DisplayMemberPath = "Name";
                FilterBoxSkins.SelectedValuePath = "Id";
                FilterBoxSkins.IsEnabled = true;
            }

            if (mAccount.ChampionList != null)
            {
                ChampionsListBox.ItemsSource = mAccount.ChampionList.OrderBy(x => x.Name);
            }

            if (mAccount.SkinList != null)
            {
                SkinsListBox.ItemsSource = mAccount.SkinList;
                ((CollectionView)CollectionViewSource.GetDefaultView(SkinsListBox.ItemsSource)).Filter = null;
            }

            if (mAccount.Runes != null)
            {
                RunesGrid.ItemsSource = mAccount.Runes;
            }

            if (mAccount.Transfers != null)
            {
                TransfersGrid.ItemsSource = mAccount.Transfers;
            }
        }
예제 #6
0
        public Client(Region region, string username, string password, string ip, SerializationContext context)
        {
            Data = new Account
            {
                Username = username,
                Password = password,
                Region = region,
                Refunds = 0
            };

            IsCompleted = new TaskCompletionSource<bool>();

            _pvpnet = new PvpClient(username, password, region, Settings.Config.ClientVersion)
            {
                SerializationContext = context,
                LoLIpAddress = ip
            };
            _pvpnet.OnError += OnError;

            GetData();
        }
        public AccountEdit(Account account = null)
        {
            InitializeComponent();

            RegionBox.ItemsSource = Enum.GetValues(typeof(Region)).Cast<Region>();
            RegionBox.SelectedItem = Settings.Config.SelectedRegion;

            Instance = this;

            Loaded += (o, a) => UpdateWindow();
            Closed += (o, a) => Instance = null;

            if (account == null)
            {
                return;
            }

            _account = account;

            UsernameBox.Text = _account.Username;
            PasswordBox.Password = _account.Password;
            PasswordBoxText.Text = _account.Password;
            RegionBox.SelectedItem = _account.Region;
        }
        private void BtnSaveClick(object sender, RoutedEventArgs e)
        {
            var password = Settings.Config.ShowPasswords ? PasswordBoxText.Text : PasswordBox.Password;

            if (string.IsNullOrEmpty(UsernameBox.Text) || string.IsNullOrWhiteSpace(password))
            {
                ResultLabel.Content = "Insert a username and password!";
                return;
            }

            if (_account != null)
            {
                if (Checker.IsChecking)
                {
                    ResultLabel.Content = "Stop the checker before saving.";
                    return;
                }

                if (_account.Username != UsernameBox.Text &&
                    Checker.Accounts.Any(a => a.Username.ToLower() == UsernameBox.Text.ToLower()))
                {
                    ResultLabel.Content = "Username already exists!";
                    return;
                }

                var account = Checker.Accounts.FirstOrDefault(a => a == _account);

                if (account != null)
                {
                    account.Username = UsernameBox.Text;
                    account.Password = password;
                    account.Region = (Region) RegionBox.SelectedItem;
                    _account = account;
                    ResultLabel.Content = "Account successfuly edited!";
                }
            }
            else
            {
                if (Checker.Accounts.Any(a => a.Username.ToLower() == UsernameBox.Text.ToLower()))
                {
                    ResultLabel.Content = "Username already exists!";
                    return;
                }

                var newAccount = new Account
                {
                    Username = UsernameBox.Text,
                    Password = password,
                    Region = (Region) RegionBox.SelectedItem
                };

                _account = newAccount;
                Checker.Accounts.Add(_account);

                ResultLabel.Content = "Account successfuly added!";
            }

            if (AccountsWindow.Instance != null)
            {
                AccountsWindow.Instance.RefreshAccounts();
            }

            MainWindow.Instance.UpdateControls();

            Settings.Config.SelectedRegion = (Region) RegionBox.SelectedItem;
        }
예제 #9
0
        public static async Task<Account> CheckAccount(Account account)
        {
            var client = new Client(account.Region, account.Username, account.Password);

            await client.IsCompleted.Task;

            return client.Data;
        }
        private void BtnSaveClick(object sender, RoutedEventArgs e)
        {
            if (Checker.IsChecking)
            {
                ResultLabel.Content = "Stop the checker before saving.";
                return;
            }

            if (_accounts?.Count > 1)
            {
                foreach (Account acc in _accounts)
                {
                    Account account = Checker.Accounts.FirstOrDefault(a => a == acc);
                    Region newRegion = (Region)RegionBox.SelectedItem;
                    if ((account != null) && (account.Region != newRegion))
                    {
                        account.Region = newRegion;
                        account.State = Account.Result.Unchecked;
                    }
                }
                Close();
            }

            string password = Settings.Config.ShowPasswords ? PasswordBoxText.Text : PasswordBox.Password;

            if (string.IsNullOrEmpty(UsernameBox.Text) || string.IsNullOrWhiteSpace(password))
            {
                ResultLabel.Content = "Insert a username and password!";
                return;
            }

            if (_accounts == null)
            {
                if (Checker.Accounts.Any(a => a.Username.ToLower() == UsernameBox.Text.ToLower()))
                {
                    ResultLabel.Content = "Username already exists!";
                    return;
                }

                Account newAccount = new Account
                {
                    Username = UsernameBox.Text,
                    Password = password,
                    Region = (Region)RegionBox.SelectedItem
                };

                Checker.Accounts.Add(newAccount);

                ResultLabel.Content = "Account successfuly added!";

                UsernameBox.Text = string.Empty;
                PasswordBoxText.Text = string.Empty;
                PasswordBox.Password = string.Empty;
            }
            else
            {
                if (_accounts[0].Username != UsernameBox.Text &&
                    Checker.Accounts.Any(a => a.Username.ToLower() == UsernameBox.Text.ToLower()))
                {
                    ResultLabel.Content = "Username already exists!";
                    return;
                }

                Account account = Checker.Accounts.FirstOrDefault(a => a == _accounts[0]);

                if (account != null)
                {
                    account.Username = UsernameBox.Text;
                    account.Password = password;
                    account.Region = (Region)RegionBox.SelectedItem;
                    account.State = Account.Result.Unchecked;
                    _accounts[0] = account;
                    ResultLabel.Content = "Account successfuly edited!";
                }
            }
        }