Add character replacement

This commit is contained in:
Michael Bucari-Tovo 2022-06-21 18:34:47 -06:00
parent b7fd87b09c
commit 1470aefd42
19 changed files with 654 additions and 115 deletions

View file

@ -0,0 +1,156 @@
namespace LibationWinForms.Dialogs
{
partial class EditReplacementChars
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.charToReplaceCol = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.replacementStringCol = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.descriptionCol = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.defaultsBtn = new System.Windows.Forms.Button();
this.loFiDefaultsBtn = new System.Windows.Forms.Button();
this.saveBtn = new System.Windows.Forms.Button();
this.cancelBtn = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.charToReplaceCol,
this.replacementStringCol,
this.descriptionCol});
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowTemplate.Height = 25;
this.dataGridView1.Size = new System.Drawing.Size(416, 393);
this.dataGridView1.TabIndex = 0;
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating);
this.dataGridView1.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.dataGridView1_UserDeletingRow);
this.dataGridView1.Resize += new System.EventHandler(this.dataGridView1_Resize);
//
// charToReplaceCol
//
this.charToReplaceCol.HeaderText = "Char to Replace";
this.charToReplaceCol.MinimumWidth = 70;
this.charToReplaceCol.Name = "charToReplaceCol";
this.charToReplaceCol.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.charToReplaceCol.Width = 70;
//
// replacementStringCol
//
this.replacementStringCol.HeaderText = "Replacement String";
this.replacementStringCol.MinimumWidth = 85;
this.replacementStringCol.Name = "replacementStringCol";
this.replacementStringCol.Width = 85;
//
// descriptionCol
//
this.descriptionCol.HeaderText = "Description";
this.descriptionCol.MinimumWidth = 100;
this.descriptionCol.Name = "descriptionCol";
this.descriptionCol.Width = 200;
//
// defaultsBtn
//
this.defaultsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.defaultsBtn.Location = new System.Drawing.Point(12, 430);
this.defaultsBtn.Name = "defaultsBtn";
this.defaultsBtn.Size = new System.Drawing.Size(64, 25);
this.defaultsBtn.TabIndex = 1;
this.defaultsBtn.Text = "Defaults";
this.defaultsBtn.UseVisualStyleBackColor = true;
this.defaultsBtn.Click += new System.EventHandler(this.defaultsBtn_Click);
//
// loFiDefaultsBtn
//
this.loFiDefaultsBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.loFiDefaultsBtn.Location = new System.Drawing.Point(82, 430);
this.loFiDefaultsBtn.Name = "loFiDefaultsBtn";
this.loFiDefaultsBtn.Size = new System.Drawing.Size(84, 25);
this.loFiDefaultsBtn.TabIndex = 1;
this.loFiDefaultsBtn.Text = "LoFi Defaults";
this.loFiDefaultsBtn.UseVisualStyleBackColor = true;
this.loFiDefaultsBtn.Click += new System.EventHandler(this.loFiDefaultsBtn_Click);
//
// saveBtn
//
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveBtn.Location = new System.Drawing.Point(346, 430);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(82, 25);
this.saveBtn.TabIndex = 1;
this.saveBtn.Text = "Save";
this.saveBtn.UseVisualStyleBackColor = true;
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
//
// cancelBtn
//
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelBtn.Location = new System.Drawing.Point(258, 430);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(82, 25);
this.cancelBtn.TabIndex = 1;
this.cancelBtn.Text = "Cancel";
this.cancelBtn.UseVisualStyleBackColor = true;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
// EditReplacementChars
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(440, 467);
this.Controls.Add(this.loFiDefaultsBtn);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.saveBtn);
this.Controls.Add(this.defaultsBtn);
this.Controls.Add(this.dataGridView1);
this.Name = "EditReplacementChars";
this.Text = "Character Replacements";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.DataGridViewTextBoxColumn charToReplaceCol;
private System.Windows.Forms.DataGridViewTextBoxColumn replacementStringCol;
private System.Windows.Forms.DataGridViewTextBoxColumn descriptionCol;
private System.Windows.Forms.Button defaultsBtn;
private System.Windows.Forms.Button loFiDefaultsBtn;
private System.Windows.Forms.Button saveBtn;
private System.Windows.Forms.Button cancelBtn;
}
}

