private void RunDownloadHandler(DownloadHandlerRunModel runModel)
 {
     KeePassPasswordProvider.RegisterPassword(runModel.KeePassPassword.ConvertToSecureString());
     if (KeePassService.CheckPassword())
     {
         foreach (var handlerKey in runModel.DownloadHandlerKeys)
         {
             try
             {
                 using (var downloadHandler = Container.ResolveKeyed <IBankDownloadHandler>(handlerKey))
                 {
                     downloadHandler.Execute(true, runModel.DownloadStatements);
                 }
             }
             catch (BalanceCheckException ex)
             {
                 //this is just a failed check balance
                 Logger.LogWarning(ex,
                                   $"Failed balance check for {handlerKey} expected {ex.Expected} actual {ex.Actual}. Be aware of pending transactions which might influence the expected balance. Especially when importing during nighttime.");
             }
             catch (Exception ex)
             {
                 Logger.LogError(ex, $"Unexpected exception occured for {handlerKey}");
             }
         }
     }
     else
     {
         Logger.LogInformation("Invalid password");
     }
     KeePassPasswordProvider.DeregisterPassword();
 }
Beispiel #2
0
 public void TestInitialize()
 {
     KeePassConfiguration = new KeePassConfiguration
     {
         Path = TestConfiguration.KeePass.Path,
     };
     KeePassPasswordProvider = new KeePassPasswordProvider();
     KeePassService          = new KeePassService(NullLogger <KeePassService> .Instance, KeePassConfiguration, KeePassPasswordProvider);
     KeePassPasswordProvider.RegisterPassword(TestConfiguration.KeePass.Password);
 }