private async void AddOrUpdateWindowsCredential(UserCredential existingCredential, string password, string lastCookie)
{
var userInfoDb = await GetUserInfoDB();
try
{
var passwordCursor = await userInfoDb.SelectAsync(userInfoDb.GetKeys().First(), "passwords", DBReadFlags.AutoLock);
if (passwordCursor != null)
{
using (passwordCursor)
{
do
{
var passwordData = JsonConvert.DeserializeObject<PasswordData>(passwordCursor.GetString());
if (lastCookie == passwordData.LastCookie)
{
var newPassData = new PasswordData { Password = password, LastCookie = existingCredential.LoginCookie };
await passwordCursor.UpdateAsync(JsonConvert.SerializeObject(newPassData));
break;
}
} while (await passwordCursor.MoveNextAsync());
}
}
}
catch
{
//let it fail
}
}