View file

@ -0,0 +1,177 @@
using FileManager;
using LibationFileManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace LibationWinForms.Dialogs
{
public partial class EditReplacementChars : Form
{
Configuration config;
public EditReplacementChars()
{
InitializeComponent();
dataGridView1_Resize(this, EventArgs.Empty);
}
public EditReplacementChars(Configuration config) : this()
{
this.config = config;
LoadTable(config.ReplacementCharacters.Replacements);
}
private void LoadTable(List<Replacement> replacements)
{
dataGridView1.Rows.Clear();
foreach (var r in replacements)
{
int row = dataGridView1.Rows.Add(r.CharacterToReplace, r.ReplacementString, r.Description);
dataGridView1.Rows[row].Tag = r;
if (ReplacementCharacters.Default.Replacements.Any(rep => rep.CharacterToReplace == r.CharacterToReplace))
{
r.Mandatory = true;
dataGridView1.Rows[row].Cells[charToReplaceCol.Index].ReadOnly = true;
dataGridView1.Rows[row].Cells[descriptionCol.Index].ReadOnly = true;
}
}
}
private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
{
if (e.Row?.Tag is Replacement r && r.Mandatory)
e.Cancel = true;
}
private void loFiDefaultsBtn_Click(object sender, EventArgs e)
{
LoadTable(ReplacementCharacters.LoFiDefault.Replacements);
}
private void defaultsBtn_Click(object sender, EventArgs e)
{
LoadTable(ReplacementCharacters.Default.Replacements);
}
private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (e.RowIndex < 0) return;
var cellValue = e.FormattedValue?.ToString();
if (dataGridView1.Rows[e.RowIndex].Tag is Replacement row && row.Mandatory)
{
if (e.ColumnIndex == replacementStringCol.Index)
{
//Ensure replacement string doesn't contain an illegal character.
var replaceString = cellValue ?? string.Empty;
if (replaceString != string.Empty && replaceString.Any(c => FileUtility.invalidChars.Contains(c)))
{
dataGridView1.Rows[e.RowIndex].ErrorText = $"{replaceString} contains an illegal path character";
e.Cancel = true;
}
}
return;
}
if (e.ColumnIndex == charToReplaceCol.Index)
{
if (cellValue.Length != 1)
{
dataGridView1.Rows[e.RowIndex].ErrorText = "Only 1 character to replace per entry";
e.Cancel = true;
}
else if (
dataGridView1.Rows
.Cast<DataGridViewRow>()
.Where(r => r.Index != e.RowIndex)
.OfType<Replacement>()
.Any(r => r.CharacterToReplace == cellValue[0])
)
{
dataGridView1.Rows[e.RowIndex].ErrorText = $"The {cellValue[0]} character is already being replaced";
e.Cancel = true;
}
}
else if (e.ColumnIndex == descriptionCol.Index || e.ColumnIndex == replacementStringCol.Index)
{
var value = dataGridView1.Rows[e.RowIndex].Cells[charToReplaceCol.Index].Value;
if (value is null || value is string str && string.IsNullOrEmpty(str))
{
dataGridView1.Rows[e.RowIndex].ErrorText = $"You must choose a character to replace";
e.Cancel = true;
}
}
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0) return;
dataGridView1.Rows[e.RowIndex].ErrorText = string.Empty;
var cellValue = dataGridView1.Rows[e.RowIndex].Cells[charToReplaceCol.Index].Value?.ToString();
if (string.IsNullOrEmpty(cellValue) || cellValue.Length > 1)
{
var row = dataGridView1.Rows[e.RowIndex];
if (!row.IsNewRow)
{
BeginInvoke(new MethodInvoker(delegate
{
dataGridView1.Rows.Remove(row);
}));
}
}
else
{
char charToReplace = cellValue[0];
string description = dataGridView1.Rows[e.RowIndex].Cells[descriptionCol.Index].Value?.ToString() ?? string.Empty;
string replacement = dataGridView1.Rows[e.RowIndex].Cells[replacementStringCol.Index].Value?.ToString() ?? string.Empty;
var mandatory = false;
if (dataGridView1.Rows[e.RowIndex].Tag is Replacement existing)
{
mandatory = existing.Mandatory;
}
dataGridView1.Rows[e.RowIndex].Tag =
new Replacement()
{
CharacterToReplace = charToReplace,
ReplacementString = replacement,
Description = description,
Mandatory = mandatory
};
}
}
private void saveBtn_Click(object sender, EventArgs e)
{
var replacements = dataGridView1.Rows
.Cast<DataGridViewRow>()
.Select(r => r.Tag)
.OfType<Replacement>()
.Where(r => r.ReplacementString != null && (r.ReplacementString == string.Empty || !r.ReplacementString.Any(c => FileUtility.invalidChars.Contains(c))))
.ToList();
config.ReplacementCharacters = new ReplacementCharacters { Replacements = replacements };
DialogResult = DialogResult.OK;
Close();
}
private void cancelBtn_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void dataGridView1_Resize(object sender, EventArgs e)
{
dataGridView1.Columns[^1].Width = dataGridView1.Width - dataGridView1.Columns.Cast<DataGridViewColumn>().Sum(c => c == dataGridView1.Columns[^1] ? 0 : c.Width) - dataGridView1.RowHeadersWidth - 2;
}
}
}

