Skip to content

Commit

Permalink
Merge dev and master btanches (#28)
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.

* 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.

* Update submodule link Gml.Client

* 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".

* 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".

---------

Co-authored-by: GamerVII-NET <gamervii.phone@gmail.com>
  • Loading branch information
GamerVII-NET and gamerviihub authored Jun 6, 2024
1 parent 067961b commit 88ff5a7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/Gml.Client
4 changes: 2 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,7 @@ 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 FolderName = "GamerVIILacunerhV2";
}
50 changes: 29 additions & 21 deletions src/Gml.Launcher/Core/Converters/AsyncStreamToImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Avalonia;
using Avalonia.Media.Imaging;
using Gml.Launcher.Views.Components;
using Sentry;

namespace Gml.Launcher.Core.Converters;

Expand All @@ -24,31 +25,38 @@ static AsyncStreamToImageLoader()

private static async void OnSourceChanged(BackgroundComponent sender, AvaloniaPropertyChangedEventArgs args)
{
var url = args.GetNewValue<string>();

if (string.IsNullOrEmpty(url))
try
{
sender.Source = null;
return;
var url = args.GetNewValue<string>();

if (string.IsNullOrEmpty(url))
{
sender.Source = null;
return;
}

if (string.IsNullOrEmpty(url) || !ValidateUrl(url))
{
sender.Source = null;
return;
}

var fileName = Path.Combine(TempPath, Path.GetFileName(url));

if (!File.Exists(fileName))
{
using var client = new HttpClient();
var response = await client.GetByteArrayAsync(url);
using var stream = new MemoryStream(response);
await ConvertStreamToFile(stream, fileName);
}

sender.Source = new Bitmap(File.OpenRead(fileName));
}

if (string.IsNullOrEmpty(url) || !ValidateUrl(url))
{
sender.Source = null;
return;
};

var fileName = Path.Combine(TempPath, Path.GetFileName(url));

if (!File.Exists(fileName))
catch (Exception exception)
{
using var client = new HttpClient();
var response = await client.GetByteArrayAsync(url);
using var stream = new MemoryStream(response);
await ConvertStreamToFile(stream, fileName);
SentrySdk.CaptureException(exception);
}

sender.Source = new Bitmap(File.OpenRead(fileName));
}

private static async Task ConvertStreamToFile(Stream input, string filePath)
Expand Down

0 comments on commit 88ff5a7

Please sign in to comment.