diff --git a/SS14.Launcher/LauncherMessaging.cs b/SS14.Launcher/LauncherMessaging.cs index cf790100a..0046c382f 100644 --- a/SS14.Launcher/LauncherMessaging.cs +++ b/SS14.Launcher/LauncherMessaging.cs @@ -237,12 +237,12 @@ private async Task ServerTask(LauncherCommands lc) if (token.IsCancellationRequested) break; try { - while (!sr.EndOfStream) + while (true) { - // Can't be cancelled - var line = await sr.ReadLineAsync().WaitAsync(token).ConfigureAwait(false); + var line = await sr.ReadLineAsync(token).ConfigureAwait(false); + // null means the client disconnected (end of stream). if (line == null) - continue; + break; if (line.StartsWith(LauncherCommands.VersionPrefix)) await AnswerVersion(line, lc); diff --git a/SS14.Launcher/Models/Data/TypeHandlers.cs b/SS14.Launcher/Models/Data/TypeHandlers.cs index aeab6e1ae..b9b4adf79 100644 --- a/SS14.Launcher/Models/Data/TypeHandlers.cs +++ b/SS14.Launcher/Models/Data/TypeHandlers.cs @@ -35,8 +35,10 @@ public override DateTimeOffset Parse(object value) public sealed class UriTypeHandler : SqlMapper.TypeHandler { - public override void SetValue(IDbDataParameter parameter, Uri value) + public override void SetValue(IDbDataParameter parameter, Uri? value) { + ArgumentNullException.ThrowIfNull(value); + if (!value.IsAbsoluteUri) throw new ArgumentException("Refusing to store relative URI to database"); diff --git a/SS14.Launcher/Models/Logins/LoggedInAccount.cs b/SS14.Launcher/Models/Logins/LoggedInAccount.cs index 2ba0861e3..ccb0debd8 100644 --- a/SS14.Launcher/Models/Logins/LoggedInAccount.cs +++ b/SS14.Launcher/Models/Logins/LoggedInAccount.cs @@ -6,7 +6,7 @@ namespace SS14.Launcher.Models.Logins; public abstract class LoggedInAccount : ObservableObject { - public string Username => LoginInfo.Username; + public string Username => LoginInfo.Username!; public Guid UserId => LoginInfo.UserId; protected LoggedInAccount(LoginInfo loginInfo) diff --git a/SS14.Launcher/Theme/ThemeTextBox.xaml b/SS14.Launcher/Theme/ThemeTextBox.xaml index 6f2a293c7..86782433b 100644 --- a/SS14.Launcher/Theme/ThemeTextBox.xaml +++ b/SS14.Launcher/Theme/ThemeTextBox.xaml @@ -12,12 +12,12 @@ Taken & modified from Avalonia's git repo. + Path="UseFloatingPlaceholder" /> @@ -33,7 +33,7 @@ Taken & modified from Avalonia's git repo. ( this IObservableCache cache, TKey key, [MaybeNullWhen(false)] out TValue value) + where TValue : notnull where TKey : notnull { var option = cache.Lookup(key); @@ -26,6 +27,7 @@ public static bool TryLookup( this SourceCache cache, TKey key, [MaybeNullWhen(false)] out TValue value) + where TValue : notnull where TKey : notnull { var option = cache.Lookup(key); diff --git a/SS14.Launcher/ViewModels/AccountDropDownViewModel.cs b/SS14.Launcher/ViewModels/AccountDropDownViewModel.cs index 4a205cdb5..c9d9a7020 100644 --- a/SS14.Launcher/ViewModels/AccountDropDownViewModel.cs +++ b/SS14.Launcher/ViewModels/AccountDropDownViewModel.cs @@ -126,6 +126,6 @@ public string StatusText public AvailableAccountViewModel(LoggedInAccount account) { - Account = account; + _account = account; } } diff --git a/SS14.Launcher/ViewModels/MainWindowTabs/HomePageViewModel.cs b/SS14.Launcher/ViewModels/MainWindowTabs/HomePageViewModel.cs index d8319302f..b055c3c6f 100644 --- a/SS14.Launcher/ViewModels/MainWindowTabs/HomePageViewModel.cs +++ b/SS14.Launcher/ViewModels/MainWindowTabs/HomePageViewModel.cs @@ -48,7 +48,7 @@ public HomePageViewModel(MainWindowViewModel mainWindowViewModel) }) // Removed favorites must not keep being refreshed (and queried) from the cache. .OnItemRemoved(a => _statusCache.Remove(a.CacheData.Address)) - .Sort(Comparer.Create((a, b) => { + .SortAndBind(out var favorites, Comparer.Create((a, b) => { var dc = a.Favorite!.RaiseTime.CompareTo(b.Favorite!.RaiseTime); if (dc != 0) { @@ -56,7 +56,6 @@ public HomePageViewModel(MainWindowViewModel mainWindowViewModel) } return string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase); })) - .Bind(out var favorites) .Subscribe(_ => { FavoritesEmpty = favorites.Count == 0; diff --git a/SS14.Launcher/Views/AddFavoriteDialog.xaml b/SS14.Launcher/Views/AddFavoriteDialog.xaml index f9d53e568..e6e97f938 100644 --- a/SS14.Launcher/Views/AddFavoriteDialog.xaml +++ b/SS14.Launcher/Views/AddFavoriteDialog.xaml @@ -20,9 +20,9 @@ - - diff --git a/SS14.Launcher/Views/DirectConnectDialog.xaml b/SS14.Launcher/Views/DirectConnectDialog.xaml index 94f7e873d..62a8d5c51 100644 --- a/SS14.Launcher/Views/DirectConnectDialog.xaml +++ b/SS14.Launcher/Views/DirectConnectDialog.xaml @@ -20,6 +20,6 @@ - + diff --git a/SS14.Launcher/Views/HubSettingsDialog.xaml b/SS14.Launcher/Views/HubSettingsDialog.xaml index 7df92ad3c..dc24121b3 100644 --- a/SS14.Launcher/Views/HubSettingsDialog.xaml +++ b/SS14.Launcher/Views/HubSettingsDialog.xaml @@ -123,7 +123,7 @@ diff --git a/SS14.Launcher/Views/Login/AuthTfaView.xaml b/SS14.Launcher/Views/Login/AuthTfaView.xaml index fff78e809..a1020b0f8 100644 --- a/SS14.Launcher/Views/Login/AuthTfaView.xaml +++ b/SS14.Launcher/Views/Login/AuthTfaView.xaml @@ -17,7 +17,7 @@ Text="{loc:Loc login-2fa-message}" /> diff --git a/SS14.Launcher/Views/Login/ExpiredLoginView.xaml b/SS14.Launcher/Views/Login/ExpiredLoginView.xaml index c38529644..5e897e2cc 100644 --- a/SS14.Launcher/Views/Login/ExpiredLoginView.xaml +++ b/SS14.Launcher/Views/Login/ExpiredLoginView.xaml @@ -20,7 +20,7 @@ - diff --git a/SS14.Launcher/Views/Login/LoginView.xaml b/SS14.Launcher/Views/Login/LoginView.xaml index 075c14fd6..f694de3fd 100644 --- a/SS14.Launcher/Views/Login/LoginView.xaml +++ b/SS14.Launcher/Views/Login/LoginView.xaml @@ -19,11 +19,11 @@ Text="{loc:Loc login-login-auth-server-changed}" IsVisible="{Binding Source={x:Static local:ConfigConstants.IsAuthOverride}}" /> diff --git a/SS14.Launcher/Views/MainWindowTabs/ServerListTabView.xaml b/SS14.Launcher/Views/MainWindowTabs/ServerListTabView.xaml index c3ef318b5..bb169a66f 100644 --- a/SS14.Launcher/Views/MainWindowTabs/ServerListTabView.xaml +++ b/SS14.Launcher/Views/MainWindowTabs/ServerListTabView.xaml @@ -28,8 +28,8 @@