public void EncryptBase(Account account) { if (account.Username != null) { account.Username = DataProtection.Encrypt(Encoding.UTF8.GetBytes(account.Username), false); } if (account.Password != null) { account.Password = DataProtection.Encrypt(Encoding.UTF8.GetBytes(account.Password), true); } }
public void SaveAccounts(AccountList <ClashAccount> accountList, string file) { foreach (var account in accountList) { EncryptBase(account); if (account.LoginToken != null) { account.LoginToken = DataProtection.Encrypt(Encoding.UTF8.GetBytes(account.LoginToken), true); } } SaveSerialized(accountList, file); }