Custom File Naming complete. Final testing remains
This commit is contained in:
parent
c837fefbdd
commit
ab450c37c4
9 changed files with 233 additions and 216 deletions
|
|
@ -10,15 +10,15 @@ namespace LibationWinForms.Dialogs
|
|||
{
|
||||
public partial class EditTemplateDialog : Form
|
||||
{
|
||||
// final valid value
|
||||
// final value. post-validity check
|
||||
public string TemplateText { get; private set; }
|
||||
|
||||
// work-in-progress. not guaranteed to be valid
|
||||
// hold the work-in-progress value. not guaranteed to be valid
|
||||
private string _workingTemplateText;
|
||||
private string workingTemplateText
|
||||
{
|
||||
get => _workingTemplateText;
|
||||
set => _workingTemplateText = Templates.Sanitize(value);
|
||||
set => _workingTemplateText = template.Sanitize(value);
|
||||
}
|
||||
|
||||
private void resetTextBox(string value) => this.templateTb.Text = workingTemplateText = value;
|
||||
|
|
@ -82,24 +82,19 @@ namespace LibationWinForms.Dialogs
|
|||
var chaptersTotal = 10;
|
||||
|
||||
var books = config.Books;
|
||||
var folder = FileLiberator.AudioFileStorageExt.GetFileNamingTemplate(
|
||||
isFolder ? workingTemplateText : config.FolderTemplate,
|
||||
var folder = Templates.Folder.GetPortionFilename(
|
||||
libraryBookDto,
|
||||
null,
|
||||
null)
|
||||
.GetFilePath();
|
||||
isFolder ? workingTemplateText : config.FolderTemplate);
|
||||
var file
|
||||
= (template == Templates.ChapterFile)
|
||||
? new FileLiberator.AudioFileStorageExt.MultipartRenamer(libraryBookDto).MultipartFilename(
|
||||
new() { OutputFileName = "", PartsPosition = chapterNumber, PartsTotal = chaptersTotal, Title = chapterName },
|
||||
workingTemplateText,
|
||||
"")
|
||||
: FileLiberator.AudioFileStorageExt.GetFileNamingTemplate(
|
||||
isFolder ? config.FileTemplate : workingTemplateText,
|
||||
= template == Templates.ChapterFile
|
||||
? Templates.ChapterFile.GetPortionFilename(
|
||||
libraryBookDto,
|
||||
null,
|
||||
null)
|
||||
.GetFilePath();
|
||||
workingTemplateText,
|
||||
new() { OutputFileName = "", PartsPosition = chapterNumber, PartsTotal = chaptersTotal, Title = chapterName },
|
||||
"")
|
||||
: Templates.File.GetPortionFilename(
|
||||
libraryBookDto,
|
||||
isFolder ? config.FileTemplate : workingTemplateText);
|
||||
var ext = config.DecryptToLossy ? "mp3" : "m4b";
|
||||
|
||||
const char ZERO_WIDTH_SPACE = '\u200B';
|
||||
|
|
|
|||
|
|
@ -108,19 +108,11 @@ namespace LibationWinForms.Dialogs
|
|||
private void chapterFileTemplateBtn_Click(object sender, EventArgs e) => editTemplate(Templates.ChapterFile, chapterFileTemplateTb);
|
||||
private static void editTemplate(Templates template, TextBox textBox)
|
||||
{
|
||||
#if !DEBUG
|
||||
TEMP_TEMP_TEMP();
|
||||
return;
|
||||
#endif
|
||||
|
||||
var form = new EditTemplateDialog(template, textBox.Text);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
textBox.Text = form.TemplateText;
|
||||
}
|
||||
|
||||
private static void TEMP_TEMP_TEMP()
|
||||
=> MessageBox.Show("Sorry, not yet. Coming soon :)");
|
||||
|
||||
private void saveBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var newBooks = booksSelectControl.SelectedDirectory;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue