Skip to content

Commit

Permalink
v3.0.0.42 - Fix blacklist not accepting newline.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonymous authored and Anonymous committed Oct 9, 2024
1 parent c524e27 commit 0a3a69e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e621 ReBot v3/Windows/Window_Blacklist.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
Title="Blacklist" Height="256" Width="512" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" Loaded="Window_Loaded" Closed="Window_Closed">

<Grid>
<TextBox x:Name="Blacklist_TextBox" Background="Silver" TextWrapping="NoWrap" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Margin="2" TabIndex="1" ToolTip="Tags can be combined by entering them on the same line, separated by a space.&#xA;Each line is regarded separately.&#xA;Use shortened terms 'e', 'q', 's' for ratings.&#xA;&#xA;Blacklist applies to downloads from e621 via API (pool downloads ignore it)."/>
<TextBox x:Name="Blacklist_TextBox" Background="Silver" TextWrapping="NoWrap" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible" Margin="2" TabIndex="1" ToolTip="Tags can be combined by entering them on the same line, separated by a space.&#xA;Each line is regarded separately.&#xA;Use shortened terms 'e', 'q', 's' for ratings.&#xA;&#xA;Blacklist applies to downloads from e621 via API (pool downloads ignore it)." AcceptsReturn="True" PreviewKeyDown="Blacklist_TextBox_PreviewKeyDown"/>
</Grid>
</Window>
25 changes: 23 additions & 2 deletions e621 ReBot v3/Windows/Window_Blacklist.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace e621_ReBot_v3
{
Expand All @@ -20,16 +21,36 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (AppSettings.Blacklist.Any())
{
Blacklist_TextBox.Text = string.Join(' ', AppSettings.Blacklist);
Blacklist_TextBox.Text = string.Join(Environment.NewLine, AppSettings.Blacklist) + Environment.NewLine;
Blacklist_TextBox.SelectionStart = Blacklist_TextBox.Text.Length;
}
Blacklist_TextBox.Focus();
}

private void Blacklist_TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Enter:
{
if (Blacklist_TextBox.SelectionStart > 2)
{
string NewLineChecker = Blacklist_TextBox.Text.Substring(Blacklist_TextBox.SelectionStart - 2, 2);
if (NewLineChecker.Equals("\r\n"))
{
e.Handled = true;
return;
}
}
break;
}
}
}

private void Window_Closed(object sender, EventArgs e)
{
List<string> NewBlacklist = new List<string>();
Blacklist_TextBox.Text = Blacklist_TextBox.Text.ToLower();
Blacklist_TextBox.Text = Blacklist_TextBox.Text.Trim().ToLower();
for (int i = 0; i < Blacklist_TextBox.LineCount; i++)
{
string TBLine = Blacklist_TextBox.GetLineText(i).Trim();
Expand Down
2 changes: 1 addition & 1 deletion e621 ReBot v3/e621 ReBot v3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ApplicationIcon>Resources\ReBot_Icon.ico</ApplicationIcon>
<Platforms>x64</Platforms>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<FileVersion>3.0.0.41</FileVersion>
<FileVersion>3.0.0.42</FileVersion>
<StartupObject>e621_ReBot_v3.App</StartupObject>
<IsPublishable>False</IsPublishable>
<RepositoryUrl>https://github.com/e621-ReBot/e621-ReBot-v3</RepositoryUrl>
Expand Down

0 comments on commit 0a3a69e

Please sign in to comment.