Example #1
0
        /// <summary>
        /// Opens and decrypts AccountList asynchronous from file and loads into ObservableCollection<AccountList>.
        /// If null, will create new ObservableCollection<AccountModel>()
        /// </summary>
        public async Task <bool> OpenAccountList()
        {
            if (settings != null)
            {
                byte[] o = await FileManager.OpenFile(settings.saveFileLocation);

                KeyFile key = await CryptoTools.LoadStoredKeyFile(settings.keyLocation);

                // MessageBox.Show(Convert.ToBase64String(key.key));
                if (o != null && o.Length > 0 && key != null)
                {
                    object decryptedData = CryptoTools.DecryptData(key.key, key.IV, o);
                    if (decryptedData != null)
                    {
                        AccountsList = (BetterObservableCollection <AccountModel>)decryptedData;
                    }
                }
                else
                {
                    AccountsList = new BetterObservableCollection <AccountModel>();
                    SaveAccountList();
                }
                Locked = false;
            }
            AccountsList.CollectionChanged += AccountListChanged;
            return(true);
        }
Example #2
0
 public AccountModel(string accountName, string passwordPlainText, string accountURL)
 {
     keyFile                = new KeyFile();
     this.AccountName       = accountName;
     this.PasswordPlainText = passwordPlainText;
     this.AccountURL        = accountURL;
     DateCreated            = DateTime.UtcNow;
 }