View file

@ -0,0 +1,69 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="charToReplaceCol.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="replacementStringCol.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="descriptionCol.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View file

@ -60,6 +60,7 @@
this.tab3DownloadDecrypt = new System.Windows.Forms.TabPage();
this.inProgressFilesGb = new System.Windows.Forms.GroupBox();
this.customFileNamingGb = new System.Windows.Forms.GroupBox();
this.editCharreplacementBtn = new System.Windows.Forms.Button();
this.chapterFileTemplateBtn = new System.Windows.Forms.Button();
this.chapterFileTemplateTb = new System.Windows.Forms.TextBox();
this.chapterFileTemplateLbl = new System.Windows.Forms.Label();
@ -148,7 +149,7 @@
// saveBtn
//
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveBtn.Location = new System.Drawing.Point(667, 441);
this.saveBtn.Location = new System.Drawing.Point(667, 461);
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(88, 27);
@ -161,7 +162,7 @@
//
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelBtn.Location = new System.Drawing.Point(785, 441);
this.cancelBtn.Location = new System.Drawing.Point(785, 461);
this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.cancelBtn.Name = "cancelBtn";
this.cancelBtn.Size = new System.Drawing.Size(88, 27);
@ -308,7 +309,7 @@
// inProgressSelectControl
//
this.inProgressSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.inProgressSelectControl.Location = new System.Drawing.Point(7, 68);
this.inProgressSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.inProgressSelectControl.Name = "inProgressSelectControl";
@ -328,7 +329,7 @@
// booksSelectControl
//
this.booksSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.booksSelectControl.Location = new System.Drawing.Point(7, 37);
this.booksSelectControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.booksSelectControl.Name = "booksSelectControl";
@ -356,8 +357,8 @@
// tabControl
//
this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl.Controls.Add(this.tab1ImportantSettings);
this.tabControl.Controls.Add(this.tab2ImportLibrary);
this.tabControl.Controls.Add(this.tab3DownloadDecrypt);
@ -365,7 +366,7 @@
this.tabControl.Location = new System.Drawing.Point(12, 12);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(862, 423);
this.tabControl.Size = new System.Drawing.Size(862, 443);
this.tabControl.TabIndex = 100;
//
// tab1ImportantSettings
@ -377,7 +378,7 @@
this.tab1ImportantSettings.Location = new System.Drawing.Point(4, 24);
this.tab1ImportantSettings.Name = "tab1ImportantSettings";
this.tab1ImportantSettings.Padding = new System.Windows.Forms.Padding(3);
this.tab1ImportantSettings.Size = new System.Drawing.Size(854, 395);
this.tab1ImportantSettings.Size = new System.Drawing.Size(854, 415);
this.tab1ImportantSettings.TabIndex = 0;
this.tab1ImportantSettings.Text = "Important settings";
this.tab1ImportantSettings.UseVisualStyleBackColor = true;
@ -385,7 +386,7 @@
// booksGb
//
this.booksGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.booksGb.Controls.Add(this.saveEpisodesToSeriesFolderCbox);
this.booksGb.Controls.Add(this.booksSelectControl);
this.booksGb.Controls.Add(this.booksLocationDescLbl);
@ -416,7 +417,7 @@
this.tab2ImportLibrary.Location = new System.Drawing.Point(4, 24);
this.tab2ImportLibrary.Name = "tab2ImportLibrary";
this.tab2ImportLibrary.Padding = new System.Windows.Forms.Padding(3);
this.tab2ImportLibrary.Size = new System.Drawing.Size(854, 395);
this.tab2ImportLibrary.Size = new System.Drawing.Size(854, 415);
this.tab2ImportLibrary.TabIndex = 1;
this.tab2ImportLibrary.Text = "Import library";
this.tab2ImportLibrary.UseVisualStyleBackColor = true;
@ -459,7 +460,7 @@
this.tab3DownloadDecrypt.Location = new System.Drawing.Point(4, 24);
this.tab3DownloadDecrypt.Name = "tab3DownloadDecrypt";
this.tab3DownloadDecrypt.Padding = new System.Windows.Forms.Padding(3);
this.tab3DownloadDecrypt.Size = new System.Drawing.Size(854, 395);
this.tab3DownloadDecrypt.Size = new System.Drawing.Size(854, 415);
this.tab3DownloadDecrypt.TabIndex = 2;
this.tab3DownloadDecrypt.Text = "Download/Decrypt";
this.tab3DownloadDecrypt.UseVisualStyleBackColor = true;
@ -467,10 +468,10 @@
// inProgressFilesGb
//
this.inProgressFilesGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.inProgressFilesGb.Controls.Add(this.inProgressDescLbl);
this.inProgressFilesGb.Controls.Add(this.inProgressSelectControl);
this.inProgressFilesGb.Location = new System.Drawing.Point(7, 251);
this.inProgressFilesGb.Location = new System.Drawing.Point(6, 281);
this.inProgressFilesGb.Name = "inProgressFilesGb";
this.inProgressFilesGb.Size = new System.Drawing.Size(841, 128);
this.inProgressFilesGb.TabIndex = 21;
@ -480,7 +481,8 @@
// customFileNamingGb
//
this.customFileNamingGb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.customFileNamingGb.Controls.Add(this.editCharreplacementBtn);
this.customFileNamingGb.Controls.Add(this.chapterFileTemplateBtn);
this.customFileNamingGb.Controls.Add(this.chapterFileTemplateTb);
this.customFileNamingGb.Controls.Add(this.chapterFileTemplateLbl);
@ -492,11 +494,22 @@
this.customFileNamingGb.Controls.Add(this.folderTemplateLbl);
this.customFileNamingGb.Location = new System.Drawing.Point(7, 88);
this.customFileNamingGb.Name = "customFileNamingGb";
this.customFileNamingGb.Size = new System.Drawing.Size(841, 157);
this.customFileNamingGb.Size = new System.Drawing.Size(841, 187);
this.customFileNamingGb.TabIndex = 20;
this.customFileNamingGb.TabStop = false;
this.customFileNamingGb.Text = "Custom file naming";
//
// editCharreplacementBtn
//
this.editCharreplacementBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.editCharreplacementBtn.Location = new System.Drawing.Point(5, 158);
this.editCharreplacementBtn.Name = "editCharreplacementBtn";
this.editCharreplacementBtn.Size = new System.Drawing.Size(387, 23);
this.editCharreplacementBtn.TabIndex = 8;
this.editCharreplacementBtn.Text = "[edit char replacement desc]";
this.editCharreplacementBtn.UseVisualStyleBackColor = true;
this.editCharreplacementBtn.Click += new System.EventHandler(this.editCharreplacementBtn_Click);
//
// chapterFileTemplateBtn
//
this.chapterFileTemplateBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -511,7 +524,7 @@
// chapterFileTemplateTb
//
this.chapterFileTemplateTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.chapterFileTemplateTb.Location = new System.Drawing.Point(6, 125);
this.chapterFileTemplateTb.Name = "chapterFileTemplateTb";
this.chapterFileTemplateTb.ReadOnly = true;
@ -541,7 +554,7 @@
// fileTemplateTb
//
this.fileTemplateTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.fileTemplateTb.Location = new System.Drawing.Point(6, 81);
this.fileTemplateTb.Name = "fileTemplateTb";
this.fileTemplateTb.ReadOnly = true;
@ -571,7 +584,7 @@
// folderTemplateTb
//
this.folderTemplateTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.folderTemplateTb.Location = new System.Drawing.Point(5, 37);
this.folderTemplateTb.Name = "folderTemplateTb";
this.folderTemplateTb.ReadOnly = true;
@ -603,7 +616,7 @@
this.tab4AudioFileOptions.Location = new System.Drawing.Point(4, 24);
this.tab4AudioFileOptions.Name = "tab4AudioFileOptions";
this.tab4AudioFileOptions.Padding = new System.Windows.Forms.Padding(3);
this.tab4AudioFileOptions.Size = new System.Drawing.Size(854, 395);
this.tab4AudioFileOptions.Size = new System.Drawing.Size(854, 415);
this.tab4AudioFileOptions.TabIndex = 3;
this.tab4AudioFileOptions.Text = "Audio File Options";
this.tab4AudioFileOptions.UseVisualStyleBackColor = true;
@ -633,7 +646,7 @@
// chapterTitleTemplateTb
//
this.chapterTitleTemplateTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
| System.Windows.Forms.AnchorStyles.Right)));
this.chapterTitleTemplateTb.Location = new System.Drawing.Point(6, 22);
this.chapterTitleTemplateTb.Name = "chapterTitleTemplateTb";
this.chapterTitleTemplateTb.ReadOnly = true;
@ -1017,7 +1030,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelBtn;
this.ClientSize = new System.Drawing.Size(886, 484);
this.ClientSize = new System.Drawing.Size(886, 504);
this.Controls.Add(this.tabControl);
this.Controls.Add(this.cancelBtn);
this.Controls.Add(this.saveBtn);
@ -1141,5 +1154,6 @@
private System.Windows.Forms.GroupBox chapterTitleTemplateGb;
private System.Windows.Forms.Button chapterTitleTemplateBtn;
private System.Windows.Forms.TextBox chapterTitleTemplateTb;
private System.Windows.Forms.Button editCharreplacementBtn;
}
}

View file

@ -11,9 +11,18 @@ namespace LibationWinForms.Dialogs
private void fileTemplateBtn_Click(object sender, EventArgs e) => editTemplate(Templates.File, fileTemplateTb);
private void chapterFileTemplateBtn_Click(object sender, EventArgs e) => editTemplate(Templates.ChapterFile, chapterFileTemplateTb);
private void editCharreplacementBtn_Click(object sender, EventArgs e)
{
var form = new EditReplacementChars(config);
form.ShowDialog();
}
private void Load_DownloadDecrypt(Configuration config)
{
inProgressDescLbl.Text = desc(nameof(config.InProgress));
editCharreplacementBtn.Text = desc(nameof(config.ReplacementCharacters));
badBookGb.Text = desc(nameof(config.BadBook));
badBookAskRb.Text = Configuration.BadBookAction.Ask.GetDescription();
badBookAbortRb.Text = Configuration.BadBookAction.Abort.GetDescription();