From c9e850515e1b121840170ee5285b524e476aba84 Mon Sep 17 00:00:00 2001 From: Michael Bucari-Tovo Date: Sun, 15 May 2022 09:56:46 -0600 Subject: [PATCH] More useful logging --- Source/AaxDecrypter/NetworkFileStream.cs | 1 + Source/AppScaffolding/AppScaffolding.csproj | 2 +- Source/LibationWinForms/Form1.ProcessQueue.cs | 14 ++++++++++++++ .../LibationWinForms/ProcessQueue/ProcessBook.cs | 10 +++++----- Source/LibationWinForms/grid/ProductsGrid.cs | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Source/AaxDecrypter/NetworkFileStream.cs b/Source/AaxDecrypter/NetworkFileStream.cs index 259b3526..71a95d09 100644 --- a/Source/AaxDecrypter/NetworkFileStream.cs +++ b/Source/AaxDecrypter/NetworkFileStream.cs @@ -221,6 +221,7 @@ namespace AaxDecrypter var buff = new byte[DOWNLOAD_BUFF_SZ]; do { + Thread.Sleep(5); var bytesRead = _networkStream.Read(buff, 0, DOWNLOAD_BUFF_SZ); _writeFile.Write(buff, 0, bytesRead); diff --git a/Source/AppScaffolding/AppScaffolding.csproj b/Source/AppScaffolding/AppScaffolding.csproj index ad40a990..341d6da7 100644 --- a/Source/AppScaffolding/AppScaffolding.csproj +++ b/Source/AppScaffolding/AppScaffolding.csproj @@ -3,7 +3,7 @@ net6.0-windows - 7.5.0.1 + 7.5.0.8 diff --git a/Source/LibationWinForms/Form1.ProcessQueue.cs b/Source/LibationWinForms/Form1.ProcessQueue.cs index acf4ac66..2954f224 100644 --- a/Source/LibationWinForms/Form1.ProcessQueue.cs +++ b/Source/LibationWinForms/Form1.ProcessQueue.cs @@ -14,6 +14,20 @@ namespace LibationWinForms { productsGrid.LiberateClicked += (_, lb) => processBookQueue1.AddDownloadDecrypt(lb); processBookQueue1.popoutBtn.Click += ProcessBookQueue1_PopOut; + + Task.Run(() => + { + Task.Delay(3000).Wait(); + var lb = ApplicationServices.DbContexts.GetLibrary_Flat_NoTracking().Select(lb => lb.Book).ToList(); + + foreach (var b in lb) + { + b.UserDefinedItem.BookStatus = DataLayer.LiberatedStatus.NotLiberated; + } + LibraryCommands.UpdateUserDefinedItem(lb); + + }); + } int WidthChange = 0; diff --git a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs index e76c151b..1aa6ad44 100644 --- a/Source/LibationWinForms/ProcessQueue/ProcessBook.cs +++ b/Source/LibationWinForms/ProcessQueue/ProcessBook.cs @@ -106,21 +106,21 @@ namespace LibationWinForms.ProcessQueue return Result = ProcessBookResult.Success; else if (statusHandler.Errors.Contains("Cancelled")) { - Logger.Info($"Process was cancelled {LibraryBook.Book}"); + Logger.Info($"{CurrentProcessable.Name}: Process was cancelled {LibraryBook.Book}"); return Result = ProcessBookResult.Cancelled; } else if (statusHandler.Errors.Contains("Validation failed")) { - Logger.Info($"Validation failed {LibraryBook.Book}"); + Logger.Info($"{CurrentProcessable.Name}: Validation failed {LibraryBook.Book}"); return Result = ProcessBookResult.ValidationFail; } foreach (var errorMessage in statusHandler.Errors) - Logger.Error(errorMessage); + Logger.Error($"{CurrentProcessable.Name}: {errorMessage}"); } catch (Exception ex) { - Logger.Error(ex); + Logger.Error(ex, CurrentProcessable.Name); } finally { @@ -151,7 +151,7 @@ namespace LibationWinForms.ProcessQueue } catch (Exception ex) { - Logger.Error(ex, "Error while cancelling"); + Logger.Error(ex, $"{CurrentProcessable.Name}: Error while cancelling"); } } diff --git a/Source/LibationWinForms/grid/ProductsGrid.cs b/Source/LibationWinForms/grid/ProductsGrid.cs index b088262e..4a360be8 100644 --- a/Source/LibationWinForms/grid/ProductsGrid.cs +++ b/Source/LibationWinForms/grid/ProductsGrid.cs @@ -130,7 +130,7 @@ namespace LibationWinForms displayWindow.Show(this); } - private void Liberate_Click(GridEntry liveGridEntry) + private async void Liberate_Click(GridEntry liveGridEntry) { var libraryBook = liveGridEntry.LibraryBook;