mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 16:10:16 -04:00
27 lines
832 B
C#
27 lines
832 B
C#
using MediatR;
|
|
using ModernKeePass.Application.Common.Interfaces;
|
|
using ModernKeePass.Domain.Exceptions;
|
|
|
|
namespace ModernKeePass.Application.Parameters.Commands.SetCompression
|
|
{
|
|
public class SetCompressionCommand : IRequest
|
|
{
|
|
public string Compression { get; set; }
|
|
|
|
public class SetCompressionCommandHandler : IRequestHandler<SetCompressionCommand>
|
|
{
|
|
private readonly IDatabaseProxy _database;
|
|
|
|
public SetCompressionCommandHandler(IDatabaseProxy database)
|
|
{
|
|
_database = database;
|
|
}
|
|
|
|
public void Handle(SetCompressionCommand message)
|
|
{
|
|
if (_database.IsOpen) _database.Compression = message.Compression;
|
|
else throw new DatabaseClosedException();
|
|
}
|
|
}
|
|
}
|
|
} |