Skip to content

Commit

Permalink
Dev (#35)
Browse files Browse the repository at this point in the history
Удаление дубликатов:

---

* Update host URL in ResourceKeysDictionary

The host URL used in the ResourceKeysDictionary file has been updated from a local address to a production address. Additionally, a minor formatting change was made in the OverviewPageViewModel file.

* Update submodule link Gml.Client

* Replace submodule update with git clone in scripts

The git submodule update command in both the 'load-repositories.sh' and 'load-repositories.bat' scripts has been replaced with git clone. This allows for repositories 'GamerVII.Notification.Avalonia' and 'Gml.Client' to be cloned directly instead of being updated through submodules.

* Update system service, resources, and application UI

The system service has been updated to asynchronously load system data. Additional resource keys and corresponding translations have been added to the localization service. Several changes have been made to the application user interface including a new splash screen, application icon, and version number.

* Add error tracking to AsyncStreamToImageLoader

The update wraps the core logic of the OnSourceChanged method inside a try-catch block. In case of any exceptions during execution, they are captured and sent to Sentry for error tracking and troubleshooting. This ensures smoother runtime and easier debugging.

* Update host URL and clean up code

The host URL in the ResourceKeysDictionary file was changed from a local IP address to an external URL "https://gmlb.recloud.tech".

* Gif background functionality (#29)

* Merge dev and master branches (#28)

* Add GIF decoding functionality

Introduced several new classes to handle the decoding of GIF files. This includes reading the data stream and processing headers, frames, color tables, and extensions. Functionality for rendering frames and handling exceptions has also been implemented.

* Refactor code and optimize exceptions in gif decoder

Code for gif decoding has been refactored for improved readability and efficiency. The exception handling has been optimized for specific errors, such as LzwDecompressionException, contributing to better error reporting and debugging. Unnecessary comments and code have also been removed.

* Remove unnecessary whitespace in AsyncStreamToImageLoader

This commit eliminates a redundant line in the AsyncStreamToImageLoader class file. The change helps to maintain the cleanliness and readability of the code.

* Refactor LoginPageViewModel and update AsyncStreamToImageLoader

This commit refactors LoginPageViewModel to change the type of _screen from IScreen to MainWindowViewModel. This allows the app to subscribe to the 'OnClosed' event of the main window, and dispose of connections when the window is closed to prevent memory leaks. AsyncStreamToImageLoader has also been updated to clear avatar image classes upfront and enhance filename checking mechanism to prevent non-loaded images.

* Update background component in MainWindow

Updated the background image's component in MainWindow.axaml file. Added a class attribute, which can be used for styling or Javascript manipulation in the future.

* Remove invalid character from document.svg

The first character of the document.svg file in the Gml.Launcher/Assets/Images directory was an invalid character and is now removed. This fix ensures that the SVG file is correctly formed and interprets as expected.

* Add 'launcher' project and comment out language combo box

Added a new 'launcher' project to the Gml.Launcher.sln file and made adjustments to project settings for consistency. Additionally, commented out the language selection combo box in the SettingsPageView.axaml as it is currently not in use.

* Switch host and update debugging settings

Furthermore, the debugging settings in App.axaml.cs have been updated to not debug mode, and the return value in case of null 'actualVersion' has been set to true in SplashScreenViewModel.cs.

* Optimize system data loading process

The previous implementation executed the tasks for refreshing the drive, motherboard, and CPU lists sequentially. This was unnecessarily time-consuming. With the new implementation, these tasks are run concurrently using Task.WhenAll method for better performance and efficiency.

* Change execution context for MainWindow in debug mode

This update modifies the execution context for MainWindow in the Gml.Launcher App. Previously, it was running in non-debug mode. Now, it is set up to run in debug mode.

* Disable window resizing and update pointer events handling

A new property `CanResize=False` has been added to the MainWindow.axaml to prevent the window from being resized. The pointer events handling logic was moved from OverviewPageView to MainWindow. This was done to ensure better control over dragging behavior and to prevent inappropriate actions during specific interactions.

* Update settings validation for window size

Improved the validation and error-handling approach for setting window size parameters. Now, the windowWidth and windowHeight values are only updated when numeric values are provided. If non-numeric values are input, they will be reset to default.

* Remove commented out code in MainWindow.axaml.cs

* Added default font

* Update font styles and host URL

This commit updates the font styles across several components, improving text readability and consistency. It also switches the host URL in the ResourceKeysDictionary to a production-ready address.

* Add new game session management and enhance game profile features

Enhanced game profile features by adding support for system types, file and profile session handling functionalities. Changes in the IGameProfile interface allow for game sessions to be locally stored and accessed. Introduced ProfileState type in the ProfileState enum. Also updated functionality to include OS specifics in process creation. This update increases compatibility across different systems and aids in clearer session management.

* Refactor code for skin rendering and noise string conversion

Specifically, the update handles question mark in the value for noise string conversion and it also removes unnecessary spaces in ProfilePageView.axaml. Moreover, unnecessary comments in ProfilePageViewModel.cs are cleaned up and HTTP header in skin rendering is updated to include User-Agent information.

* Update ProfileUserControl design

Changed the default skin URL to a new one, adjusted image and text alignment, and increased opacity of the profile gradient.

* Refactor client module for improved readability

Refactored the Gml.Client module to enhance code readability and maintainability. This involved restructuring functions, renaming variables for clarity, and adding comments where necessary. No functional changes were made to ensure existing behavior is preserved.
  • Loading branch information
GamerVII-NET authored Jun 30, 2024
1 parent 726cad9 commit 270ff84
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Gml.Client
5 changes: 3 additions & 2 deletions src/Gml.Launcher/Assets/Resources/ResourceKeysDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static class ResourceKeysDictionary
public const string CheckUpdates = "CheckUpdates";
public const string InstallingUpdates = "InstallingUpdates";
public const string FailedOs = "FailedOs";
// public const string Host = "http://192.168.31.199:5000";
public const string Host = "https://gmlb.recloud.tech";
public const string Host = "http://192.168.31.199:5000";
// public const string Host = "https://gmlb.recloud.tech";
// public const string Host = "https://gmlb-test.recloud.tech";
public const string FolderName = "GamerVIILacunerhV2";
}
2 changes: 1 addition & 1 deletion src/Gml.Launcher/Assets/Styles/Colors.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<SolidColorBrush x:Key="BadgeBorder">#20FFFFFF</SolidColorBrush>

<LinearGradientBrush x:Key="ProfileLinearGradient" StartPoint="50%, -80%" EndPoint="50%, 100%" Opacity=".2">
<LinearGradientBrush x:Key="ProfileLinearGradient" StartPoint="50%, -80%" EndPoint="50%, 100%" Opacity=".3">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Transparent" />
<GradientStop Offset="0.1" Color="#10018A44" />
Expand Down
4 changes: 4 additions & 0 deletions src/Gml.Launcher/Core/Converters/AsyncSkinRenderLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Gml.Client;
using Gml.Launcher.Core.Services;

namespace Gml.Launcher.Core.Converters;
Expand Down Expand Up @@ -52,6 +53,9 @@ private static async void OnSourceChanged(Image sender, AvaloniaPropertyChangedE
if (string.IsNullOrEmpty(url) || !ValidateUrl(url)) return;

using var client = new HttpClient();
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.UserAgent.ParseAdd(
$"Gml.Launcher-Client-{nameof(GmlClientManager)}/1.0 (OS: {Environment.OSVersion};)");
var response = await client.GetByteArrayAsync(url, cts.Token);
using var stream = new MemoryStream(response);

Expand Down
4 changes: 4 additions & 0 deletions src/Gml.Launcher/Core/Converters/NoiseStringAddConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class NoiseStringAddConverter : MarkupExtension, IValueConverter

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is not null && value.ToString()!.Contains('?'))
{
return value;
}

return $"{value}?{DateTime.Now:mm-ss-fff}";
}
Expand Down
4 changes: 2 additions & 2 deletions src/Gml.Launcher/ViewModels/Pages/OverviewPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ private async Task<Process> GenerateProcess(CancellationToken cancellationToken,

await _gmlManager.DownloadNotInstalledFiles(profileInfo.Data, cancellationToken);

var process = await _gmlManager.GetProcess(profileInfo.Data);
var process = await _gmlManager.GetProcess(profileInfo.Data, _systemService.GetOsType());

await _gmlManager.ClearFiles(profileInfo.Data);

UpdateProgress(
Expand Down Expand Up @@ -230,7 +231,6 @@ private void UpdateProgress(string headline, string description, bool isProcessi
LoadingPercentage = percentage;
}


private async void LoadData()
{
try
Expand Down
4 changes: 0 additions & 4 deletions src/Gml.Launcher/ViewModels/Pages/ProfilePageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ internal ProfilePageViewModel(IScreen screen,

RxApp.MainThreadScheduler.Schedule(LoadData);



// File.Delete("logs.txt");

}

private async void LoadData()
Expand Down
2 changes: 1 addition & 1 deletion src/Gml.Launcher/Views/Components/GmlButton.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

<Setter Property="CornerRadius" Value="50" />
<Setter Property="Height" Value="50" />
<Setter Property="FontWeight" Value="ExtraBold" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Padding" Value="10, 0, 20, 0" />

<Setter Property="Template">
Expand Down
24 changes: 12 additions & 12 deletions src/Gml.Launcher/Views/Components/ProfileUserControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@
Size="45"/>

<Image converters:AsyncSkinRenderLoader.Source="{TemplateBinding SkinUrl}"
VerticalAlignment="Bottom"
VerticalAlignment="Top"
Margin="0, 0, 0, -128"
Height="350" />
<Canvas>
<Path Canvas.Bottom="0"
Data="M 0 -200 L 0 0 L 60 20 L 290 20 L 350 0 L 350 -200 Z"
Fill="{DynamicResource ProfileLinearGradient}" />
<Path Stroke="{DynamicResource PrimaryColor}"
Canvas.Bottom="0"
StrokeThickness="2"
Data="M 0 0 L 60 20 L 290 20 L 350 0" />
</Canvas>
</Grid>
</Border>
<TextBlock Text="{TemplateBinding UserName}"
Foreground="{DynamicResource PrimaryColor}"
TextAlignment="Center"
VerticalAlignment="Bottom"
Margin="0,0,0,10"
VerticalAlignment="Top"
Margin="0,15,0,0"
FontSize="24"
FontWeight="ExtraBlack" />
</Grid>
<Canvas Grid.Row="0">
<Path Canvas.Bottom="0"
Data="M 0 -200 L 0 0 L 60 20 L 290 20 L 350 0 L 350 -200 Z"
Fill="{DynamicResource ProfileLinearGradient}" />
<Path Stroke="{DynamicResource PrimaryColor}"
Canvas.Bottom="0"
StrokeThickness="2"
Data="M 0 0 L 60 20 L 290 20 L 350 0" />
</Canvas>
<StackPanel Grid.Row="1" Margin="30">

<controls:ProfileInfoComponent />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ProfileUserControl : TemplatedControl
nameof(ProfileInfoItems));

public static readonly StyledProperty<string> SkinUrlProperty = AvaloniaProperty.Register<ProfileUserControl, string>(
nameof(SkinUrl), "https://textures.recloud.tech/skin/GamerVII/front/128");
nameof(SkinUrl), "https://www.clipartkey.com/mpngs/m/215-2156859_fond-transparent-steve-minecraft.png");

public static readonly StyledProperty<string> UserNameProperty = AvaloniaProperty.Register<ProfileUserControl, string>(
nameof(UserName), "GamerVII");
Expand Down
2 changes: 1 addition & 1 deletion src/Gml.Launcher/Views/Components/ServerInfo.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<TextBlock Text="{TemplateBinding ProfileName}"
Foreground="{TemplateBinding Foreground}"
TextWrapping="Wrap"
FontWeight="ExtraBlack"
FontWeight="Black"
FontSize="{TemplateBinding FontSize}"/>

<TextBlock Text="{TemplateBinding ProfileDescription}"
Expand Down
2 changes: 1 addition & 1 deletion src/Gml.Launcher/Views/Pages/ProfilePageView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<components:ProfileUserControl Grid.Row="2"
Grid.Column="0"
UserName="{Binding User.Name}"
SkinUrl="{Binding User.TextureUrl,Converter={converters:NoiseStringAddConverter}}"
SkinUrl="{Binding User.TextureUrl, Converter={converters:NoiseStringAddConverter}}"
VerticalAlignment="Top" />

</Grid>
Expand Down

0 comments on commit 270ff84

Please sign in to comment.