Skip to content

Commit 240a250

Browse files
committed
User registration has also been added to the Admin Panel.
Better handling of the game settings early access check box Added 'getallgames' to the clients query API
1 parent 10dbd57 commit 240a250

12 files changed

Lines changed: 414 additions & 14 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# GameVault App Changelog
22

3+
##1.17.1
4+
Recommended Gamevault Server Version: `v15.0.2`
5+
### Changes
6+
- User registration has also been added to the Admin Panel.
7+
- Better handling of the game settings early access check box
8+
- Added 'getallgames' to the clients query API
9+
310
## 1.17.0
411
Recommended Gamevault Server Version: `v15.0.0`
512
### Changes

gamevault/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//(used if a resource is not found in the page,
1212
// app, or any theme specific resource dictionaries)
1313
)]
14-
[assembly: AssemblyVersion("1.17.0.0")]
14+
[assembly: AssemblyVersion("1.17.1.0")]
1515
[assembly: AssemblyCopyright("© Phalcode™. All Rights Reserved.")]
1616
#if DEBUG
1717
[assembly: XmlnsDefinition("debug-mode", "Namespace")]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows.Data;
8+
9+
namespace gamevault.Converter
10+
{
11+
internal class GameSettingsEarlyAccessContentConverter : IMultiValueConverter
12+
{
13+
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
14+
{
15+
if (values[1]!=null)
16+
{
17+
return values[1];
18+
}
19+
return values[0];
20+
}
21+
22+
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
23+
{
24+
return null;
25+
}
26+
}
27+
}

gamevault/PipeServiceHandler.cs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
using System;
1+
using gamevault.Helper;
2+
using gamevault.Models;
3+
using gamevault.UserControls;
4+
using gamevault.ViewModels;
5+
using System;
6+
using System.Collections;
27
using System.Diagnostics;
38
using System.IO;
49
using System.IO.Pipes;
510
using System.Linq;
611
using System.Security.Principal;
12+
using System.Text;
713
using System.Text.Json;
814
using System.Threading.Tasks;
915
using System.Windows;
10-
using gamevault.Helper;
11-
using gamevault.Models;
12-
using gamevault.UserControls;
13-
using gamevault.ViewModels;
1416
using Windows.Devices.Sms;
1517

1618
namespace gamevault
@@ -697,6 +699,11 @@ public enum ActionQueryEnum
697699
/// </summary>
698700
IsLoggedIn,
699701

702+
/// <summary>
703+
/// Returns all Games of the server the current profile is connected to
704+
/// </summary>
705+
GetAllGames
706+
700707
}
701708

702709
/// <summary>
@@ -773,6 +780,16 @@ private async Task<string> HandleQuery(CommandOptions options)
773780

774781
return installDirectory ?? "";
775782
}
783+
case ActionQueryEnum.GetAllGames:
784+
{
785+
try
786+
{
787+
string result = await WebHelper.GetAsync(@$"{SettingsViewModel.Instance.ServerUrl}/api/games?limit=-1");
788+
return Convert.ToBase64String(Encoding.UTF8.GetBytes(result));
789+
}
790+
catch { }
791+
return "";
792+
}
776793
case ActionQueryEnum.GetServerUrl:
777794
return SettingsViewModel.Instance.ServerUrl;
778795
case ActionQueryEnum.GetAppVersion:

