Merge branch 'rmcrackan:master' into master

This commit is contained in:
Mbucari 2021-10-06 13:47:02 -06:00 committed by GitHub
commit 2d22855b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 5 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Version>6.2.1.0</Version>
<Version>6.2.2.0</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -47,7 +47,7 @@ namespace DataLayer
if (_tags != newTags)
{
_tags = newTags;
ItemChanged?.Invoke(this, nameof(Tags));
OnItemChanged(nameof(Tags));
}
}
}
@ -112,6 +112,28 @@ namespace DataLayer
/// </summary>
public static event EventHandler<string> ItemChanged;
private void OnItemChanged(string e)
{
// HACK
// must not fire during initial import.
//
// these checks are necessary because current architecture attaches to this instead of attaching to an event *after* fully committed to db. the attached delegate/action sometimes calls commit:
//
// desired:
// - importing new book
// - update pdf status
// - initial book commit
//
// actual without these checks [BAD]:
// - importing new book
// - update pdf status
// - invoke event
// - commit UserDefinedItem
// - initial book commit
if (BookId > 0 && Book is not null && Book.BookId > 0)
ItemChanged?.Invoke(this, e);
}
private LiberatedStatus _bookStatus;
private LiberatedStatus? _pdfStatus;
public LiberatedStatus BookStatus
@ -122,7 +144,7 @@ namespace DataLayer
if (_bookStatus != value)
{
_bookStatus = value;
ItemChanged?.Invoke(this, nameof(BookStatus));
OnItemChanged(nameof(BookStatus));
}
}
}
@ -134,7 +156,7 @@ namespace DataLayer
if (_pdfStatus != value)
{
_pdfStatus = value;
ItemChanged?.Invoke(this, nameof(PdfStatus));
OnItemChanged(nameof(PdfStatus));
}
}
}

View File

@ -17,7 +17,7 @@ namespace FileLiberator
private Mp4File m4bBook;
private long fileSize;
private string Mp3FileName(string m4bPath) => m4bPath is null ? string.Empty : PathLib.ReplaceExtension(m4bPath, ".mp3");
private static string Mp3FileName(string m4bPath) => m4bPath is null ? string.Empty : PathLib.ReplaceExtension(m4bPath, ".mp3");
public override void Cancel() => m4bBook?.Cancel();