diff --git a/TwitchDownloaderWPF/Extensions/TextBoxExtensions.cs b/TwitchDownloaderWPF/Extensions/TextBoxExtensions.cs new file mode 100644 index 00000000..152bab62 --- /dev/null +++ b/TwitchDownloaderWPF/Extensions/TextBoxExtensions.cs @@ -0,0 +1,31 @@ +using System.Diagnostics.CodeAnalysis; +using System.Windows.Controls; + +namespace TwitchDownloaderWPF.Extensions +{ + public static class TextBoxExtensions + { + public static bool TryInsertAtCaret([AllowNull] this TextBox textBox, string textToInsert) + { + if (textBox is null || string.IsNullOrEmpty(textToInsert)) + { + return false; + } + + var caretPos = textBox.CaretIndex; + if (caretPos < 0) + { + return false; + } + + if (textBox.IsSelectionActive) + { + textBox.Text = textBox.Text.Remove(caretPos, textBox.SelectionLength); + } + + textBox.Text = textBox.Text.Insert(caretPos, textToInsert); + textBox.CaretIndex = caretPos + textToInsert.Length; + return true; + } + } +} \ No newline at end of file diff --git a/TwitchDownloaderWPF/PageChatRender.xaml b/TwitchDownloaderWPF/PageChatRender.xaml index 0e74fc1c..0f975709 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml +++ b/TwitchDownloaderWPF/PageChatRender.xaml @@ -193,8 +193,23 @@ - - + + + + {fps} + + + {height} + + + {width} + + + {max_int} + + + {save_path} + diff --git a/TwitchDownloaderWPF/PageChatRender.xaml.cs b/TwitchDownloaderWPF/PageChatRender.xaml.cs index 3beb9adb..26a1cd97 100644 --- a/TwitchDownloaderWPF/PageChatRender.xaml.cs +++ b/TwitchDownloaderWPF/PageChatRender.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; @@ -12,17 +13,21 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; using System.Windows.Media.Imaging; using System.Windows.Navigation; using TwitchDownloaderCore; using TwitchDownloaderCore.Chat; using TwitchDownloaderCore.Options; using TwitchDownloaderCore.TwitchObjects; +using TwitchDownloaderWPF.Extensions; using TwitchDownloaderWPF.Models; using TwitchDownloaderWPF.Properties; using TwitchDownloaderWPF.Utils; using WpfAnimatedGif; using MessageBox = System.Windows.MessageBox; +using TextBox = System.Windows.Controls.TextBox; namespace TwitchDownloaderWPF { @@ -738,9 +743,44 @@ private void MenuItemPartialRender_Click(object sender, RoutedEventArgs e) private void TextJson_TextChanged(object sender, TextChangedEventArgs e) { + if (!IsInitialized) + return; + FileNames = textJson.Text.Split("&&", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries); UpdateActionButtons(false); } + + private void FfmpegParameter_MouseDown(object sender, MouseButtonEventArgs e) + { + if (!IsInitialized || sender is not Run { Text: var parameter }) + return; + + if (e.ChangedButton is not MouseButton.Left and not MouseButton.Middle) + return; + + var focusedElement = Keyboard.FocusedElement; + var textBox = GetFfmpegTemplateTextBox(focusedElement); + + if (textBox is null) + return; + + if (textBox.TryInsertAtCaret(parameter)) + { + e.Handled = true; + } + } + + [return: MaybeNull] + private TextBox GetFfmpegTemplateTextBox(IInputElement inputElement) + { + if (ReferenceEquals(inputElement, textFfmpegInput)) + return textFfmpegInput; + + if (ReferenceEquals(inputElement, textFfmpegOutput)) + return textFfmpegOutput; + + return null; + } } public class VideoContainer diff --git a/TwitchDownloaderWPF/Translations/Strings.Designer.cs b/TwitchDownloaderWPF/Translations/Strings.Designer.cs index 636cddb2..0cdf2a03 100644 --- a/TwitchDownloaderWPF/Translations/Strings.Designer.cs +++ b/TwitchDownloaderWPF/Translations/Strings.Designer.cs @@ -851,15 +851,6 @@ public static string FfmpegOutputArguments { } } - /// - /// Looks up a localized string similar to {fps} {height} {width} {max_int} {save_path}. - /// - public static string FfmpegParameters { - get { - return ResourceManager.GetString("FfmpegParameters", resourceCulture); - } - } - /// /// Looks up a localized string similar to Reset To Defaults. /// @@ -978,11 +969,128 @@ public static string FileAlreadyExistsRenameDescription { } /// - /// Looks up a localized string similar to {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game}. + /// Looks up a localized string similar to The display name of the channel which owns the video/clip/chat.. + /// + public static string FilenameParameterChannelTooltip { + get { + return ResourceManager.GetString("FilenameParameterChannelTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The date that the video/clip was created in a customizable format.. + /// + public static string FilenameParameterDateCustomTooltip { + get { + return ResourceManager.GetString("FilenameParameterDateCustomTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The date that the video/clip was created in the format M-d-yy.. + /// + public static string FilenameParameterDateTooltip { + get { + return ResourceManager.GetString("FilenameParameterDateTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The display name of the primary game/category in the video/clip/chat.. + /// + public static string FilenameParameterGameTooltip { + get { + return ResourceManager.GetString("FilenameParameterGameTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The ID of the video/clip.. + /// + public static string FilenameParameterIdTooltip { + get { + return ResourceManager.GetString("FilenameParameterIdTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The length (including trim) of the video/clip/chat in a customizable format.. + /// + public static string FilenameParameterLengthCustomTooltip { + get { + return ResourceManager.GetString("FilenameParameterLengthCustomTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The length (including trim) of the video/clip/chat in the format hh-mm-ss.. + /// + public static string FilenameParameterLengthTooltip { + get { + return ResourceManager.GetString("FilenameParameterLengthTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A string of 11 random characters.. + /// + public static string FilenameParameterRandomStringTooltip { + get { + return ResourceManager.GetString("FilenameParameterRandomStringTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The title of the video/clip.. + /// + public static string FilenameParameterTitleTooltip { + get { + return ResourceManager.GetString("FilenameParameterTitleTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The end trim of the video/chat in a customizable format.. + /// + public static string FilenameParameterTrimEndCustomTooltip { + get { + return ResourceManager.GetString("FilenameParameterTrimEndCustomTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The end trim of the video/chat in the format hh-mm-ss.. + /// + public static string FilenameParameterTrimEndTooltip { + get { + return ResourceManager.GetString("FilenameParameterTrimEndTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The start trim of the video/chat in a customizable format.. + /// + public static string FilenameParameterTrimStartCustomTooltip { + get { + return ResourceManager.GetString("FilenameParameterTrimStartCustomTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The start trim of the video/chat in the format hh-mm-ss.. + /// + public static string FilenameParameterTrimStartTooltip { + get { + return ResourceManager.GetString("FilenameParameterTrimStartTooltip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The amount of views the video/clip has.. /// - public static string FilenameTemplateParameters { + public static string FilenameParameterViewsTooltip { get { - return ResourceManager.GetString("FilenameTemplateParameters", resourceCulture); + return ResourceManager.GetString("FilenameParameterViewsTooltip", resourceCulture); } } diff --git a/TwitchDownloaderWPF/Translations/Strings.es.resx b/TwitchDownloaderWPF/Translations/Strings.es.resx index b3fa70f2..76d4435a 100644 --- a/TwitchDownloaderWPF/Translations/Strings.es.resx +++ b/TwitchDownloaderWPF/Translations/Strings.es.resx @@ -287,20 +287,12 @@ Argumentos de salida: - - {fps} {height} {width} {max_int} {save_path} - No traducir - Restablecer valores por defecto Emotes FFZ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - No traducir - Color letra: @@ -949,4 +941,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + diff --git a/TwitchDownloaderWPF/Translations/Strings.fr.resx b/TwitchDownloaderWPF/Translations/Strings.fr.resx index 756abdc0..62fe5311 100644 --- a/TwitchDownloaderWPF/Translations/Strings.fr.resx +++ b/TwitchDownloaderWPF/Translations/Strings.fr.resx @@ -287,20 +287,12 @@ Output Arguments: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Réinitialiser Emoticônes FFZ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Couleur de la police: @@ -948,4 +940,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.it.resx b/TwitchDownloaderWPF/Translations/Strings.it.resx index 6895f1ff..12090831 100644 --- a/TwitchDownloaderWPF/Translations/Strings.it.resx +++ b/TwitchDownloaderWPF/Translations/Strings.it.resx @@ -287,20 +287,12 @@ Argomenti di uscita: - - {fps} {height} {width} {max_int} {save_path} - Non tradurre - Ripristina i valori di default Emotes FFZ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Non tradurre - Colore del font: @@ -949,4 +941,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + diff --git a/TwitchDownloaderWPF/Translations/Strings.ja.resx b/TwitchDownloaderWPF/Translations/Strings.ja.resx index 56df0a40..a189c11f 100644 --- a/TwitchDownloaderWPF/Translations/Strings.ja.resx +++ b/TwitchDownloaderWPF/Translations/Strings.ja.resx @@ -287,20 +287,12 @@ 出力引数: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - デフォルトにリセット FFZ スタンプ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - フォントカラー: @@ -947,4 +939,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.pl.resx b/TwitchDownloaderWPF/Translations/Strings.pl.resx index 4de9dfa3..b16dde91 100644 --- a/TwitchDownloaderWPF/Translations/Strings.pl.resx +++ b/TwitchDownloaderWPF/Translations/Strings.pl.resx @@ -287,20 +287,12 @@ Argumenty Wejścia: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Przywróć Domyślne Emotki FFZ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Kolor Czcionki: @@ -948,4 +940,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.pt-br.resx b/TwitchDownloaderWPF/Translations/Strings.pt-br.resx index e13a9000..aed41fe5 100644 --- a/TwitchDownloaderWPF/Translations/Strings.pt-br.resx +++ b/TwitchDownloaderWPF/Translations/Strings.pt-br.resx @@ -297,10 +297,6 @@ Emotes do FFZ: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Não traduza - Cor da Fonte: @@ -947,4 +943,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.resx b/TwitchDownloaderWPF/Translations/Strings.resx index 765e5982..d757bd1e 100644 --- a/TwitchDownloaderWPF/Translations/Strings.resx +++ b/TwitchDownloaderWPF/Translations/Strings.resx @@ -287,20 +287,12 @@ Output Arguments: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Reset To Defaults FFZ Emotes: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Font Color: @@ -947,4 +939,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.ru.resx b/TwitchDownloaderWPF/Translations/Strings.ru.resx index d5e04d12..45e28e77 100644 --- a/TwitchDownloaderWPF/Translations/Strings.ru.resx +++ b/TwitchDownloaderWPF/Translations/Strings.ru.resx @@ -287,20 +287,12 @@ Output Arguments: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Сбросить FFZ Эмодзи: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Цвет шрифта: @@ -948,4 +940,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.tr.resx b/TwitchDownloaderWPF/Translations/Strings.tr.resx index 9bdb7792..0281f9e8 100644 --- a/TwitchDownloaderWPF/Translations/Strings.tr.resx +++ b/TwitchDownloaderWPF/Translations/Strings.tr.resx @@ -288,20 +288,12 @@ Çıktı Argümanları: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Varsayılanlara dön FFZ Emojileri: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Font Rengi: @@ -949,4 +941,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + \ No newline at end of file diff --git a/TwitchDownloaderWPF/Translations/Strings.uk.resx b/TwitchDownloaderWPF/Translations/Strings.uk.resx index e9572367..5c714a07 100644 --- a/TwitchDownloaderWPF/Translations/Strings.uk.resx +++ b/TwitchDownloaderWPF/Translations/Strings.uk.resx @@ -287,20 +287,12 @@ Вихідні аргументи: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - Скинути до типових FFZ смайлики: - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - Колір шрифту: @@ -948,4 +940,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + diff --git a/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx b/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx index 5d6530d1..4d67682f 100644 --- a/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx +++ b/TwitchDownloaderWPF/Translations/Strings.zh-cn.resx @@ -287,20 +287,12 @@ 输出参数: - - {fps} {height} {width} {max_int} {save_path} - Do not translate - 重置为默认值 FFZ 表情(Emote): - - {title} {id} {date} {channel} {date_custom=""} {random_string} {trim_start} {trim_end} {trim_start_custom=""} {trim_end_custom=""} {length} {length_custom=""} {views} {game} - Do not translate - 字体颜色: @@ -950,4 +942,46 @@ Unable to get channel clips: {0} + + The title of the video/clip. + + + The ID of the video/clip. + + + The date that the video/clip was created in the format M-d-yy. + + + The date that the video/clip was created in a customizable format. + + + The display name of the channel which owns the video/clip/chat. + + + A string of 11 random characters. + + + The start trim of the video/chat in the format hh-mm-ss. + + + The start trim of the video/chat in a customizable format. + + + The end trim of the video/chat in the format hh-mm-ss. + + + The end trim of the video/chat in a customizable format. + + + The length (including trim) of the video/clip/chat in the format hh-mm-ss. + + + The length (including trim) of the video/clip/chat in a customizable format. + + + The amount of views the video/clip has. + + + The display name of the primary game/category in the video/clip/chat. + diff --git a/TwitchDownloaderWPF/WindowSettings.xaml b/TwitchDownloaderWPF/WindowSettings.xaml index 1306345f..d2b06501 100644 --- a/TwitchDownloaderWPF/WindowSettings.xaml +++ b/TwitchDownloaderWPF/WindowSettings.xaml @@ -86,7 +86,48 @@ - + + {title} + + + {id} + + + {date} + + + {date_custom=""} + + + {channel} + + + {random_string} + + + {trim_start} + + + {trim_start_custom=""} + + + {trim_end} + + + {trim_end_custom=""} + + + {length} + + + {length_custom=""} + + + {views} + + + {game} + diff --git a/TwitchDownloaderWPF/WindowSettings.xaml.cs b/TwitchDownloaderWPF/WindowSettings.xaml.cs index 6cfc8ecf..930e0963 100644 --- a/TwitchDownloaderWPF/WindowSettings.xaml.cs +++ b/TwitchDownloaderWPF/WindowSettings.xaml.cs @@ -1,10 +1,14 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Input; using HandyControl.Data; +using TwitchDownloaderWPF.Extensions; using TwitchDownloaderWPF.Models; using TwitchDownloaderWPF.Properties; using TwitchDownloaderWPF.Services; @@ -322,5 +326,51 @@ private void ComboLogLevels_OnSelectionChanged(object sender, SelectionChangedEv .Sum(item => (int)item.Tag); Settings.Default.LogLevels = newLogLevel; } + + private void FilenameParameter_MouseDown(object sender, MouseButtonEventArgs e) + { + if (!IsInitialized || sender is not Run { Text: var parameter }) + return; + + if (e.ChangedButton is not MouseButton.Left and not MouseButton.Middle) + return; + + var focusedElement = Keyboard.FocusedElement; + var textBox = GetFilenameTemplateTextBox(focusedElement); + + if (textBox is null) + return; + + var oldCaretPos = textBox.CaretIndex; + if (!textBox.TryInsertAtCaret(parameter)) + return; + + if (e.ChangedButton is MouseButton.Middle && oldCaretPos != -1) + { + // If we inserted a *_custom template, we can focus inside the quotation marks + var quoteIndex = parameter.LastIndexOf('"'); + if (quoteIndex != -1) + { + textBox.CaretIndex = oldCaretPos + quoteIndex; + } + } + + e.Handled = true; + } + + [return: MaybeNull] + private TextBox GetFilenameTemplateTextBox(IInputElement inputElement) + { + if (ReferenceEquals(inputElement, TextVodTemplate)) + return TextVodTemplate; + + if (ReferenceEquals(inputElement, TextClipTemplate)) + return TextClipTemplate; + + if (ReferenceEquals(inputElement, TextChatTemplate)) + return TextChatTemplate; + + return null; + } } }