예제 #1
0
        public async Task UpdateEntry(string entryId, string fieldName, object fieldValue, bool isProtected)
        {
            var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entryId), true);

            switch (fieldName)
            {
            case EntryFieldName.HasExpirationDate:
                pwEntry.Expires = (bool)fieldValue;
                break;

            case EntryFieldName.ExpirationDate:
                pwEntry.ExpiryTime = (DateTime)fieldValue;
                break;

            case EntryFieldName.Icon:
                pwEntry.IconId = IconMapper.MapIconToPwIcon((Icon)fieldValue);
                break;

            case EntryFieldName.BackgroundColor:
                pwEntry.BackgroundColor = (Color)fieldValue;
                break;

            case EntryFieldName.ForegroundColor:
                pwEntry.ForegroundColor = (Color)fieldValue;
                break;

            default:
                var stringValue           = fieldValue == null ? string.Empty: fieldValue.ToString();
                var unprotectedFieldValue = isProtected ? await _cryptography.UnProtect(stringValue) : stringValue;

                pwEntry.Strings.Set(fieldName, new ProtectedString(isProtected, unprotectedFieldValue));
                break;
            }
        }
예제 #2
0
        public void UpdateGroup(GroupEntity group)
        {
            var pwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(group.Id), true);

            pwGroup.Name   = group.Name;
            pwGroup.IconId = IconMapper.MapIconToPwIcon(group.Icon);
            pwGroup.Touch(true);
        }