Address comments

This commit is contained in:
Michael Bucari-Tovo 2022-05-10 20:43:07 -06:00
parent 9a50aa4c7c
commit dd8b0783a9
2 changed files with 16 additions and 14 deletions

View File

@ -303,7 +303,7 @@ namespace FileLiberator
{ {
//Failure to download cover art should not be //Failure to download cover art should not be
//considered a failure to download the book //considered a failure to download the book
Serilog.Log.Logger.Error(ex.Message); Serilog.Log.Logger.Error(ex, $"Error downloading cover art of {libraryBook.Book.AudibleProductId} to {coverPath} catalog product.");
} }
} }

View File

@ -13,10 +13,18 @@ namespace LibationWinForms
public string BookSaveDirectory { get; set; } public string BookSaveDirectory { get; set; }
public byte[] CoverPicture { get => _coverBytes; set => pictureBox1.Image = Dinah.Core.Drawing.ImageReader.ToImage(_coverBytes = value); } public byte[] CoverPicture { get => _coverBytes; set => pictureBox1.Image = Dinah.Core.Drawing.ImageReader.ToImage(_coverBytes = value); }
private byte[] _coverBytes; private byte[] _coverBytes;
public ImageDisplay()
{
InitializeComponent();
lastWidth = Width;
lastHeight = Height;
}
#region Make the form's aspect ratio always match the picture's aspect ratio.
private bool detectedResizeDirection = false; private bool detectedResizeDirection = false;
private bool resizingWidth = false; private bool resizingWidth = false;
private bool resizingHeight = false; private bool resizingHeight = false;
@ -27,14 +35,6 @@ namespace LibationWinForms
private int formExtraHeight; private int formExtraHeight;
private double pictureAR = 1; private double pictureAR = 1;
public ImageDisplay()
{
InitializeComponent();
lastWidth = Width;
lastHeight = Height;
}
protected override void OnResizeBegin(EventArgs e) protected override void OnResizeBegin(EventArgs e)
{ {
detectedResizeDirection = false; detectedResizeDirection = false;
@ -87,6 +87,8 @@ namespace LibationWinForms
return (int)((height - formExtraHeight) * pictureAR) + formExtraWidth; return (int)((height - formExtraHeight) * pictureAR) + formExtraWidth;
} }
#endregion
private void ImageDisplay_Shown(object sender, EventArgs e) private void ImageDisplay_Shown(object sender, EventArgs e)
{ {
formExtraWidth = Width - pictureBox1.Width; formExtraWidth = Width - pictureBox1.Width;
@ -110,8 +112,8 @@ namespace LibationWinForms
} }
catch (Exception ex) catch (Exception ex)
{ {
Serilog.Log.Logger.Error(ex.Message); Serilog.Log.Logger.Error(ex, $"Failed to save picture to {saveFileDialog.FileName}");
MessageBox.Show(this, $"An error was encountered while trying to save the picture\r\n\r\n{ex.Message}", "Sailed to save picture", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); MessageBox.Show(this, $"An error was encountered while trying to save the picture\r\n\r\n{ex.Message}", "Failed to save picture", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
} }
} }
} }