mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 08:00:16 -04:00
Write-mode is finally working!!!
Lib uses BouncyCastle crypto
This commit is contained in:
@@ -1,26 +1,55 @@
|
||||
using System.ComponentModel;
|
||||
using ModernKeePassLibPCL;
|
||||
using ModernKeePassLibPCL.Security;
|
||||
|
||||
namespace ModernKeePass.ViewModels
|
||||
{
|
||||
public class EntryVm : INotifyPropertyChanged
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string UserName { get; private set; }
|
||||
public string Password { get; private set; }
|
||||
public string URL { get; private set; }
|
||||
public string Notes { get; private set; }
|
||||
public string Title
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.TitleField); }
|
||||
set { SetEntryValue(PwDefs.TitleField, value); }
|
||||
}
|
||||
public string UserName
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.UserNameField); }
|
||||
set { SetEntryValue(PwDefs.UserNameField, value); }
|
||||
}
|
||||
public string Password
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.PasswordField); }
|
||||
set { SetEntryValue(PwDefs.PasswordField, value); }
|
||||
}
|
||||
public string Url
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.UrlField); }
|
||||
set { SetEntryValue(PwDefs.UrlField, value); }
|
||||
}
|
||||
public string Notes
|
||||
{
|
||||
get { return GetEntryValue(PwDefs.NotesField); }
|
||||
set { SetEntryValue(PwDefs.NotesField, value); }
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private readonly PwEntry _pwEntry;
|
||||
|
||||
public EntryVm() { }
|
||||
public EntryVm(PwEntry entry)
|
||||
{
|
||||
Title = entry.Strings.GetSafe(PwDefs.TitleField).ReadString();
|
||||
UserName = entry.Strings.GetSafe(PwDefs.UserNameField).ReadString();
|
||||
Password = entry.Strings.GetSafe(PwDefs.PasswordField).ReadString();
|
||||
URL = entry.Strings.GetSafe(PwDefs.UrlField).ReadString();
|
||||
Notes = entry.Strings.GetSafe(PwDefs.NotesField).ReadString();
|
||||
_pwEntry = entry;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private string GetEntryValue(string key)
|
||||
{
|
||||
return _pwEntry.Strings.GetSafe(key).ReadString();
|
||||
}
|
||||
|
||||
private void SetEntryValue(string key, string newValue)
|
||||
{
|
||||
_pwEntry.Strings.Set(key, new ProtectedString(true, newValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user