Skip to content

Commit

Permalink
Release 1.8.2
Browse files Browse the repository at this point in the history
Release 1.8.2
  • Loading branch information
Yelo420 authored Jan 14, 2024
2 parents d5f780b + 3158217 commit 780f378
Show file tree
Hide file tree
Showing 36 changed files with 445 additions and 260 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# GameVault App Changelog

## 1.8.2
Recommended Gamevault Server Version: `v10.1.0`
### Changes
- Write permissions of the root folder are now checked on selection
- The scrollbar in the download tab now covers the entire tab
- Improved error messages
- Sort installed games by last played
- The download icon in the game view now changes depending on whether the game has already been downloaded
- Added more details to gamesettings ring chart
- Changed default background of game view
- You can now also open the user settings from the settings tab
- The mouse wheel now scrolls horizontally in the installed game scrollbar when visible
- A message is now displayed when an admin tries to change their role
- Added Troubleshoot message to the library expander if the library fails to load
- Bug fix: The library does not load automatically on first login

## 1.8.1
Recommended Gamevault Server Version: `v10.0.2`
### Changes
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Converter/GameSettingsTabVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return Visibility.Collapsed;
if (parameter.ToString() == "local")
{
if (NewInstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)value).ID).Count() > 0)
if (InstallViewModel.Instance.InstalledGames.Where(g => g.Key.ID == ((Game)value).ID).Count() > 0)
{
return Visibility.Visible;
}
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Helper/CacheHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal static async Task<BitmapImage> HandleImageCacheAsync(int identifier, in
}
default:
{
return BitmapHelper.GetBitmapImage("pack://application:,,,/gamevault;component/Resources/Images/gameView_NoBackground.png");
return BitmapHelper.GetBitmapImage("pack://application:,,,/gamevault;component/Resources/Images/gameView_NoBackground.jpg");
}
}
}
Expand Down
29 changes: 15 additions & 14 deletions gamevault/Helper/LoginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static LoginManager Instance
#endregion
private User? m_User { get; set; }
private LoginState m_LoginState { get; set; }
private string m_LoginMessage { get; set; }
public User? GetCurrentUser()
{
return m_User;
Expand All @@ -53,6 +54,10 @@ public LoginState GetState()
{
return m_LoginState;
}
public string GetLoginMessage()
{
return m_LoginMessage;
}
public void SwitchToOfflineMode()
{
MainWindowViewModel.Instance.OnlineState = System.Windows.Visibility.Visible;
Expand All @@ -70,17 +75,15 @@ public async Task StartupLogin()
string result = WebHelper.GetRequest(@$"{SettingsViewModel.Instance.ServerUrl}/api/users/me");
return JsonSerializer.Deserialize<User>(result);
}
catch (WebException ex)
catch (Exception ex)
{
string code = WebExceptionHelper.GetServerStatusCode(ex);
state = DetermineLoginState(code);
if (state == LoginState.Error)
m_LoginMessage = WebExceptionHelper.TryGetServerMessage(ex);
return null;
}
catch
{
state = LoginState.Error;
return null;
}
}
});
m_User = user;
m_LoginState = state;
Expand All @@ -96,17 +99,15 @@ public async Task<LoginState> ManualLogin(string username, string password)
string result = WebHelper.GetRequest(@$"{SettingsViewModel.Instance.ServerUrl}/api/users/me");
return JsonSerializer.Deserialize<User>(result);
}
catch (WebException ex)
catch (Exception ex)
{
string code = WebExceptionHelper.GetServerStatusCode(ex);
state = DetermineLoginState(code);
if (state == LoginState.Error)
m_LoginMessage = WebExceptionHelper.TryGetServerMessage(ex);
return null;
}
catch
{
state = LoginState.Error;
return null;
}
}
});
m_User = user;
m_LoginState = state;
Expand Down
23 changes: 19 additions & 4 deletions gamevault/Helper/WebExceptionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace gamevault.Helper
{
internal class WebExceptionHelper
{
internal static string GetServerMessage(WebException ex)
private static string GetServerMessage(WebException ex)
{
string errMessage = string.Empty;
try
Expand All @@ -23,15 +23,30 @@ internal static string GetServerMessage(WebException ex)
catch { }
return errMessage;
}
internal static string GetServerStatusCode(WebException ex)
/// <summary>
/// Tries to get the response message of the server. Else returns exception message
/// </summary>
internal static string TryGetServerMessage(Exception ex)
{
if (ex is WebException webEx)
{
string msg = GetServerMessage(webEx);
return string.IsNullOrEmpty(msg) ? ex.Message : $"Server responded: {msg}";
}
return ex.Message;
}
internal static string GetServerStatusCode(Exception ex)
{
if (ex is not WebException webex)
return "";

string errMessage = string.Empty;
try
{
if (ex.Response == null)
if (webex.Response == null)
return string.Empty;

var resp = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
var resp = new StreamReader(webex.Response.GetResponseStream()).ReadToEnd();
JsonObject obj = JsonNode.Parse(resp).AsObject();
errMessage = obj["statusCode"].ToString().Replace("\n", " ").Replace("\r", "");
}
Expand Down
3 changes: 2 additions & 1 deletion gamevault/Models/AppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public enum AppConfigKey
DownloadLimit,
InstalledGamesOpen,
LaunchParameter,
ShowRawgTitle
ShowRawgTitle,
LastPlayed
}
public static class AppFilePath
{
Expand Down
3 changes: 3 additions & 0 deletions gamevault/Resources/Assets/Icons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<Geometry x:Key="IconDownload">
M6.5 20q-2.275 0-3.887-1.575T1 14.575q0-1.95 1.175-3.475T5.25 9.15q.575-2.025 2.138-3.4T11 4.075v8.075l-.9-.875Q9.825 11 9.413 11t-.713.3q-.275.275-.275.7t.275.7l2.6 2.6q.3.3.7.3t.7-.3l2.6-2.6q.275-.275.287-.687T15.3 11.3q-.275-.275-.687-.288t-.713.263l-.9.875V4.075q2.575.35 4.288 2.313T19 11q1.725.2 2.863 1.488T23 15.5q0 1.875-1.312 3.188T18.5 20z
</Geometry>
<Geometry x:Key="IconReDownload">
M 21.86,12.5 C 21.136901,11.648481 20.111617,11.110744 19,11 19,9.05 18.32,7.4 16.96,6.04 15.6,4.68 13.95,4 12,4 10.42,4 9,4.47 7.75,5.43 6.5,6.39 5.67,7.62 5.25,9.15 4,9.43 2.96,10.08 2.17,11.1 1.38,12.12 1,13.28 1,14.58 1,16.09 1.54,17.38 2.61,18.43 3.69,19.5 5,20 6.5,20 h 12 c 1.25,0 2.31,-0.44 3.19,-1.31 0.87,-0.88 1.31,-1.94 1.31,-3.19 0,-1.15 -0.38,-2.15 -1.14,-3 M 15.333333,13 H 12.666667 A 0.27614238,0.27614238 67.5 0 1 12.471405,12.528595 L 13.77,11.23 c -1.63551,-1.6360975 -4.424029,-0.36441 -4.261745,1.942844 0.145944,2.074943 2.537652,2.98654 4.029074,1.804297 0.28765,-0.228019 0.574997,-0.487534 0.713796,-0.487026 0.237091,8.67e-4 0.530819,0.0027 0.792435,0.0046 0.368066,0.0026 0.559281,0.286526 0.367155,0.600114 C 14.692336,16.267379 13.40647,17.002809 12,17 9.79,17 8,15.21 8,13 8,10.79 9.79,9 12,9 c 1.11,0 2.11,0.45 2.83,1.17 L 15.528595,9.4714045 A 0.27614238,0.27614238 22.5 0 1 16,9.6666667 V 12.333333 A 0.66666667,0.66666667 135 0 1 15.333333,13 Z
</Geometry>
<Geometry x:Key="IconTrash">
M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v10zM18 4h-2.5l-.71-.71c-.18-.18-.44-.29-.7-.29H9.91c-.26 0-.52.11-.7.29L8.5 4H6c-.55 0-1 .45-1 1s.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1z
</Geometry>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed gamevault/Resources/Images/gameView_NoBackground.png
Binary file not shown.
55 changes: 40 additions & 15 deletions gamevault/UserControls/AdminConsoleUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using gamevault.Models;
using gamevault.UserControls.SettingsComponents;
using gamevault.ViewModels;
using gamevault.Windows;
using MahApps.Metro.Controls.Dialogs;
using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -56,14 +59,14 @@ public async Task InitUserList()
return JsonSerializer.Deserialize<User[]>(userList);
});
}
catch (WebException ex)
catch (Exception ex)
{
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
}

