Refactor valid path/filename. Centralize validaion. Universal templating is one step closer
This commit is contained in:
parent
7720110460
commit
d08962cffa
18 changed files with 415 additions and 74 deletions
|
|
@ -16,7 +16,7 @@ namespace FileLiberator
|
|||
private Mp4File m4bBook;
|
||||
|
||||
private long fileSize;
|
||||
private static string Mp3FileName(string m4bPath) => m4bPath is null ? string.Empty : PathLib.ReplaceExtension(m4bPath, ".mp3");
|
||||
private static string Mp3FileName(string m4bPath) => Path.ChangeExtension(m4bPath ?? "", ".mp3");
|
||||
|
||||
public override void Cancel() => m4bBook?.Cancel();
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ namespace FileLiberator
|
|||
mp3File.Close();
|
||||
|
||||
var proposedMp3Path = Mp3FileName(m4bPath);
|
||||
var realMp3Path = FileUtility.Move(mp3File.Name, proposedMp3Path);
|
||||
var realMp3Path = FileUtility.SaferMoveToValidPath(mp3File.Name, proposedMp3Path);
|
||||
OnFileCreated(libraryBook, realMp3Path);
|
||||
|
||||
var statusHandler = new StatusHandler();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue