diff --git a/XIVChat Desktop/Connection.cs b/XIVChat Desktop/Connection.cs index dca87c0..4d9c6ee 100644 --- a/XIVChat Desktop/Connection.cs +++ b/XIVChat Desktop/Connection.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.Linq; using System.Net.Sockets; using System.Security.Cryptography; -using System.Text; using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; @@ -261,7 +260,7 @@ namespace XIVChat_Desktop { Console.WriteLine(inner.StackTrace); } }); - if (!(ex.InnerException is CryptographicException)) { + if (ex.InnerException is not CryptographicException) { this.app.Disconnect(); break; } diff --git a/XIVChat Desktop/MainWindow.xaml.cs b/XIVChat Desktop/MainWindow.xaml.cs index 1666e88..8049163 100644 --- a/XIVChat Desktop/MainWindow.xaml.cs +++ b/XIVChat Desktop/MainWindow.xaml.cs @@ -310,7 +310,7 @@ namespace XIVChat_Desktop { // detect if scroller is at the bottom var scroller = this.FindElementByName(this.Tabs, "scroller"); var verticalOffset = scroller!.VerticalOffset; - var wasAtBottom = Math.Abs(verticalOffset - scroller.ScrollableHeight) < .0001; + var wasAtBottom = Math.Abs(verticalOffset - scroller.ScrollableHeight) < .1; // add message to main list this.Messages.Add(message); @@ -358,7 +358,7 @@ namespace XIVChat_Desktop { } private void Input_Submit(object sender, KeyEventArgs e) { - if (!(sender is TextBox textBox)) { + if (sender is not TextBox textBox) { return; } diff --git a/XIVChat Desktop/MaximiseHelper.cs b/XIVChat Desktop/MaximiseHelper.cs index d2cefca..ae0380d 100644 --- a/XIVChat Desktop/MaximiseHelper.cs +++ b/XIVChat Desktop/MaximiseHelper.cs @@ -6,7 +6,7 @@ using System.Windows.Interop; namespace XIVChat_Desktop { public static class MaximiseHelper { public static void FixMaximise(object? sender, EventArgs e) { - if (!(sender is Window window)) { + if (sender is not Window window) { return; } diff --git a/XIVChat Desktop/Util.cs b/XIVChat Desktop/Util.cs index 777562e..26ec049 100644 --- a/XIVChat Desktop/Util.cs +++ b/XIVChat Desktop/Util.cs @@ -77,7 +77,7 @@ namespace XIVChat_Desktop { public static bool IsWhitespace(this char c) { // 2.1 Characters and lines // A whitespace character is a space(U + 0020), tab(U + 0009), newline(U + 000A), line tabulation (U + 000B), form feed (U + 000C), or carriage return (U + 000D). - return c <= ' ' && (c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'); + return c is <= ' ' and (' ' or '\t' or '\n' or '\v' or '\f' or '\r'); } public static string? WorldName(ushort id) { @@ -715,7 +715,7 @@ namespace XIVChat_Desktop { public class RegexValidator : ValidationRule { public override ValidationResult Validate(object value, CultureInfo cultureInfo) { - if (!(value is string text)) { + if (value is not string text) { return new ValidationResult(false, "Value is not text."); } @@ -728,7 +728,7 @@ namespace XIVChat_Desktop { public class StringWrapper : INotifyPropertyChanged { private string value; - public String Value { + public string Value { get => this.value; set { this.value = value;