private void PermissionRole_SelectionChanged(object sender, SelectionChangedEventArgs e)
private async void PermissionRole_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
Expand All @@ -72,12 +75,24 @@ private void PermissionRole_SelectionChanged(object sender, SelectionChangedEven
{
return;
}
if (LoginManager.Instance.IsLoggedIn() && selectedUser.ID == LoginManager.Instance.GetCurrentUser().ID)
{
MessageDialogResult result = await ((MetroWindow)App.Current.MainWindow).ShowMessageAsync($"Are you sure you want to change your role?",
"", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Yes", NegativeButtonText = "No", AnimateHide = false });
if (result != MessageDialogResult.Affirmative)
{
((ComboBox)sender).SelectionChanged -= PermissionRole_SelectionChanged;
((ComboBox)sender).SelectedValue = e.RemovedItems[0];
((ComboBox)sender).SelectionChanged += PermissionRole_SelectionChanged;
return;
}
}
WebHelper.Put(@$"{SettingsViewModel.Instance.ServerUrl}/api/users/{selectedUser.ID}", JsonSerializer.Serialize(new User() { Role = selectedUser.Role }));
MainWindowViewModel.Instance.AppBarText = $"Successfully updated permission role of user '{selectedUser.Username}' to '{selectedUser.Role}'";
}
catch (WebException ex)
catch (Exception ex)
{
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
}
Expand All @@ -91,18 +106,28 @@ private void Activated_Toggled(object sender, RoutedEventArgs e)
string state = selectedUser.Activated == true ? "activated" : "deactivated";
MainWindowViewModel.Instance.AppBarText = $"Successfully {state} user '{selectedUser.Username}'";
}
catch (WebException ex)
catch (Exception ex)
{
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
}