gamevault/UserControls/AdminConsoleUserControl.xaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<ScaleTransform ScaleX="0.05" ScaleY="0.05"/>
7474
</mah:ToggleSwitch.RenderTransform>
7575
</mah:ToggleSwitch>
76-
<Grid x:Name="uiBtnReload" Style="{DynamicResource HoverEffect}" Background="Transparent" Cursor="Hand" Width="2" Height="2" Margin="-287,2,0,0" ToolTip="Refresh admin console (F5)" MouseLeftButtonUp="Reload_Click">
76+
<Grid x:Name="uiBtnReload" Style="{DynamicResource HoverEffect}" Background="Transparent" Cursor="Hand" Width="2" Height="2" Margin="-286.59,2,0,0" ToolTip="Refresh admin console (F5)" MouseLeftButtonUp="Reload_Click">
7777
<Path Data="{StaticResource IconReload}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" RenderTransformOrigin="0.49,0.49" Margin="-9,-9,-9,-9">
7878
<Path.RenderTransform>
7979
<ScaleTransform ScaleX="0.1" ScaleY="0.1"/>
@@ -90,6 +90,18 @@
9090
<Border Background="{DynamicResource MahApps.Brushes.ThemeBackground2}" Margin="0,0.5,0,0" CornerRadius="1">
9191
<Grid>
9292
<TextBlock Text="Users" FontSize="1.5" FontWeight="Bold" VerticalAlignment="Top" Margin="1,0,0,0"/>
93+
<Button Style="{StaticResource ButtonWrapper}" VerticalAlignment="Top" HorizontalAlignment="Right" Cursor="Hand" Width="2.5" Height="2.5" Margin="0,0.5,1,0" Click="RegistrateUser_Click" ToolTip="Registrate new User">
94+
<Grid Style="{DynamicResource HoverEffect}" Background="Transparent" RenderTransformOrigin="0.5,0.5">
95+
<Path Data="{StaticResource IconAddSimple}" Fill="{DynamicResource MahApps.Brushes.ThemeForeground}" Stroke="{DynamicResource MahApps.Brushes.ThemeForeground}" Margin="0.13,0.13,-22,-22">
96+
<Path.RenderTransform>
97+
<ScaleTransform ScaleX="0.09" ScaleY="0.09"/>
98+
</Path.RenderTransform>
99+
</Path>
100+
<Grid.RenderTransform>
101+
<ScaleTransform/>
102+
</Grid.RenderTransform>
103+
</Grid>
104+
</Button>
93105
<ItemsControl ItemsSource="{Binding Path=Users}" Margin="0,1.4,0,1" >
94106
<ItemsControl.ItemsPanel>
95107
<ItemsPanelTemplate>

gamevault/UserControls/AdminConsoleUserControl.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ private void ServerUpdate_Navigate(object sender, RequestNavigateEventArgs e)
266266
e.Handled = true;
267267
}
268268

269-
269+
private void RegistrateUser_Click(object sender, RoutedEventArgs e)
270+
{
271+
MainWindowViewModel.Instance.OpenPopup(new RegistrationUserControl());
272+
}
270273
}
271274
}

