mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Removed database status in favor of much cleaner code
Implemented (but deactivated) anti corruption mechanism WIP detect changes and save them if opening another database
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using ModernKeePass.Interfaces;
|
||||
using ModernKeePass.ViewModels;
|
||||
using ModernKeePassLib;
|
||||
@@ -10,6 +11,11 @@ namespace ModernKeePassApp.Test.Mock
|
||||
{
|
||||
public class DatabaseServiceMock : IDatabase
|
||||
{
|
||||
private bool _isOpen;
|
||||
private bool _isFileOpen;
|
||||
private bool _isClosed;
|
||||
|
||||
|
||||
public PwCompressionAlgorithm CompressionAlgorithm { get; set; }
|
||||
|
||||
public StorageFile DatabaseFile { get; set; }
|
||||
@@ -18,6 +24,21 @@ namespace ModernKeePassApp.Test.Mock
|
||||
|
||||
public KdfParameters KeyDerivation { get; set; }
|
||||
|
||||
public bool IsOpen
|
||||
{
|
||||
get { return _isOpen; }
|
||||
}
|
||||
|
||||
public bool IsFileOpen
|
||||
{
|
||||
get { return _isFileOpen; }
|
||||
}
|
||||
|
||||
public bool IsClosed
|
||||
{
|
||||
get { return _isClosed; }
|
||||
}
|
||||
|
||||
public string Name => "MockDatabase";
|
||||
|
||||
public GroupVm RecycleBin { get; set; }
|
||||
@@ -25,17 +46,19 @@ namespace ModernKeePassApp.Test.Mock
|
||||
public bool RecycleBinEnabled { get; set; }
|
||||
|
||||
public GroupVm RootGroup { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
|
||||
public void AddDeletedItem(PwUuid id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
public Task Close()
|
||||
{
|
||||
Status = 0;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
_isClosed = true;
|
||||
_isOpen = false;
|
||||
});
|
||||
}
|
||||
|
||||
public void CreateRecycleBin()
|
||||
@@ -43,9 +66,13 @@ namespace ModernKeePassApp.Test.Mock
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Open(CompositeKey key, bool createNew)
|
||||
public Task Open(CompositeKey key, bool createNew)
|
||||
{
|
||||
Status = 2;
|
||||
return Task.Run(() =>
|
||||
{
|
||||
_isOpen = true;
|
||||
_isClosed = false;
|
||||
});
|
||||
}
|
||||
|
||||
public void Save()
|
||||
@@ -57,7 +84,7 @@ namespace ModernKeePassApp.Test.Mock
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public void UpdateCompositeKey(CompositeKey key)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
Reference in New Issue
Block a user