mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Removed half-baked import feature for now
No views depend on services anymore Dirty status fully handled by behavior
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\Behaviors\SetDirtyBehavior.cs" />
|
||||
<Compile Include="Common\Behaviors\DirtyStatusBehavior.cs" />
|
||||
<Compile Include="Common\Interfaces\ICryptographyClient.cs" />
|
||||
<Compile Include="Common\Interfaces\IDatabaseProxy.cs" />
|
||||
<Compile Include="Common\Interfaces\IEntityVm.cs" />
|
||||
|
@@ -7,14 +7,14 @@ using ModernKeePass.Application.Database.Commands.SaveDatabase;
|
||||
|
||||
namespace ModernKeePass.Application.Common.Behaviors
|
||||
{
|
||||
public class SetDirtyBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
public class DirtyStatusBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
|
||||
{
|
||||
private readonly List<string> _excludedCommands = new List<string>
|
||||
{nameof(SaveDatabaseCommand), nameof(CloseDatabaseCommand)};
|
||||
|
||||
private readonly IDatabaseProxy _database;
|
||||
|
||||
public SetDirtyBehavior(IDatabaseProxy database)
|
||||
public DirtyStatusBehavior(IDatabaseProxy database)
|
||||
{
|
||||
_database = database;
|
||||
}
|
||||
@@ -23,9 +23,9 @@ namespace ModernKeePass.Application.Common.Behaviors
|
||||
{
|
||||
var response = await next();
|
||||
var queryName = typeof(TRequest).Name;
|
||||
if (queryName.Contains("Command") && !_excludedCommands.Contains(queryName))
|
||||
if (queryName.Contains("Command"))
|
||||
{
|
||||
_database.IsDirty = true;
|
||||
_database.IsDirty = !_excludedCommands.Contains(queryName);
|
||||
}
|
||||
|
||||
return response;
|
@@ -21,7 +21,6 @@ namespace ModernKeePass.Application.Database.Commands.CloseDatabase
|
||||
|
||||
// Cleanup
|
||||
_database.FileAccessToken = null;
|
||||
_database.IsDirty = false;
|
||||
_database.Size = 0;
|
||||
}
|
||||
}
|
||||
|
@@ -47,8 +47,6 @@ namespace ModernKeePass.Application.Database.Commands.SaveDatabase
|
||||
_file.ReleaseFile(_database.FileAccessToken);
|
||||
_database.FileAccessToken = message.FilePath;
|
||||
}
|
||||
|
||||
_database.IsDirty = false;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
@@ -12,7 +12,7 @@ namespace ModernKeePass.Application
|
||||
{
|
||||
var assembly = typeof(DependencyInjection).GetTypeInfo().Assembly;
|
||||
services.AddMediatR(assembly);
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(SetDirtyBehavior<,>));
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(DirtyStatusBehavior<,>));
|
||||
//services.AddValidatorsFromAssembly(assembly);
|
||||
|
||||
return services;
|
||||
|
Reference in New Issue
Block a user