gamevault/UserControls/GameSettingsUserControl.xaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<conv:InverseNullConverter x:Key="invNullConv"/>
5858
<conv:StringToArrayConverter x:Key="stringToArrayConv"/>
5959
<conv:IsGameMappedConverter x:Key="isGameMappedConv"/>
60+
<conv:GameSettingsEarlyAccessContentConverter x:Key="earlyAccessContentConv"/>
6061
</UserControl.Resources>
6162
<UserControl.InputBindings>
6263
<KeyBinding Key="Esc">
@@ -634,7 +635,27 @@
634635
<TextBox Width="100" Margin="115,0,0,0" mah:TextBoxHelper.Watermark="{Binding Game.Metadata.AgeRating}" mah:TextBoxHelper.UseFloatingWatermark="True" Text="{Binding UpdateGame.UserMetadata.AgeRating,TargetNullValue='',FallbackValue={x:Null}}" mah:ControlsHelper.CornerRadius="5"/>
635636
<DatePicker Width="100" Margin="69,0,0,0" SelectedDate="{Binding UpdateGame.UserMetadata.ReleaseDate}" mah:TextBoxHelper.Watermark="{Binding Path=Game.Metadata.ReleaseDate,StringFormat='{}{0:dd/MM/yyyy}'}" mah:ControlsHelper.CornerRadius="5" mah:TextBoxHelper.UseFloatingWatermark="True"/>
636637
<TextBox Width="100" Margin="67,0,0,0" mah:TextBoxHelper.Watermark="{Binding Game.Metadata.Rating}" mah:TextBoxHelper.UseFloatingWatermark="True" Text="{Binding UpdateGame.UserMetadata.Rating}" mah:ControlsHelper.CornerRadius="5"/>
637-
<CheckBox Content="{Binding Game.Metadata.EarlyAccess}" IsChecked="{Binding UpdateGame.UserMetadata.EarlyAccess}" Margin="68,0,0,0"/>
638+
<Grid Margin="68,0,0,0">
639+
<CheckBox Margin="0,0,0,0" mah:CheckBoxHelper.CheckCornerRadius="5">
640+
<CheckBox.Style>
641+
<Style TargetType="CheckBox" BasedOn="{StaticResource MahApps.Styles.CheckBox}">
642+
<Style.Triggers>
643+
<DataTrigger Binding="{Binding UpdateGame.UserMetadata.EarlyAccess}" Value="{x:Null}">
644+
<Setter Property="IsChecked" Value="{Binding Game.Metadata.EarlyAccess}"/>
645+
</DataTrigger>
646+
</Style.Triggers>
647+
</Style>
648+
</CheckBox.Style>
649+
</CheckBox>
650+
<CheckBox PreviewMouseLeftButtonDown="CheckBox_PreviewMouseLeftButtonDown" Click="CheckBox_Click" IsChecked="{Binding UpdateGame.UserMetadata.EarlyAccess}" mah:CheckBoxHelper.CheckCornerRadius="5" mah:CheckBoxHelper.CheckBackgroundFillIndeterminateMouseOver="Transparent" mah:CheckBoxHelper.CheckBackgroundFillIndeterminatePressed="Transparent" mah:CheckBoxHelper.CheckBackgroundFillChecked="Transparent" mah:CheckBoxHelper.CheckBackgroundFillUnchecked="Transparent" mah:CheckBoxHelper.CheckBackgroundFillIndeterminate="Transparent" mah:CheckBoxHelper.CheckGlyphForegroundIndeterminate="Transparent" mah:CheckBoxHelper.CheckGlyphForegroundIndeterminateMouseOver="Transparent" mah:CheckBoxHelper.CheckGlyphForegroundIndeterminatePressed="Transparent">
651+
<CheckBox.Content>
652+
<MultiBinding Converter="{StaticResource earlyAccessContentConv}">
653+
<Binding Path="Game.Metadata.EarlyAccess"/>
654+
<Binding Path="UpdateGame.UserMetadata.EarlyAccess"/>
655+
</MultiBinding>
656+
</CheckBox.Content>
657+
</CheckBox>
658+
</Grid>
638659
</StackPanel>
639660

640661
<TextBlock Text="Default Launch Executable" FontSize="15" FontWeight="Bold" TextDecorations="Underline" Margin="0,5,0,5"/>

gamevault/UserControls/GameSettingsUserControl.xaml.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,36 @@ private void KeepData_Click(object sender, RoutedEventArgs e)
983983
}
984984
catch { }
985985
}
986+
986987
#endregion
987988

989+
#region EarlyAccessToggleFix
990+
private bool needEarlyAccessToggleFix = false;
991+
private void CheckBox_Click(object sender, RoutedEventArgs e)
992+
{
993+
try
994+
{
995+
if (needEarlyAccessToggleFix)
996+
{
997+
needEarlyAccessToggleFix = false;
998+
var checkBox = sender as CheckBox;
999+
checkBox.IsChecked = true;
1000+
}
1001+
}
1002+
catch { }
1003+
}
1004+
1005+
private void CheckBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1006+
{
1007+
try
1008+
{
1009+
if (ViewModel.UpdateGame?.UserMetadata?.EarlyAccess == null && ViewModel.Game?.Metadata?.EarlyAccess == false)
1010+
{
1011+
needEarlyAccessToggleFix = true;
1012+
}
1013+
}
1014+
catch { }
1015+
}
1016+
#endregion
9881017
}
9891018
}

0 commit comments

Comments
 (0)