private async void DeleteUser_Clicked(object sender, MouseButtonEventArgs e)
{
this.IsEnabled = false;

User selectedUser = (User)((FrameworkElement)sender).DataContext;
if (selectedUser == null)
return;

if (selectedUser.DeletedAt == null)
{
MessageDialogResult result = await ((MetroWindow)App.Current.MainWindow).ShowMessageAsync($"Are you sure you want to delete User '{selectedUser.Username}' ?",
"", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = "Yes", NegativeButtonText = "No", AnimateHide = false });
if (result != MessageDialogResult.Affirmative)
return;
}
this.IsEnabled = false;
await Task.Run(async () =>
{
try
Expand All @@ -120,17 +145,17 @@ await Task.Run(async () =>
await InitUserList();
}
}
catch (WebException ex)
catch (Exception ex)
{
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
});
this.IsEnabled = true;
}

private void EditUser_Clicked(object sender, MouseButtonEventArgs e)
{
{
User user = JsonSerializer.Deserialize<User>(JsonSerializer.Serialize((User)((FrameworkElement)sender).DataContext));
MainWindowViewModel.Instance.OpenPopup(new UserSettingsUserControl(user) { Width = 1200, Height = 800, Margin = new Thickness(50) });
}
Expand Down Expand Up @@ -158,10 +183,10 @@ await Task.Run(() =>
WebHelper.Put(@$"{SettingsViewModel.Instance.ServerUrl}/api/users/{selectedUser.ID}", JsonSerializer.Serialize(selectedUser));
MainWindowViewModel.Instance.AppBarText = "Sucessfully saved user changes";
}
catch (WebException ex)
catch (Exception ex)
{
error = true;
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
});
Expand Down Expand Up @@ -198,9 +223,9 @@ await Task.Run(() =>
WebHelper.Put(@$"{SettingsViewModel.Instance.ServerUrl}/api/files/reindex", string.Empty);
MainWindowViewModel.Instance.AppBarText = "Sucessfully reindexed games";
}
catch (WebException ex)
catch (Exception ex)
{
string msg = WebExceptionHelper.GetServerMessage(ex);
string msg = WebExceptionHelper.TryGetServerMessage(ex);
MainWindowViewModel.Instance.AppBarText = msg;
}
});
Expand Down
10 changes: 3 additions & 7 deletions gamevault/UserControls/CommunityUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private async void Users_SelectionChanged(object sender, SelectionChangedEventAr
uiSortBy.SelectedIndex = 2;
}
}
catch (Exception ex) { MainWindowViewModel.Instance.AppBarText = "Could not connect to server"; }
catch (Exception ex) { MainWindowViewModel.Instance.AppBarText = WebExceptionHelper.TryGetServerMessage(ex); }
}
private User[] BringCurrentUserToTop(User[] users)
{
Expand Down Expand Up @@ -182,7 +182,7 @@ private void GameImage_MouseLeftButtonUp(object sender, System.Windows.Input.Mou
MainWindowViewModel.Instance.AppBarText = "Cannot open unknown game";
return;
}
MainWindowViewModel.Instance.SetActiveControl(new NewGameViewUserControl(((Progress)((FrameworkElement)sender).DataContext).Game));
MainWindowViewModel.Instance.SetActiveControl(new GameViewUserControl(((Progress)((FrameworkElement)sender).DataContext).Game));
}
private async void ReloadUser_Clicked(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Expand Down Expand Up @@ -230,13 +230,9 @@ private async void DeleteProgress_Click(object sender, System.Windows.Input.Mous
MainWindowViewModel.Instance.AppBarText = $"Successfully deleted progress";
}
}
catch (WebException webex)
{
MainWindowViewModel.Instance.AppBarText = $"Could not delete the Progress. {WebExceptionHelper.GetServerMessage(webex)}";
}
catch (Exception ex)
{
MainWindowViewModel.Instance.AppBarText = $"Could not delete the Progress. {ex.Message}";
MainWindowViewModel.Instance.AppBarText = $"Could not delete. {WebExceptionHelper.TryGetServerMessage(ex)}";
}
}
}
Expand Down
33 changes: 17 additions & 16 deletions gamevault/UserControls/DownloadsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,23 @@
</TextBlock.Style>
</TextBlock>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<ScrollViewer Grid.Column="1" Margin="10,10,0,0" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto">
<Viewbox>
<ItemsControl ItemsSource="{Binding DownloadedGames}" Focusable="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Viewbox>
<ScrollViewer Grid.Column="1" VerticalAlignment="Top" Margin="10,10,0,10" VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Viewbox Grid.Column="1">
<ItemsControl ItemsSource="{Binding DownloadedGames}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Viewbox>
</Grid>
</ScrollViewer>
</Grid>
</Grid>
Expand Down
Loading

0 comments on commit 780f378

Please sign in to comment.